mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-26 04:57:18 +02:00
[ui] Viewer3D: don't display contextual menu on alt+right-click zoom
Only prompt right-click contextual menu when it was not used to zoom in the 3D view.
This commit is contained in:
parent
8dce4fc72f
commit
6e47235c9c
2 changed files with 13 additions and 5 deletions
|
@ -25,7 +25,7 @@ Entity {
|
||||||
|
|
||||||
readonly property alias pressed: mouseHandler._pressed
|
readonly property alias pressed: mouseHandler._pressed
|
||||||
signal mousePressed(var mouse)
|
signal mousePressed(var mouse)
|
||||||
signal mouseReleased(var mouse)
|
signal mouseReleased(var mouse, var moved)
|
||||||
signal mouseClicked(var mouse)
|
signal mouseClicked(var mouse)
|
||||||
signal mouseWheeled(var wheel)
|
signal mouseWheeled(var wheel)
|
||||||
signal mouseDoubleClicked(var mouse)
|
signal mouseDoubleClicked(var mouse)
|
||||||
|
@ -43,19 +43,24 @@ Entity {
|
||||||
property bool _pressed
|
property bool _pressed
|
||||||
property point lastPosition
|
property point lastPosition
|
||||||
property point currentPosition
|
property point currentPosition
|
||||||
|
property bool hasMoved
|
||||||
sourceDevice: mouseSourceDevice
|
sourceDevice: mouseSourceDevice
|
||||||
onPressed: {
|
onPressed: {
|
||||||
_pressed = true;
|
_pressed = true;
|
||||||
currentPosition.x = lastPosition.x = mouse.x;
|
currentPosition.x = lastPosition.x = mouse.x;
|
||||||
currentPosition.y = lastPosition.y = mouse.y;
|
currentPosition.y = lastPosition.y = mouse.y;
|
||||||
|
hasMoved = false;
|
||||||
mousePressed(mouse);
|
mousePressed(mouse);
|
||||||
}
|
}
|
||||||
onReleased: {
|
onReleased: {
|
||||||
_pressed = false;
|
_pressed = false;
|
||||||
mouseReleased(mouse);
|
mouseReleased(mouse, hasMoved);
|
||||||
}
|
}
|
||||||
onClicked: mouseClicked(mouse)
|
onClicked: mouseClicked(mouse)
|
||||||
onPositionChanged: { currentPosition.x = mouse.x; currentPosition.y = mouse.y }
|
onPositionChanged: {
|
||||||
|
currentPosition.x = mouse.x;
|
||||||
|
currentPosition.y = mouse.y;
|
||||||
|
}
|
||||||
onDoubleClicked: mouseDoubleClicked(mouse)
|
onDoubleClicked: mouseDoubleClicked(mouse)
|
||||||
onWheel: {
|
onWheel: {
|
||||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.2;
|
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.2;
|
||||||
|
@ -165,17 +170,20 @@ Entity {
|
||||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03;
|
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.03;
|
||||||
var tx = axisMX.value * root.translateSpeed * d;
|
var tx = axisMX.value * root.translateSpeed * d;
|
||||||
var ty = axisMY.value * root.translateSpeed * d;
|
var ty = axisMY.value * root.translateSpeed * d;
|
||||||
root.camera.translate(Qt.vector3d(-tx, -ty, 0).times(dt))
|
mouseHandler.hasMoved = true;
|
||||||
|
root.camera.translate(Qt.vector3d(-tx, -ty, 0).times(dt));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(moving){ // trackball rotation
|
if(moving){ // trackball rotation
|
||||||
trackball.rotate(mouseHandler.lastPosition, mouseHandler.currentPosition, dt);
|
trackball.rotate(mouseHandler.lastPosition, mouseHandler.currentPosition, dt);
|
||||||
mouseHandler.lastPosition = mouseHandler.currentPosition;
|
mouseHandler.lastPosition = mouseHandler.currentPosition;
|
||||||
|
mouseHandler.hasMoved = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(zooming) { // zoom with alt + RMD
|
if(zooming) { // zoom with alt + RMD
|
||||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.1;
|
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.1;
|
||||||
var tz = axisMX.value * root.translateSpeed * d;
|
var tz = axisMX.value * root.translateSpeed * d;
|
||||||
|
mouseHandler.hasMoved = true;
|
||||||
root.camera.translate(Qt.vector3d(0, 0, tz).times(dt), Camera.DontTranslateViewCenter)
|
root.camera.translate(Qt.vector3d(0, 0, tz).times(dt), Camera.DontTranslateViewCenter)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ FocusScope {
|
||||||
onMouseReleased: {
|
onMouseReleased: {
|
||||||
if(moving)
|
if(moving)
|
||||||
return
|
return
|
||||||
if(mouse.button == Qt.RightButton)
|
if(!moved && mouse.button == Qt.RightButton)
|
||||||
{
|
{
|
||||||
contextMenu.popup()
|
contextMenu.popup()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue