mirror of
https://github.com/overte-org/overte.git
synced 2025-04-23 23:53:26 +02:00
Using Flickable signals to remove hover state instead of timer. No more delays
This commit is contained in:
parent
570be69fcf
commit
fd9539a9e4
2 changed files with 14 additions and 9 deletions
|
@ -13,9 +13,6 @@ Item {
|
|||
property int columnIndex: 1 // point to 'go to location'
|
||||
property int count: 0
|
||||
|
||||
//timeout for press delay before swipe occurs
|
||||
readonly property int pressDelayTime: HMD.active ? 150 : 100
|
||||
|
||||
// used to look up a button by its uuid
|
||||
function findButtonIndex(uuid) {
|
||||
if (!uuid) {
|
||||
|
@ -67,6 +64,7 @@ Item {
|
|||
} else {
|
||||
button.tabletRoot = parent.parent;
|
||||
}
|
||||
button.flickable = swipeView.contentItem
|
||||
|
||||
sortButtons(gridIndex);
|
||||
|
||||
|
@ -217,11 +215,6 @@ Item {
|
|||
top: parent.top
|
||||
bottom: pageIndicator.top
|
||||
}
|
||||
Component.onCompleted: {
|
||||
if (contentItem !== null) {
|
||||
contentItem.pressDelay = tablet.pressDelayTime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PageIndicator {
|
||||
|
|
|
@ -23,11 +23,22 @@ Item {
|
|||
property double sortOrder: 100
|
||||
property int stableOrder: 0
|
||||
property var tabletRoot;
|
||||
property var flickable: null
|
||||
width: 129
|
||||
height: 129
|
||||
|
||||
signal clicked()
|
||||
|
||||
Connections {
|
||||
target: flickable
|
||||
onMovingChanged: {
|
||||
//when flick/move started, and hover is on, clean hove state
|
||||
if (flickable.moving && tabletButton.state.indexOf("hover") !== -1) {
|
||||
tabletButton.state = (tabletButton.isActive) ? "active state" : "base state";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeProperty(key, value) {
|
||||
tabletButton[key] = value;
|
||||
}
|
||||
|
@ -121,7 +132,7 @@ Item {
|
|||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: true
|
||||
preventStealing: true
|
||||
preventStealing: false
|
||||
onClicked: {
|
||||
console.log("Tablet Button Clicked!");
|
||||
if (tabletButton.inDebugMode) {
|
||||
|
@ -136,6 +147,7 @@ Item {
|
|||
tabletInterface.playSound(TabletEnums.ButtonClick);
|
||||
}
|
||||
}
|
||||
|
||||
onEntered: {
|
||||
tabletButton.isEntered = true;
|
||||
tabletInterface.playSound(TabletEnums.ButtonHover);
|
||||
|
|
Loading…
Reference in a new issue