mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Fix hover states on back/forward buttons
This commit is contained in:
parent
0543709081
commit
a623ced64e
2 changed files with 34 additions and 11 deletions
|
@ -20,6 +20,8 @@ import "../toolbars"
|
|||
import "../../styles-uit" as HifiStyles
|
||||
import "../../controls-uit" as HifiControls
|
||||
|
||||
// references HMD, AddressManager, AddressBarDialog from root context
|
||||
|
||||
StackView {
|
||||
id: root;
|
||||
HifiConstants { id: hifi }
|
||||
|
@ -114,8 +116,14 @@ StackView {
|
|||
}
|
||||
ToolbarButton {
|
||||
id: backArrow;
|
||||
buttonState: addressBarDialog.backEnabled;
|
||||
imageURL: "../../../images/backward.svg";
|
||||
onClicked: addressBarDialog.loadBack();
|
||||
buttonEnabled: addressBarDialog.backEnabled;
|
||||
onClicked: {
|
||||
if (buttonEnabled) {
|
||||
addressBarDialog.loadBack();
|
||||
}
|
||||
}
|
||||
anchors {
|
||||
left: homeButton.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
|
@ -123,8 +131,14 @@ StackView {
|
|||
}
|
||||
ToolbarButton {
|
||||
id: forwardArrow;
|
||||
buttonState: addressBarDialog.forwardEnabled;
|
||||
imageURL: "../../../images/forward.svg";
|
||||
onClicked: addressBarDialog.loadForward();
|
||||
buttonEnabled: addressBarDialog.forwardEnabled;
|
||||
onClicked: {
|
||||
if (buttonEnabled) {
|
||||
addressBarDialog.loadForward();
|
||||
}
|
||||
}
|
||||
anchors {
|
||||
left: backArrow.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
|
|
|
@ -3,6 +3,8 @@ import QtQuick.Controls 1.4
|
|||
|
||||
StateImage {
|
||||
id: button
|
||||
|
||||
property bool buttonEnabled: true
|
||||
property bool isActive: false
|
||||
property bool isEntered: false
|
||||
|
||||
|
@ -39,30 +41,37 @@ StateImage {
|
|||
}
|
||||
|
||||
function updateState() {
|
||||
if (!button.isEntered && !button.isActive) {
|
||||
buttonState = imageOffOut;
|
||||
} else if (!button.isEntered && button.isActive) {
|
||||
buttonState = imageOnOut;
|
||||
} else if (button.isEntered && !button.isActive) {
|
||||
buttonState = imageOffIn;
|
||||
if (buttonEnabled) {
|
||||
if (!button.isEntered && !button.isActive) {
|
||||
buttonState = imageOffOut;
|
||||
} else if (!button.isEntered && button.isActive) {
|
||||
buttonState = imageOnOut;
|
||||
} else if (button.isEntered && !button.isActive) {
|
||||
buttonState = imageOffIn;
|
||||
} else {
|
||||
buttonState = imageOnIn;
|
||||
}
|
||||
} else {
|
||||
buttonState = imageOnIn;
|
||||
buttonState = 0;
|
||||
}
|
||||
}
|
||||
|
||||
onIsActiveChanged: updateState();
|
||||
onButtonEnabledChanged: updateState();
|
||||
|
||||
Timer {
|
||||
id: asyncClickSender
|
||||
interval: 10
|
||||
repeat: false
|
||||
running: false
|
||||
onTriggered: button.clicked();
|
||||
onTriggered: {
|
||||
button.clicked();
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
hoverEnabled: true
|
||||
hoverEnabled: buttonEnabled
|
||||
anchors.fill: parent
|
||||
onClicked: asyncClickSender.start();
|
||||
onEntered: {
|
||||
|
|
Loading…
Reference in a new issue