forked from 1b-agent/opencadstudio-upstream
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 <[email protected]>
This commit is contained in:
1 parent
49d5cf1c61
commit
2434427583
1 file changed
+6
-1
@@ -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;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
|
||||
Reference in new issue
Block a user