[ui] mouse: add "Ctrl+Left click" as an alternative to Middle click

This commit is contained in:
Fabien Castan 2018-07-21 14:54:28 +02:00
parent 2eb2c3ac6f
commit 10026e3281
3 changed files with 9 additions and 9 deletions

View file

@ -114,6 +114,13 @@ Entity {
components: [
FrameAction {
onTriggered: {
if(actionMMB.active || (actionLMB.active && actionControl.active)) { // translate
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))
return;
}
if(actionLMB.active) { // rotate
var rx = -axisMX.value;
var ry = -axisMY.value;
@ -121,13 +128,6 @@ Entity {
root.camera.tiltAboutViewCenter(root.tiltSpeed * ry * dt)
return;
}
if(actionMMB.active) { // translate
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))
return;
}
if(actionAlt.active && actionRMB.active) { // zoom with alt + RMD
var d = (root.camera.viewCenter.minus(root.camera.position)).length() * 0.1;
var tz = axisMX.value * root.translateSpeed * d;

View file

@ -93,7 +93,7 @@ FocusScope {
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onPressed: {
image.forceActiveFocus()
if(mouse.button & Qt.MiddleButton)
if(mouse.button & Qt.MiddleButton || (mouse.button & Qt.LeftButton && mouse.modifiers & Qt.ControlModifier))
drag.target = image // start drag
}
onReleased: {