← Back to team overview

yade-dev team mailing list archive

[Branch ~yade-pkg/yade/git-trunk] Rev 3936: Fix scrolling direction for libQGLviewer > 2.5.0

 

------------------------------------------------------------
revno: 3936
committer: Anton Gladky <gladky.anton@xxxxxxxxx>
timestamp: Tue 2014-05-06 16:24:07 +0200
message:
  Fix scrolling direction for libQGLviewer > 2.5.0
modified:
  gui/qt4/GLViewer.cpp
  gui/qt4/GLViewerMouse.cpp


--
lp:yade
https://code.launchpad.net/~yade-pkg/yade/git-trunk

Your team Yade developers is subscribed to branch lp:yade.
To unsubscribe from this branch go to https://code.launchpad.net/~yade-pkg/yade/git-trunk/+edit-subscription
=== modified file 'gui/qt4/GLViewer.cpp'
--- gui/qt4/GLViewer.cpp	2014-04-16 19:53:59 +0000
+++ gui/qt4/GLViewer.cpp	2014-05-06 14:24:07 +0000
@@ -75,9 +75,7 @@
 
 	xyPlaneConstraint=shared_ptr<qglviewer::LocalConstraint>(new qglviewer::LocalConstraint());
 	manipulatedFrame()->setConstraint(NULL);
-#if QGLVIEWER_VERSION>=0x020500
-  manipulatedFrame()->setWheelSensitivity(-1.0f);
-#endif
+
 	setKeyDescription(Qt::Key_Return,"Run simulation.");
 	setKeyDescription(Qt::Key_A,"Toggle visibility of global axes.");
 	setKeyDescription(Qt::Key_C,"Set scene center so that all bodies are visible; if a body is selected, center around this body.");

=== modified file 'gui/qt4/GLViewerMouse.cpp'
--- gui/qt4/GLViewerMouse.cpp	2014-03-18 16:40:43 +0000
+++ gui/qt4/GLViewerMouse.cpp	2014-05-06 14:24:07 +0000
@@ -25,7 +25,7 @@
 #include<boost/algorithm/string/case_conv.hpp>
 #include<yade/lib/serialization/ObjectIO.hpp>
 #include<yade/lib/pyutil/gil.hpp>
-
+#include<QGLViewer/manipulatedCameraFrame.h>
 
 #include<QtGui/qevent.h>
 
@@ -38,22 +38,21 @@
 void GLViewer::mouseMovesCamera(){
   setWheelBinding(Qt::ShiftModifier , FRAME, ZOOM);
   setWheelBinding(Qt::NoModifier, CAMERA, ZOOM);
+  camera()->frame()->setWheelSensitivity(-1.0f);
 
 #if QGLVIEWER_VERSION>=0x020500
-    setMouseBinding(Qt::ShiftModifier, Qt::LeftButton, SELECT);
+  setMouseBinding(Qt::ShiftModifier, Qt::LeftButton, SELECT);
+  
+  setMouseBinding(Qt::ShiftModifier, Qt::LeftButton, FRAME, ZOOM);
+  setMouseBinding(Qt::ShiftModifier, Qt::RightButton, FRAME, ZOOM);
+  setMouseBinding(Qt::ShiftModifier, Qt::MidButton, FRAME, TRANSLATE);
+  setMouseBinding(Qt::ShiftModifier, Qt::RightButton, FRAME, ROTATE);
     
-    setMouseBinding(Qt::ShiftModifier, Qt::LeftButton, FRAME, ZOOM);
-    setMouseBinding(Qt::ShiftModifier, Qt::RightButton, FRAME, ZOOM);
-    setMouseBinding(Qt::ShiftModifier, Qt::MidButton, FRAME, TRANSLATE);
-    setMouseBinding(Qt::ShiftModifier, Qt::RightButton, FRAME, ROTATE);
-      
-    setMouseBinding(Qt::NoModifier, Qt::RightButton, CAMERA, ZOOM);
-    setMouseBinding(Qt::NoModifier, Qt::MidButton, CAMERA, ZOOM);
-    setMouseBinding(Qt::NoModifier, Qt::LeftButton, CAMERA, ROTATE);
-    setMouseBinding(Qt::NoModifier, Qt::RightButton, CAMERA, TRANSLATE);
+  setMouseBinding(Qt::NoModifier, Qt::RightButton, CAMERA, ZOOM);
+  setMouseBinding(Qt::NoModifier, Qt::MidButton, CAMERA, ZOOM);
+  setMouseBinding(Qt::NoModifier, Qt::LeftButton, CAMERA, ROTATE);
+  setMouseBinding(Qt::NoModifier, Qt::RightButton, CAMERA, TRANSLATE);
 #else
-  camera()->frame()->setWheelSensitivity(-1.0f);
-  
   setMouseBinding(Qt::SHIFT + Qt::LeftButton, SELECT);
   setMouseBinding(Qt::SHIFT + Qt::LeftButton + Qt::RightButton, FRAME, ZOOM);
   setMouseBinding(Qt::SHIFT + Qt::MidButton, FRAME, TRANSLATE);