M13.17: the viewer keeps its pan after a middle-button or Hand drag — egui reports no total drag on the release frame, so the pan was recomputed as the drag's start and snapped back

This commit is contained in:
bflatastic
2026-10-04 00:31:59 +07:00
parent bb06a66083
commit bb973e2c76
2 changed files with 37 additions and 2 deletions
+5 -2
View File
@@ -1097,8 +1097,11 @@ pub fn show(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
let merge = format!("viewer-drag-{}", ui.data(|d| d.get_temp::<u64>(egui::Id::new("viewer-drag-n")).unwrap_or(0)));
match g {
Gesture::Pan { start_pan } => {
let d = resp.total_drag_delta().unwrap_or_default();
app.ui.viewer.pan = [start_pan[0] + d.x, start_pan[1] + d.y];
// No total drag on the release frame: keep the pan reached so far (it used to
// snap back to where the drag began).
if let Some(d) = resp.total_drag_delta() {
app.ui.viewer.pan = [start_pan[0] + d.x, start_pan[1] + d.y];
}
}
Gesture::Move { layers, start, snap_src } => {
let mut d = [cpt[0] - start[0], cpt[1] - start[1]];