Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

shift-middledrag (camera distance modification) should be expomential #282

Closed
chrysn opened this Issue · 3 comments

2 participants

@chrysn

when moving the camera to or away from the screen center, the absolute camera movement is linear to the mouse distance. this is

  • counter-intuitive, as the perceived mouse-to-world-coordinate ratio is changing during the operation
  • imprecise when viewing objects from very close
  • impractical with large objects (try with distances > 6000)

on my screen, dragging from top to bottom moves the camera by 450 world units; i'd prefer it to roughly double with one screen drag independently of the distance.

(this might or might not be an issue with mouse wheel zooming too -- for lack of one, i can't try.)

observed on openscad 2013.01.

@chrysn

the issue can be solved as easily as applying this:

diff --git a/src/QGLView.cc b/src/QGLView.cc
index b23ba8e..1e5628f 100644
--- a/src/QGLView.cc
+++ b/src/QGLView.cc
@@ -221,7 +221,7 @@ void QGLView::mouseMoveEvent(QMouseEvent *event)
       // Middle button pans in the xy plane
       // Shift-right and Shift-middle zooms
       if ((QApplication::keyboardModifiers() & Qt::ShiftModifier) != 0) {
-        cam.viewer_distance += (GLdouble)dy;
+        cam.viewer_distance *= (GLdouble)(1.0 + (double)dy / ((QApplication::keyboardModifiers() & Qt::AltModifier) ? 2000.0 : 100.0));
       } else {

       double mx = +(dx) * cam.viewer_distance/1000;

please apply as you consider it suitable; the choice of 2000.0 for coarse motion and 100.0 for fine motion works well on my system, and even if it's not a perfect fit for every resolution, it's much better than the old behavior. the "press alt for slower motion" was just a spontaenous idea; if you don't see a need for it or it doesn't fit in the user interface paradigm, replace the conditional expression with 2000.0

@kintel
Owner

The "real" solution is to not use our own navigation code but rely on a library, but this looks like a decent enough hack - I'll look at it :)

@kintel
Owner

This was improved recently

@kintel kintel closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.