diff options
Diffstat (limited to 'src/glview.cc')
-rw-r--r-- | src/glview.cc | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/glview.cc b/src/glview.cc index 0f9ec5b..aa2e746 100644 --- a/src/glview.cc +++ b/src/glview.cc @@ -393,8 +393,6 @@ void GLView::paintGL() glRotated(object_rot_y, 0.0, 1.0, 0.0); glRotated(object_rot_z, 0.0, 0.0, 1.0); - glTranslated(object_trans_x, object_trans_y, object_trans_z); - // FIXME: Crosshairs and axes are lighted, this doesn't make sense and causes them // to change color based on view orientation. if (showcrosshairs) @@ -412,6 +410,8 @@ void GLView::paintGL() glEnd(); } + glTranslated(object_trans_x, object_trans_y, object_trans_z); + // Large gray axis cross inline with the model // FIXME: This is always gray - adjust color to keep contrast with background if (showaxes) @@ -589,14 +589,24 @@ void GLView::mouseMoveEvent(QMouseEvent *event) normalizeAngle(object_rot_y); normalizeAngle(object_rot_z); } else { - // Right button pans - // Shift-right zooms + // Right button pans in the xz plane + // Middle button pans in the xy plane + // Shift-right and Shift-middle zooms if ((QApplication::keyboardModifiers() & Qt::ShiftModifier) != 0) { viewer_distance += (GLdouble)dy; } else { double mx = +(dx) * viewer_distance/1000; - double my = -(dy) * viewer_distance/1000; + double mz = -(dy) * viewer_distance/1000; + + double my = 0; + if (event->buttons() & Qt::MiddleButton) { + my = mz; + mz = 0; + // actually lock the x-position + // (turns out to be easier to use than xy panning) + mx = 0; + } Matrix3d aax, aay, aaz, tm3; aax = Eigen::AngleAxisd(-(object_rot_x/180) * M_PI, Vector3d::UnitX()); @@ -612,15 +622,10 @@ void GLView::mouseMoveEvent(QMouseEvent *event) Matrix4d vec; vec << 0, 0, 0, mx, - 0, 0, 0, 0, 0, 0, 0, my, + 0, 0, 0, mz, 0, 0, 0, 1 ; - if ((QApplication::keyboardModifiers() & Qt::ShiftModifier) != 0) { - vec(0,3) = 0; - vec(1,3) = my; - vec(2,3) = 0; - } tm = tm * vec; object_trans_x += tm(0,3); object_trans_y += tm(1,3); |