Using Flickable signals to remove hover state instead of timer. No more delays

This commit is contained in:
vladest 2017-12-02 13:57:12 +01:00
parent 570be69fcf
commit fd9539a9e4
2 changed files with 14 additions and 9 deletions

View file

@ -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 {

View file

@ -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);