diff --git a/src/Gui/BlenderNavigationStyle.cpp b/src/Gui/BlenderNavigationStyle.cpp index 7b86928712..7b9a04c2bb 100644 --- a/src/Gui/BlenderNavigationStyle.cpp +++ b/src/Gui/BlenderNavigationStyle.cpp @@ -242,17 +242,15 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) case 0: if (curmode == NavigationStyle::SPINNING) { break; } newmode = NavigationStyle::IDLE; - // The left mouse button has been released right now but - // we want to avoid that the event is processed elsewhere + // The left mouse button has been released right now if (this->lockButton1) { this->lockButton1 = false; - processed = true; } break; case BUTTON1DOWN: case CTRLDOWN|BUTTON1DOWN: // make sure not to change the selection when stopping spinning - if (curmode == NavigationStyle::SPINNING || this->lockButton1) + if (!viewer->isEditing() && (curmode == NavigationStyle::SPINNING || this->lockButton1)) newmode = NavigationStyle::IDLE; else newmode = NavigationStyle::SELECTION; @@ -286,6 +284,12 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) processed = true; } + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing() && curmode == NavigationStyle::SELECTION && newmode != NavigationStyle::IDLE) { + newmode = NavigationStyle::SELECTION; + processed = false; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/CADNavigationStyle.cpp b/src/Gui/CADNavigationStyle.cpp index 5fa46cd7bb..0ba8e0fae7 100644 --- a/src/Gui/CADNavigationStyle.cpp +++ b/src/Gui/CADNavigationStyle.cpp @@ -250,16 +250,14 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev) case 0: if (curmode == NavigationStyle::SPINNING) { break; } newmode = NavigationStyle::IDLE; - // The left mouse button has been released right now but - // we want to avoid that the event is processed elsewhere + // The left mouse button has been released right now if (this->lockButton1) { this->lockButton1 = false; - processed = true; } break; case BUTTON1DOWN: // make sure not to change the selection when stopping spinning - if (curmode == NavigationStyle::SPINNING || this->lockButton1) + if (!viewer->isEditing() && (curmode == NavigationStyle::SPINNING || this->lockButton1)) newmode = NavigationStyle::IDLE; else newmode = NavigationStyle::SELECTION; @@ -310,6 +308,12 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev) processed = true; } + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing() && curmode == NavigationStyle::SELECTION && newmode != NavigationStyle::IDLE) { + newmode = NavigationStyle::SELECTION; + processed = false; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/InventorNavigationStyle.cpp b/src/Gui/InventorNavigationStyle.cpp index 6143ce0ea0..3d553f78ff 100644 --- a/src/Gui/InventorNavigationStyle.cpp +++ b/src/Gui/InventorNavigationStyle.cpp @@ -301,6 +301,12 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev) processed = true; } + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing() && curmode == NavigationStyle::SELECTION && newmode != NavigationStyle::IDLE) { + newmode = NavigationStyle::SELECTION; + processed = false; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/MayaGestureNavigationStyle.cpp b/src/Gui/MayaGestureNavigationStyle.cpp index 2b3b652043..1f58d2972d 100644 --- a/src/Gui/MayaGestureNavigationStyle.cpp +++ b/src/Gui/MayaGestureNavigationStyle.cpp @@ -308,8 +308,40 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev) //all mode-dependent stuff is within this switch. switch(curmode){ - case NavigationStyle::IDLE: case NavigationStyle::SELECTION: + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing()) { + if (evIsButton) { + auto const event = (const SoMouseButtonEvent*)ev; + const SbBool press = event->getState() == SoButtonEvent::DOWN; + const int button = event->getButton(); + + if (!press && button == SoMouseButtonEvent::BUTTON1) { + setViewingMode(NavigationStyle::IDLE); + break; + } + } + + if (this->button1down) { + break; + } + } + [[fallthrough]]; + case NavigationStyle::IDLE: + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing()) { + if (evIsButton) { + auto const event = (const SoMouseButtonEvent*)ev; + const SbBool press = event->getState() == SoButtonEvent::DOWN; + const int button = event->getButton(); + + if (press && button == SoMouseButtonEvent::BUTTON1 && !this->altdown) { + setViewingMode(NavigationStyle::SELECTION); + break; + } + } + } + [[fallthrough]]; case NavigationStyle::INTERACT: { //idle and interaction diff --git a/src/Gui/OpenCascadeNavigationStyle.cpp b/src/Gui/OpenCascadeNavigationStyle.cpp index 77f5cba112..fe14812048 100644 --- a/src/Gui/OpenCascadeNavigationStyle.cpp +++ b/src/Gui/OpenCascadeNavigationStyle.cpp @@ -269,6 +269,12 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev) processed = true; } + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing() && curmode == NavigationStyle::SELECTION && newmode != NavigationStyle::IDLE) { + newmode = NavigationStyle::SELECTION; + processed = false; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/OpenSCADNavigationStyle.cpp b/src/Gui/OpenSCADNavigationStyle.cpp index 99e9b85fef..a37b6ef21f 100644 --- a/src/Gui/OpenSCADNavigationStyle.cpp +++ b/src/Gui/OpenSCADNavigationStyle.cpp @@ -264,6 +264,12 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev) processed = true; } + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing() && curmode == NavigationStyle::SELECTION && newmode != NavigationStyle::IDLE) { + newmode = NavigationStyle::SELECTION; + processed = false; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/RevitNavigationStyle.cpp b/src/Gui/RevitNavigationStyle.cpp index 0fc09dac70..78535462ab 100644 --- a/src/Gui/RevitNavigationStyle.cpp +++ b/src/Gui/RevitNavigationStyle.cpp @@ -239,17 +239,15 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev) case 0: if (curmode == NavigationStyle::SPINNING) { break; } newmode = NavigationStyle::IDLE; - // The left mouse button has been released right now but - // we want to avoid that the event is processed elsewhere + // The left mouse button has been released right now if (this->lockButton1) { this->lockButton1 = false; - processed = true; } break; case BUTTON1DOWN: case CTRLDOWN|BUTTON1DOWN: // make sure not to change the selection when stopping spinning - if (curmode == NavigationStyle::SPINNING || this->lockButton1) + if (!viewer->isEditing() && (curmode == NavigationStyle::SPINNING || this->lockButton1)) newmode = NavigationStyle::IDLE; else newmode = NavigationStyle::SELECTION; @@ -288,6 +286,12 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev) processed = true; } + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing() && curmode == NavigationStyle::SELECTION && newmode != NavigationStyle::IDLE) { + newmode = NavigationStyle::SELECTION; + processed = false; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/TinkerCADNavigationStyle.cpp b/src/Gui/TinkerCADNavigationStyle.cpp index 0c506dbb25..a35632f7bd 100644 --- a/src/Gui/TinkerCADNavigationStyle.cpp +++ b/src/Gui/TinkerCADNavigationStyle.cpp @@ -238,6 +238,12 @@ SbBool TinkerCADNavigationStyle::processSoEvent(const SoEvent * const ev) processed = true; } + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing() && curmode == NavigationStyle::SELECTION && newmode != NavigationStyle::IDLE) { + newmode = NavigationStyle::SELECTION; + processed = false; + } + if (newmode != curmode) { this->setViewingMode(newmode); } diff --git a/src/Gui/TouchpadNavigationStyle.cpp b/src/Gui/TouchpadNavigationStyle.cpp index 817a5e9bf1..5400440ae5 100644 --- a/src/Gui/TouchpadNavigationStyle.cpp +++ b/src/Gui/TouchpadNavigationStyle.cpp @@ -259,6 +259,12 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev) processed = true; } + // Prevent interrupting rubber-band selection in sketcher + if (viewer->isEditing() && curmode == NavigationStyle::SELECTION && newmode != NavigationStyle::IDLE) { + newmode = NavigationStyle::SELECTION; + processed = false; + } + if (newmode != curmode) { this->setViewingMode(newmode); }