summaryrefslogtreecommitdiff
path: root/src/glview.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2012-04-24 02:18:29 (GMT)
committerMarius Kintel <marius@kintel.net>2012-04-24 02:18:29 (GMT)
commit04947a8905f8c6a722669c9cdfd465b54a44b0f6 (patch)
tree81ad1de59457db2586e4dfc788f8a443264552d7 /src/glview.cc
parentcab12ccb86e03535cdafc7357dbbc0b5d2ba1fa2 (diff)
parentf5a7e92367adb7bbadaff8d27ff1610d91034b6a (diff)
Merge branch 'master' into value
Diffstat (limited to 'src/glview.cc')
-rw-r--r--src/glview.cc24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/glview.cc b/src/glview.cc
index 0f9ec5b..12657b8 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,21 @@ 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;
+ }
Matrix3d aax, aay, aaz, tm3;
aax = Eigen::AngleAxisd(-(object_rot_x/180) * M_PI, Vector3d::UnitX());
@@ -612,15 +619,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);
contact: Jan Huwald // Impressum