GestureNav: bug fix (tilting) + kill messagebox
Fixed a bug where starting tilting with LMB+RMB with LMB in sketcher caused odd behavior. No more messagebox upon hitting H key when the cursor is over nothing (replaced with a warning). The messagebox was very annoying when trying to hunt a point with touch input.
This commit is contained in:
parent
8ba5f73c1a
commit
694b0339fd
|
@ -57,7 +57,6 @@
|
||||||
# include <QCursor>
|
# include <QCursor>
|
||||||
# include <QList>
|
# include <QList>
|
||||||
# include <QMenu>
|
# include <QMenu>
|
||||||
# include <QMessageBox>
|
|
||||||
# include <QMetaObject>
|
# include <QMetaObject>
|
||||||
# include <QRegExp>
|
# include <QRegExp>
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,6 +64,7 @@
|
||||||
#include <Inventor/sensors/SoTimerSensor.h>
|
#include <Inventor/sensors/SoTimerSensor.h>
|
||||||
|
|
||||||
#include <App/Application.h>
|
#include <App/Application.h>
|
||||||
|
#include <Base/Console.h>
|
||||||
#include "NavigationStyle.h"
|
#include "NavigationStyle.h"
|
||||||
#include "View3DInventorViewer.h"
|
#include "View3DInventorViewer.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -289,8 +289,8 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||||
if(!press){
|
if(!press){
|
||||||
SbBool ret = NavigationStyle::lookAtPoint(event->getPosition());
|
SbBool ret = NavigationStyle::lookAtPoint(event->getPosition());
|
||||||
if(!ret){
|
if(!ret){
|
||||||
QMessageBox::information(viewer,QObject::tr("Set focus"),
|
Base::Console().Warning(
|
||||||
QObject::tr("Aim mouse pointer at a point on some object, and hit H on keyboard. The camera's focus point will jump there.\nIf using touchscreen, tap the point to aim the cursor."));
|
"No object under cursor! Can't set new center of rotation.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -359,10 +359,10 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||||
case SoMouseButtonEvent::BUTTON1:
|
case SoMouseButtonEvent::BUTTON1:
|
||||||
case SoMouseButtonEvent::BUTTON2:
|
case SoMouseButtonEvent::BUTTON2:
|
||||||
if(press){
|
if(press){
|
||||||
if(button == SoMouseButtonEvent::BUTTON1 && suppressLMBDrag){
|
if(this->thisClickIsComplex && this->mouseMoveThresholdBroken){
|
||||||
//LMB drag suppressed. The event will be propagated, don't do anything.
|
//this should prevent re-attempts to enter navigation when doing more clicks after a move.
|
||||||
} else {
|
} else {
|
||||||
//on left-mouse-button-down, enter dragging mode upon move detetion, or the event will need refiring if the mouse is released with no move.
|
//on LMB-down or RMB-down, we don't know yet if we should propagate it or process it. Save the event to be refired later, when it becomes clear.
|
||||||
//reset/start move detection machine
|
//reset/start move detection machine
|
||||||
this->mousedownPos = pos;
|
this->mousedownPos = pos;
|
||||||
this->mouseMoveThresholdBroken = false;
|
this->mouseMoveThresholdBroken = false;
|
||||||
|
@ -376,23 +376,15 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||||
}
|
}
|
||||||
processed = true;//just consume this event, and wait for the move threshold to be broken to start dragging/panning
|
processed = true;//just consume this event, and wait for the move threshold to be broken to start dragging/panning
|
||||||
}
|
}
|
||||||
} else {//either a release, or another press in a complex click
|
} else {//release
|
||||||
if (this->mouseMoveThresholdBroken) {
|
|
||||||
assert(this->mousedownConsumedCount == 0);
|
|
||||||
//we typically end up here if suppressLMBDrag was true when mousedown.
|
|
||||||
//do nothing (propagate)
|
|
||||||
} else {
|
|
||||||
if (button == SoMouseButtonEvent::BUTTON2 && !this->thisClickIsComplex) {
|
if (button == SoMouseButtonEvent::BUTTON2 && !this->thisClickIsComplex) {
|
||||||
if (!viewer->isEditing() && this->isPopupMenuEnabled()) {
|
if (!viewer->isEditing() && this->isPopupMenuEnabled()) {
|
||||||
processed=true;
|
processed=true;
|
||||||
if (!press) { // release right mouse button
|
|
||||||
this->openPopupMenu(event->getPosition());
|
this->openPopupMenu(event->getPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(! processed) {
|
if(! processed) {
|
||||||
//a left-click without drag (or tap) has happened.
|
//re-synthesize all previously-consumed mouseDowns, if any. They might have been re-synthesized already when threshold was broken.
|
||||||
//re-synthesize all previously-consumed mouseDown.
|
|
||||||
for( int i=0; i < this->mousedownConsumedCount; i++ ){
|
for( int i=0; i < this->mousedownConsumedCount; i++ ){
|
||||||
inherited::processSoEvent(& (this->mousedownConsumedEvent[i]));//simulate the previously-comsumed mousedown.
|
inherited::processSoEvent(& (this->mousedownConsumedEvent[i]));//simulate the previously-comsumed mousedown.
|
||||||
}
|
}
|
||||||
|
@ -400,7 +392,6 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||||
processed = inherited::processSoEvent(ev);//explicitly, just for clarity that we are sending a full click sequence.
|
processed = inherited::processSoEvent(ev);//explicitly, just for clarity that we are sending a full click sequence.
|
||||||
propagated = true;
|
propagated = true;
|
||||||
}
|
}
|
||||||
} // end else of if mouseMoveThresholdBroken
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SoMouseButtonEvent::BUTTON3://press the wheel
|
case SoMouseButtonEvent::BUTTON3://press the wheel
|
||||||
|
@ -408,10 +399,8 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||||
if(press){
|
if(press){
|
||||||
SbBool ret = NavigationStyle::lookAtPoint(event->getPosition());
|
SbBool ret = NavigationStyle::lookAtPoint(event->getPosition());
|
||||||
if(!ret){
|
if(!ret){
|
||||||
//no object under point or other failure.
|
Base::Console().Warning(
|
||||||
//ignore...
|
"No object under cursor! Can't set new center of rotation.\n");
|
||||||
//QMessageBox::information(viewer,QObject::tr("Set focus"),
|
|
||||||
// QObject::tr("Aim mouse pointer at a point on some object, and hit H on keyboard. The camera's focus point will jump there.\nIf using touchscreen, tap the point to aim the cursor."));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -428,18 +417,31 @@ SbBool GestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||||
|
|
||||||
//mouse moves - test for move threshold breaking
|
//mouse moves - test for move threshold breaking
|
||||||
if (evIsLoc2) {
|
if (evIsLoc2) {
|
||||||
|
if (this->mouseMoveThresholdBroken && (this->button1down || this->button2down) && mousedownConsumedCount > 0) {
|
||||||
|
//mousemovethreshold has JUST been broken
|
||||||
|
|
||||||
|
//test if we should enter navigation
|
||||||
if ((this->button1down && !suppressLMBDrag) || this->button2down) {
|
if ((this->button1down && !suppressLMBDrag) || this->button2down) {
|
||||||
if (this->mouseMoveThresholdBroken) {
|
//yes, we are entering navigation.
|
||||||
//dupm all consumed mousedowns, we have processed them for navigation.
|
//throw away consumed mousedowns.
|
||||||
mousedownConsumedCount = 0;
|
this->mousedownConsumedCount = 0;
|
||||||
|
|
||||||
setViewingMode(this->button1down ? NavigationStyle::DRAGGING : NavigationStyle::PANNING);
|
setViewingMode(this->button1down ? NavigationStyle::DRAGGING : NavigationStyle::PANNING);
|
||||||
processed = true;
|
processed = true;
|
||||||
|
} else {
|
||||||
|
//no, we are not entering navigation.
|
||||||
|
//re-synthesize all previously-consumed mouseDowns, if any, and propagate this mousemove.
|
||||||
|
for( int i=0; i < this->mousedownConsumedCount; i++ ){
|
||||||
|
inherited::processSoEvent(& (this->mousedownConsumedEvent[i]));//simulate the previously-comsumed mousedown.
|
||||||
|
}
|
||||||
|
this->mousedownConsumedCount = 0;
|
||||||
|
processed = inherited::processSoEvent(ev);//explicitly, just for clarity that we are sending a full click sequence.
|
||||||
|
propagated = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (mousedownConsumedCount > 0)
|
if (mousedownConsumedCount > 0)
|
||||||
processed = true;//if we are still deciding if it's a drag or not, consume mouseMoves.
|
processed = true;//if we are still deciding if it's a drag or not, consume mouseMoves.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//gesture start
|
//gesture start
|
||||||
if (evIsGesture && /*!this->button1down &&*/ !this->button2down){//ignore gestures when mouse buttons are down. Button1down check was disabled because of wrong state after doubleclick on sketcher constraint to edit datum
|
if (evIsGesture && /*!this->button1down &&*/ !this->button2down){//ignore gestures when mouse buttons are down. Button1down check was disabled because of wrong state after doubleclick on sketcher constraint to edit datum
|
||||||
|
|
Loading…
Reference in New Issue
Block a user