blob: abf64cb46a4acbea1ace6864879bdd864e2f68e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick3D
import QtQuick3D.Xr
Item {
id: actionMapper
required property XrInputAction.Hand hand
property alias triggerPressed: trigger.pressed
property bool button1Pressed: button1.pressed || trackpad.rightPressed
property bool button2Pressed: button2.pressed || trackpad.leftPressed
XrInputAction {
id: trigger
hand: actionMapper.hand
actionId: [XrInputAction.TriggerValue, XrInputAction.TriggerPressed, XrInputAction.IndexFingerPinch]
}
XrInputAction {
id: button1
hand: actionMapper.hand
actionId: [XrInputAction.Button1Pressed, XrInputAction.MiddleFingerPinch]
}
XrInputAction {
id: button2
hand: actionMapper.hand
actionId: [XrInputAction.Button2Pressed, XrInputAction.ButtonMenuPressed, XrInputAction.RingFingerPinch]
}
XrInputAction {
id: trackpadX
hand: actionMapper.hand
actionId: [XrInputAction.TrackpadX]
}
XrInputAction {
id: trackpad
hand: actionMapper.hand
actionId: [XrInputAction.TrackpadPressed]
property bool rightPressed: pressed && trackpadX > 0.1
property bool leftPressed: pressed && trackpadX < -0.1
}
}
|