Gui: Prevent showing the context menu after dragging, panning or zooming

This commit is contained in:
Rexbas
2024-01-20 16:27:25 +01:00
parent 1b3781c2fb
commit a01818a0c5
10 changed files with 76 additions and 71 deletions

View File

@@ -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;