diff --git a/src/Gui/DlgSettings3DView.ui b/src/Gui/DlgSettings3DView.ui index 2f719433f7..d966d5482a 100644 --- a/src/Gui/DlgSettings3DView.ui +++ b/src/Gui/DlgSettings3DView.ui @@ -7,7 +7,7 @@ 0 0 477 - 505 + 630 @@ -323,6 +323,25 @@ + + + + Prevents view tilting when pinch-zooming. Affects only Gesture nav. style. Mouse tilting is not disabled by this setting. + + + Disable touchscreen tilt gesture + + + true + + + DisableTouchTilt + + + View + + + @@ -344,7 +363,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -423,6 +451,16 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + @@ -598,13 +636,8 @@
Gui/Widgets.h
- Gui::PrefColorButton - Gui::ColorButton -
Gui/PrefWidgets.h
-
- - Gui::PrefSlider - QSlider + Gui::PrefCheckBox + QCheckBox
Gui/PrefWidgets.h
@@ -613,13 +646,18 @@
Gui/PrefWidgets.h
- Gui::PrefCheckBox - QCheckBox + Gui::PrefComboBox + QComboBox
Gui/PrefWidgets.h
- Gui::PrefComboBox - QComboBox + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
+ + Gui::PrefSlider + QSlider
Gui/PrefWidgets.h
diff --git a/src/Gui/DlgSettings3DViewImp.cpp b/src/Gui/DlgSettings3DViewImp.cpp index 6bcbff2d2e..7d51135f1e 100644 --- a/src/Gui/DlgSettings3DViewImp.cpp +++ b/src/Gui/DlgSettings3DViewImp.cpp @@ -88,6 +88,7 @@ void DlgSettings3DViewImp::saveSettings() checkBoxZoomAtCursor->onSave(); checkBoxInvertZoom->onSave(); + checkBoxDisableTilt->onSave(); spinBoxZoomStep->onSave(); checkBoxDragAtCursor->onSave(); CheckBox_CornerCoordSystem->onSave(); @@ -107,6 +108,7 @@ void DlgSettings3DViewImp::loadSettings() { checkBoxZoomAtCursor->onRestore(); checkBoxInvertZoom->onRestore(); + checkBoxDisableTilt->onRestore(); spinBoxZoomStep->onRestore(); checkBoxDragAtCursor->onRestore(); CheckBox_CornerCoordSystem->onRestore(); diff --git a/src/Gui/GestureNavigationStyle.cpp b/src/Gui/GestureNavigationStyle.cpp index 46bc4fe97c..1613aaef63 100644 --- a/src/Gui/GestureNavigationStyle.cpp +++ b/src/Gui/GestureNavigationStyle.cpp @@ -236,10 +236,13 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev) if (evIsGesture) { const SoGestureEvent* gesture = static_cast(ev); switch(gesture->state) { - case SoGestureEvent::SbGSStart: + case SoGestureEvent::SbGSStart:{ //assert(!inGesture);//start of another gesture before the first finished? Happens all the time for Pan gesture... No idea why! --DeepSOIC inGesture = true; - break; + + enableGestureTilt = !(App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View")->GetBool("DisableTouchTilt",true)); + }break; case SoGestureEvent::SbGSUpdate: assert(inGesture);//gesture update without start? inGesture = true; @@ -551,7 +554,7 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev) NavigationStyle::panCamera(viewer->getSoRenderManager()->getCamera(), ratio, this->panningplane, panDist, SbVec2f(0,0)); } NavigationStyle::doZoom(viewer->getSoRenderManager()->getCamera(),-logf(event->deltaZoom),this->normalizePixelPos(event->curCenter)); - if (event->deltaAngle != 0) + if (event->deltaAngle != 0 && enableGestureTilt) NavigationStyle::doRotate(viewer->getSoRenderManager()->getCamera(),event->deltaAngle,this->normalizePixelPos(event->curCenter)); processed = true; } diff --git a/src/Gui/NavigationStyle.h b/src/Gui/NavigationStyle.h index 6144c73952..127fa210ae 100644 --- a/src/Gui/NavigationStyle.h +++ b/src/Gui/NavigationStyle.h @@ -412,6 +412,7 @@ protected: bool thisClickIsComplex;//a flag that becomes set when a complex clicking pattern is detected (i.e., two or more mouse buttons were down at the same time). bool inGesture; //a flag that is used to filter out mouse events during gestures. + bool enableGestureTilt = false; //fetched from settings }; class GuiExport OpenCascadeNavigationStyle : public UserNavigationStyle { diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 975f81e78d..3a74c33725 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -922,6 +922,8 @@ void View3DInventorViewer::setNavigationType(Base::Type t) if (t.isBad()) return; + this->winGestureTuneState = View3DInventorViewer::ewgtsNeedTuning; //triggers enable/disable rotation gesture when preferences change + if (this->navigation && this->navigation->getTypeId() == t) return; // nothing to do diff --git a/src/Gui/WinNativeGestureRecognizers.cpp b/src/Gui/WinNativeGestureRecognizers.cpp index 8239ead9ea..76a1aee543 100644 --- a/src/Gui/WinNativeGestureRecognizers.cpp +++ b/src/Gui/WinNativeGestureRecognizers.cpp @@ -42,6 +42,8 @@ #include #include +#include +#include QT_BEGIN_NAMESPACE @@ -257,8 +259,16 @@ void WinNativeGestureRecognizerPinch::TuneWindowsGestures(QWidget* target) cfgs[0].dwID = GID_PAN; cfgs[0].dwWant = GC_PAN; cfgs[0].dwBlock = GC_PAN_WITH_GUTTER;//disables stickiness to pure vertical/pure horizontal pans - cfgs[1].dwID = GID_ROTATE; - cfgs[1].dwWant = GC_ROTATE; + + bool enableGestureTilt = !(App::GetApplication().GetParameterGroupByPath + ("User parameter:BaseApp/Preferences/View")->GetBool("DisableTouchTilt",true)); + if(enableGestureTilt){ + cfgs[1].dwID = GID_ROTATE; + cfgs[1].dwWant = GC_ROTATE; + } else { + cfgs[1].dwID = GID_ROTATE; + cfgs[1].dwBlock = GC_ROTATE; + } //set the options bool ret = dllSetGestureConfig(w, 0, nCfg, cfgs, sizeof(GESTURECONFIG));