From eac036105ea6249a8aa1baf1648547dc0215e660 Mon Sep 17 00:00:00 2001 From: Rexbas Date: Mon, 22 Jan 2024 21:34:08 +0100 Subject: [PATCH] Gui: Prevent rubber-band selection when selection button is pressed after other buttons are pressed --- src/Gui/BlenderNavigationStyle.cpp | 14 ++++++++------ src/Gui/CADNavigationStyle.cpp | 14 ++++++++------ src/Gui/InventorNavigationStyle.cpp | 6 ++++++ src/Gui/OpenCascadeNavigationStyle.cpp | 5 +++++ src/Gui/OpenSCADNavigationStyle.cpp | 5 +++++ src/Gui/RevitNavigationStyle.cpp | 14 ++++++++------ src/Gui/TinkerCADNavigationStyle.cpp | 5 +++++ src/Gui/TouchpadNavigationStyle.cpp | 5 +++++ 8 files changed, 50 insertions(+), 18 deletions(-) diff --git a/src/Gui/BlenderNavigationStyle.cpp b/src/Gui/BlenderNavigationStyle.cpp index 816c35dbb1..7b86928712 100644 --- a/src/Gui/BlenderNavigationStyle.cpp +++ b/src/Gui/BlenderNavigationStyle.cpp @@ -278,16 +278,18 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) break; } + // If the selection button is pressed together with another button + // and the other button is released, don't switch to selection mode. + // Process when selection button is pressed together with other buttons that could trigger different actions. + if (this->button1down && (this->button2down || this->button3down)) { + this->lockButton1 = true; + processed = true; + } + if (newmode != curmode) { this->setViewingMode(newmode); } - // If for dragging the buttons 1 and 3 are pressed - // but then button 3 is released we shouldn't switch - // into selection mode. - if (this->button1down && this->button3down) - this->lockButton1 = true; - // If not handled in this class, pass on upwards in the inheritance // hierarchy. if (!processed) diff --git a/src/Gui/CADNavigationStyle.cpp b/src/Gui/CADNavigationStyle.cpp index 6026ff0faf..5fa46cd7bb 100644 --- a/src/Gui/CADNavigationStyle.cpp +++ b/src/Gui/CADNavigationStyle.cpp @@ -302,16 +302,18 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev) break; } + // If the selection button is pressed together with another button + // and the other button is released, don't switch to selection mode. + // Process when selection button is pressed together with other buttons that could trigger different actions. + if (this->button1down && (this->button2down || this->button3down)) { + this->lockButton1 = true; + processed = true; + } + if (newmode != curmode) { this->setViewingMode(newmode); } - // If for dragging the buttons 1 and 3 are pressed - // but then button 3 is released we shouldn't switch - // into selection mode. - if (this->button1down && this->button3down) - this->lockButton1 = true; - // If not handled in this class, pass on upwards in the inheritance // hierarchy. if (!processed) diff --git a/src/Gui/InventorNavigationStyle.cpp b/src/Gui/InventorNavigationStyle.cpp index 923854ec21..6143ce0ea0 100644 --- a/src/Gui/InventorNavigationStyle.cpp +++ b/src/Gui/InventorNavigationStyle.cpp @@ -269,6 +269,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev) } break; case BUTTON1DOWN: + if (curmode == NavigationStyle::SELECTION) { break; } if (newmode != NavigationStyle::DRAGGING) { saveCursorPosition(ev); } @@ -295,6 +296,11 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev) break; } + // Process when selection button is pressed together with other buttons that could trigger different actions. + if (this->button1down && (this->button2down || this->button3down)) { + processed = true; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/OpenCascadeNavigationStyle.cpp b/src/Gui/OpenCascadeNavigationStyle.cpp index 7f97cbf0c3..77f5cba112 100644 --- a/src/Gui/OpenCascadeNavigationStyle.cpp +++ b/src/Gui/OpenCascadeNavigationStyle.cpp @@ -264,6 +264,11 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev) break; } + // Process when selection button is pressed together with other buttons that could trigger different actions. + if (this->button1down && (this->button2down || this->button3down || this->ctrldown)) { + processed = true; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/OpenSCADNavigationStyle.cpp b/src/Gui/OpenSCADNavigationStyle.cpp index e3b050fc25..99e9b85fef 100644 --- a/src/Gui/OpenSCADNavigationStyle.cpp +++ b/src/Gui/OpenSCADNavigationStyle.cpp @@ -259,6 +259,11 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev) break; } + // Process when selection button is pressed together with other buttons that could trigger different actions. + if (this->button1down && (this->button2down || this->button3down)) { + processed = true; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/RevitNavigationStyle.cpp b/src/Gui/RevitNavigationStyle.cpp index 9c2de94dcf..0fc09dac70 100644 --- a/src/Gui/RevitNavigationStyle.cpp +++ b/src/Gui/RevitNavigationStyle.cpp @@ -280,16 +280,18 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev) break; } + // If the selection button is pressed together with another button + // and the other button is released, don't switch to selection mode. + // Process when selection button is pressed together with other buttons that could trigger different actions. + if (this->button1down && (this->button2down || this->button3down)) { + this->lockButton1 = true; + processed = true; + } + if (newmode != curmode) { this->setViewingMode(newmode); } - // If for dragging the buttons 1 and 3 are pressed - // but then button 3 is released we shouldn't switch - // into selection mode. - if (this->button1down && this->button3down) - this->lockButton1 = true; - // If not handled in this class, pass on upwards in the inheritance // hierarchy. if (!processed) diff --git a/src/Gui/TinkerCADNavigationStyle.cpp b/src/Gui/TinkerCADNavigationStyle.cpp index af2f2a0435..0c506dbb25 100644 --- a/src/Gui/TinkerCADNavigationStyle.cpp +++ b/src/Gui/TinkerCADNavigationStyle.cpp @@ -233,6 +233,11 @@ SbBool TinkerCADNavigationStyle::processSoEvent(const SoEvent * const ev) break; } + // Process when selection button is pressed together with other buttons that could trigger different actions. + if (this->button1down && (this->button2down || this->button3down)) { + processed = true; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/TouchpadNavigationStyle.cpp b/src/Gui/TouchpadNavigationStyle.cpp index 978438c871..817a5e9bf1 100644 --- a/src/Gui/TouchpadNavigationStyle.cpp +++ b/src/Gui/TouchpadNavigationStyle.cpp @@ -254,6 +254,11 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev) break; } + // Process when selection button is pressed together with other buttons that could trigger different actions. + if (this->button1down && (this->button2down || this->button3down || this->altdown)) { + processed = true; + } + if (newmode != curmode) { this->setViewingMode(newmode); }