mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-06-01 10:21:59 +02:00
[ui] Viewer3D: fix wrong keyboard modifier state
Keyboard Actions are never deactivated when focus is lost, leading to picking being enabled on a single click when Control was pressed in the 3D viewer and focus was lost to another Item. * keep track of focus loss inside the DefaultCameraController * use it to disable picking while Keyboard has not been pressed back in the 3D viewer * do the same for 'moving' state with Alt modifier
This commit is contained in:
parent
7a8e1c689f
commit
f6365c5607
2 changed files with 19 additions and 3 deletions
|
@ -12,8 +12,9 @@ Entity {
|
|||
property real translateSpeed: 75.0
|
||||
property real tiltSpeed: 500.0
|
||||
property real panSpeed: 500.0
|
||||
property bool moving: pressed || actionAlt.active
|
||||
readonly property alias controlPressed: actionControl.active
|
||||
property bool moving: pressed || (actionAlt.active && keyboardHandler._pressed)
|
||||
property alias focus: keyboardHandler.focus
|
||||
readonly property bool pickingActive: actionControl.active && keyboardHandler._pressed
|
||||
|
||||
readonly property alias pressed: mouseHandler._pressed
|
||||
signal mousePressed(var mouse)
|
||||
|
@ -40,6 +41,20 @@ Entity {
|
|||
}
|
||||
}
|
||||
|
||||
KeyboardHandler {
|
||||
id: keyboardHandler
|
||||
sourceDevice: keyboardSourceDevice
|
||||
property bool _pressed
|
||||
|
||||
// When focus is lost while pressing a key, the corresponding action
|
||||
// stays active, even when it's released.
|
||||
// Handle this issue manually by keeping an additional _pressed state
|
||||
// which is cleared when focus changes (used for 'pickingActive' property).
|
||||
onFocusChanged: if(!focus) _pressed = false
|
||||
onPressed: _pressed = true
|
||||
onReleased: _pressed = false
|
||||
}
|
||||
|
||||
LogicalDevice {
|
||||
id: cameraControlDevice
|
||||
actions: [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue