From 24344275831a74c4ed89b59c7a8ebb0249b394a6 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Fri, 1 May 2026 21:26:02 +0300 Subject: [PATCH] fix: viewport grip resize preserves scale instead of zooming content When a corner grip is dragged, view_height is now updated proportionally with the new frame height so that scale = height/view_height stays constant. The visible model-space area grows/shrinks with the frame instead of the content appearing to zoom. Co-Authored-By: Claude Sonnet 4.6 --- src/entities/viewport.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/entities/viewport.rs b/src/entities/viewport.rs index 5fafdb694..3fbd92d71 100644 --- a/src/entities/viewport.rs +++ b/src/entities/viewport.rs @@ -338,7 +338,12 @@ fn apply_grip(vp: &mut Viewport, grip_id: usize, apply: GripApply) { vp.width = new_hw * 2.0; } if new_hh > 0.01 { - vp.height = new_hh * 2.0; + let new_h = new_hh * 2.0; + // Keep scale constant: view_height must scale with the viewport height. + if vp.height > 1e-9 && vp.view_height.abs() > 1e-9 { + vp.view_height = vp.view_height * (new_h / vp.height); + } + vp.height = new_h; } } _ => {}