mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-24 03:57:28 +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
|
||||
signal mousePressed(var mouse)
|
||||
signal mouseReleased(var mouse)
|
||||
signal mouseReleased(var mouse, var moved)
|
||||
signal mouseClicked(var mouse)
|
||||
signal mouseWheeled(var wheel)
|
||||
signal mouseDoubleClicked(var mouse)
|
||||
|
@ -43,19 +43,24 @@ Entity {
|
|||
property bool _pressed
|
||||
property point lastPosition
|
||||
property point currentPosition
|
||||
property bool hasMoved
|
||||
sourceDevice: mouseSourceDevice
|
||||
onPressed: {
|
||||
_pressed = true;
|
||||
currentPosition.x = lastPosition.x = mouse.x;
|
||||
currentPosition.y = lastPosition.y = mouse.y;
|
||||
hasMoved = false;
|
||||
mousePressed(mouse);
|
||||
}
|
||||
onReleased: {
|
||||
_pressed = false;
|
||||
mouseReleased(mouse);
|
||||
mouseReleased(mouse, hasMoved);
|
||||
}
|
||||
onClicked: mouseClicked(mouse)
|
||||
onPositionChanged: { currentPosition.x = mouse.x; currentPosition.y = mouse.y }
|
||||
onPositionChanged: {
|
||||
currentPosition.x = mouse.x;
|
||||
currentPosition.y = mouse.y;
|
||||
}
|
||||
onDoubleClicked: mouseDoubleClicked(mouse)
|
||||
onWheel: {
|
||||
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 tx = axisMX.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;
|
||||
}
|
||||
if(moving){ // trackball rotation
|
||||
trackball.rotate(mouseHandler.lastPosition, mouseHandler.currentPosition, dt);
|
||||
mouseHandler.lastPosition = mouseHandler.currentPosition;
|
||||
mouseHandler.hasMoved = true;
|
||||
return;
|
||||
}
|
||||
if(zooming) { // zoom with alt + RMD
|
||||
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.1;
|
||||
var tz = axisMX.value * root.translateSpeed * d;
|
||||
mouseHandler.hasMoved = true;
|
||||
root.camera.translate(Qt.vector3d(0, 0, tz).times(dt), Camera.DontTranslateViewCenter)
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue