diff --git a/src/Gui/BlenderNavigationStyle.cpp b/src/Gui/BlenderNavigationStyle.cpp index b9f209ba88..816c35dbb1 100644 --- a/src/Gui/BlenderNavigationStyle.cpp +++ b/src/Gui/BlenderNavigationStyle.cpp @@ -142,16 +142,17 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev) // If we are in edit mode then simply ignore the RMB events // to pass the event to the base class. this->lockrecenter = true; - if (!viewer->isEditing()) { - // If we are in zoom or pan mode ignore RMB events otherwise - // the canvas doesn't get any release events + + // Don't show the context menu after dragging, panning or zooming + if (!press && (hasDragged || hasPanned || hasZoomed)) { + processed = true; + } + else if (!press && !viewer->isEditing()) { if (this->currentmode != NavigationStyle::ZOOMING && this->currentmode != NavigationStyle::PANNING && this->currentmode != NavigationStyle::DRAGGING) { if (this->isPopupMenuEnabled()) { - if (!press) { // release right mouse button - this->openPopupMenu(event->getPosition()); - } + this->openPopupMenu(event->getPosition()); } } } diff --git a/src/Gui/CADNavigationStyle.cpp b/src/Gui/CADNavigationStyle.cpp index e0dd117231..6026ff0faf 100644 --- a/src/Gui/CADNavigationStyle.cpp +++ b/src/Gui/CADNavigationStyle.cpp @@ -144,16 +144,17 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev) // If we are in edit mode then simply ignore the RMB events // to pass the event to the base class. this->lockrecenter = true; - if (!viewer->isEditing()) { - // If we are in zoom or pan mode ignore RMB events otherwise - // the canvas doesn't get any release events + + // Don't show the context menu after dragging, panning or zooming + if (!press && (hasDragged || hasPanned || hasZoomed)) { + processed = true; + } + if (!press && !viewer->isEditing()) { if (this->currentmode != NavigationStyle::ZOOMING && this->currentmode != NavigationStyle::PANNING && this->currentmode != NavigationStyle::DRAGGING) { if (this->isPopupMenuEnabled()) { - if (!press) { // release right mouse button - this->openPopupMenu(event->getPosition()); - } + this->openPopupMenu(event->getPosition()); } } } diff --git a/src/Gui/InventorNavigationStyle.cpp b/src/Gui/InventorNavigationStyle.cpp index f4db29b1a2..923854ec21 100644 --- a/src/Gui/InventorNavigationStyle.cpp +++ b/src/Gui/InventorNavigationStyle.cpp @@ -172,15 +172,17 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev) // If we are in edit mode then simply ignore the RMB events // to pass the event to the base class. this->lockrecenter = true; - if (!viewer->isEditing()) { - // If we are in zoom or pan mode ignore RMB events otherwise - // the canvas doesn't get any release events + + // Don't show the context menu after dragging, panning or zooming + if (!press && (hasDragged || hasPanned || hasZoomed)) { + processed = true; + } + else if (!press && !viewer->isEditing()) { if (this->currentmode != NavigationStyle::ZOOMING && - this->currentmode != NavigationStyle::PANNING) { + this->currentmode != NavigationStyle::PANNING && + this->currentmode != NavigationStyle::DRAGGING) { if (this->isPopupMenuEnabled()) { - if (!press) { // release right mouse button - this->openPopupMenu(event->getPosition()); - } + this->openPopupMenu(event->getPosition()); } } } @@ -289,20 +291,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev) newmode = NavigationStyle::ZOOMING; break; - // There are many cases we don't handle that just falls through to - // the default case, like SHIFTDOWN, CTRLDOWN, CTRLDOWN|SHIFTDOWN, - // SHIFTDOWN|BUTTON3DOWN, SHIFTDOWN|CTRLDOWN|BUTTON3DOWN, etc. - // This is a feature, not a bug. :-) - // - // mortene. - default: - // The default will make a spin stop and otherwise not do - // anything. - if ((curmode != NavigationStyle::SEEK_WAIT_MODE) && - (curmode != NavigationStyle::SEEK_MODE)) { - newmode = NavigationStyle::IDLE; - } break; } diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index 01337e05b4..218711c993 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -260,6 +260,7 @@ void NavigationStyle::initialize() this->hasDragged = false; this->hasPanned = false; + this->hasZoomed = false; } void NavigationStyle::finalize() @@ -586,7 +587,10 @@ void NavigationStyle::panCamera(SoCamera * cam, float aspectratio, const SbPlane // Reposition camera according to the vector difference between the // projected points. cam->position = cam->position.getValue() - (current_planept - old_planept); - hasPanned = true; + + if (this->currentmode != NavigationStyle::IDLE) { + hasPanned = true; + } } void NavigationStyle::pan(SoCamera* camera) @@ -695,6 +699,10 @@ void NavigationStyle::zoom(SoCamera * cam, float diffvalue) cam->focalDistance = newfocaldist; } } + + if (this->currentmode != NavigationStyle::IDLE) { + hasZoomed = true; + } } // Calculate a zoom/dolly factor from the difference of the current @@ -900,7 +908,9 @@ void NavigationStyle::spin(const SbVec2f & pointerpos) // animation. if (this->spinsamplecounter > 3) this->spinsamplecounter = 3; - hasDragged = true; + if (this->currentmode != NavigationStyle::IDLE) { + hasDragged = true; + } } /*! @@ -1352,9 +1362,10 @@ void NavigationStyle::setViewingMode(const ViewerMode newmode) return; } - if (newmode != NavigationStyle::IDLE) { + if (newmode == NavigationStyle::IDLE) { hasPanned = false; hasDragged = false; + hasZoomed = false; } switch (newmode) { diff --git a/src/Gui/NavigationStyle.h b/src/Gui/NavigationStyle.h index 8e17166781..c5a0d4f5ef 100644 --- a/src/Gui/NavigationStyle.h +++ b/src/Gui/NavigationStyle.h @@ -261,6 +261,7 @@ protected: float zoomStep; SbBool hasDragged; SbBool hasPanned; + SbBool hasZoomed; /** @name Mouse model */ //@{ diff --git a/src/Gui/OpenCascadeNavigationStyle.cpp b/src/Gui/OpenCascadeNavigationStyle.cpp index 63838e6645..7f97cbf0c3 100644 --- a/src/Gui/OpenCascadeNavigationStyle.cpp +++ b/src/Gui/OpenCascadeNavigationStyle.cpp @@ -139,16 +139,17 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev) // If we are in edit mode then simply ignore the RMB events // to pass the event to the base class. this->lockrecenter = true; - if (!viewer->isEditing()) { - // If we are in zoom or pan mode ignore RMB events otherwise - // the canvas doesn't get any release events + + // Don't show the context menu after dragging, panning or zooming + if (!press && (hasDragged || hasPanned || hasZoomed)) { + processed = true; + } + else if (!press && !viewer->isEditing()) { if (this->currentmode != NavigationStyle::ZOOMING && this->currentmode != NavigationStyle::PANNING && this->currentmode != NavigationStyle::DRAGGING) { if (this->isPopupMenuEnabled()) { - if (!press) { // release right mouse button - this->openPopupMenu(event->getPosition()); - } + this->openPopupMenu(event->getPosition()); } } } diff --git a/src/Gui/OpenSCADNavigationStyle.cpp b/src/Gui/OpenSCADNavigationStyle.cpp index c9b6b74c02..e3b050fc25 100644 --- a/src/Gui/OpenSCADNavigationStyle.cpp +++ b/src/Gui/OpenSCADNavigationStyle.cpp @@ -140,17 +140,16 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev) // to pass the event to the base class. this->lockrecenter = true; this->button2down = press; - if (!viewer->isEditing()) { - // If we are in zoom or pan mode ignore RMB events otherwise - // the canvas doesn't get any release events - if ((curmode != NavigationStyle::ZOOMING && - curmode != NavigationStyle::PANNING && - curmode != NavigationStyle::DRAGGING) || - (curmode == NavigationStyle::PANNING && !hasPanned)) { + + // Don't show the context menu after dragging, panning or zooming + if (!press && (hasDragged || hasPanned || hasZoomed)) { + processed = true; + } + else if (!press && !viewer->isEditing()) { + if (this->currentmode != NavigationStyle::ZOOMING && + this->currentmode != NavigationStyle::DRAGGING) { if (this->isPopupMenuEnabled()) { - if (!press) { // release right mouse button - this->openPopupMenu(event->getPosition()); - } + this->openPopupMenu(event->getPosition()); } } } @@ -166,9 +165,6 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev) newmode = NavigationStyle::IDLE; processed = true; } - else if (!press && curmode == NavigationStyle::PANNING && hasPanned) { - processed = true; - } break; case SoMouseButtonEvent::BUTTON3: this->button3down = press; diff --git a/src/Gui/RevitNavigationStyle.cpp b/src/Gui/RevitNavigationStyle.cpp index b1c96ad714..9c2de94dcf 100644 --- a/src/Gui/RevitNavigationStyle.cpp +++ b/src/Gui/RevitNavigationStyle.cpp @@ -141,16 +141,17 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev) // If we are in edit mode then simply ignore the RMB events // to pass the event to the base class. this->lockrecenter = true; - if (!viewer->isEditing()) { - // If we are in zoom or pan mode ignore RMB events otherwise - // the canvas doesn't get any release events + + // Don't show the context menu after dragging, panning or zooming + if (!press && (hasDragged || hasPanned || hasZoomed)) { + processed = true; + } + else if (!press && !viewer->isEditing()) { if (this->currentmode != NavigationStyle::ZOOMING && this->currentmode != NavigationStyle::PANNING && this->currentmode != NavigationStyle::DRAGGING) { if (this->isPopupMenuEnabled()) { - if (!press) { // release right mouse button - this->openPopupMenu(event->getPosition()); - } + this->openPopupMenu(event->getPosition()); } } } diff --git a/src/Gui/TinkerCADNavigationStyle.cpp b/src/Gui/TinkerCADNavigationStyle.cpp index e229a61f52..af2f2a0435 100644 --- a/src/Gui/TinkerCADNavigationStyle.cpp +++ b/src/Gui/TinkerCADNavigationStyle.cpp @@ -142,15 +142,18 @@ SbBool TinkerCADNavigationStyle::processSoEvent(const SoEvent * const ev) this->centerTime = ev->getTime(); processed = true; } - else if (!press && curmode == NavigationStyle::DRAGGING && hasDragged) { + // Don't show the context menu after dragging, panning or zooming + else if (!press && (hasDragged || hasPanned || hasZoomed)) { processed = true; } - else if (!press && curmode == NavigationStyle::DRAGGING && !hasDragged) { + else if (!press) { newmode = NavigationStyle::IDLE; if (!viewer->isEditing()) { - // If we are in drag mode but mouse hasn't been moved open the context-menu - if (this->isPopupMenuEnabled()) { - this->openPopupMenu(event->getPosition()); + if (this->currentmode != NavigationStyle::ZOOMING && + this->currentmode != NavigationStyle::PANNING) { + if (this->isPopupMenuEnabled()) { + this->openPopupMenu(event->getPosition()); + } } processed = true; } diff --git a/src/Gui/TouchpadNavigationStyle.cpp b/src/Gui/TouchpadNavigationStyle.cpp index 172a0f7ede..978438c871 100644 --- a/src/Gui/TouchpadNavigationStyle.cpp +++ b/src/Gui/TouchpadNavigationStyle.cpp @@ -138,16 +138,17 @@ SbBool TouchpadNavigationStyle::processSoEvent(const SoEvent * const ev) // If we are in edit mode then simply ignore the RMB events // to pass the event to the base class. this->lockrecenter = true; - if (!viewer->isEditing()) { - // If we are in zoom or pan mode ignore RMB events otherwise - // the canvas doesn't get any release events + + // Don't show the context menu after dragging, panning or zooming + if (!press && (hasDragged || hasPanned || hasZoomed)) { + processed = true; + } + else if (!press && !viewer->isEditing()) { if (this->currentmode != NavigationStyle::ZOOMING && this->currentmode != NavigationStyle::PANNING && this->currentmode != NavigationStyle::DRAGGING) { if (this->isPopupMenuEnabled()) { - if (!press) { // release right mouse button - this->openPopupMenu(event->getPosition()); - } + this->openPopupMenu(event->getPosition()); } } }