mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 22:23:50 +02: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 "../../styles-uit" as HifiStyles
|
||||||
import "../../controls-uit" as HifiControls
|
import "../../controls-uit" as HifiControls
|
||||||
|
|
||||||
|
// references HMD, AddressManager, AddressBarDialog from root context
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
id: root;
|
id: root;
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
@ -114,8 +116,14 @@ StackView {
|
||||||
}
|
}
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
id: backArrow;
|
id: backArrow;
|
||||||
|
buttonState: addressBarDialog.backEnabled;
|
||||||
imageURL: "../../../images/backward.svg";
|
imageURL: "../../../images/backward.svg";
|
||||||
onClicked: addressBarDialog.loadBack();
|
buttonEnabled: addressBarDialog.backEnabled;
|
||||||
|
onClicked: {
|
||||||
|
if (buttonEnabled) {
|
||||||
|
addressBarDialog.loadBack();
|
||||||
|
}
|
||||||
|
}
|
||||||
anchors {
|
anchors {
|
||||||
left: homeButton.right
|
left: homeButton.right
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
|
@ -123,8 +131,14 @@ StackView {
|
||||||
}
|
}
|
||||||
ToolbarButton {
|
ToolbarButton {
|
||||||
id: forwardArrow;
|
id: forwardArrow;
|
||||||
|
buttonState: addressBarDialog.forwardEnabled;
|
||||||
imageURL: "../../../images/forward.svg";
|
imageURL: "../../../images/forward.svg";
|
||||||
onClicked: addressBarDialog.loadForward();
|
buttonEnabled: addressBarDialog.forwardEnabled;
|
||||||
|
onClicked: {
|
||||||
|
if (buttonEnabled) {
|
||||||
|
addressBarDialog.loadForward();
|
||||||
|
}
|
||||||
|
}
|
||||||
anchors {
|
anchors {
|
||||||
left: backArrow.right
|
left: backArrow.right
|
||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
|
|
|
@ -3,6 +3,8 @@ import QtQuick.Controls 1.4
|
||||||
|
|
||||||
StateImage {
|
StateImage {
|
||||||
id: button
|
id: button
|
||||||
|
|
||||||
|
property bool buttonEnabled: true
|
||||||
property bool isActive: false
|
property bool isActive: false
|
||||||
property bool isEntered: false
|
property bool isEntered: false
|
||||||
|
|
||||||
|
@ -39,30 +41,37 @@ StateImage {
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateState() {
|
function updateState() {
|
||||||
if (!button.isEntered && !button.isActive) {
|
if (buttonEnabled) {
|
||||||
buttonState = imageOffOut;
|
if (!button.isEntered && !button.isActive) {
|
||||||
} else if (!button.isEntered && button.isActive) {
|
buttonState = imageOffOut;
|
||||||
buttonState = imageOnOut;
|
} else if (!button.isEntered && button.isActive) {
|
||||||
} else if (button.isEntered && !button.isActive) {
|
buttonState = imageOnOut;
|
||||||
buttonState = imageOffIn;
|
} else if (button.isEntered && !button.isActive) {
|
||||||
|
buttonState = imageOffIn;
|
||||||
|
} else {
|
||||||
|
buttonState = imageOnIn;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
buttonState = imageOnIn;
|
buttonState = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onIsActiveChanged: updateState();
|
onIsActiveChanged: updateState();
|
||||||
|
onButtonEnabledChanged: updateState();
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: asyncClickSender
|
id: asyncClickSender
|
||||||
interval: 10
|
interval: 10
|
||||||
repeat: false
|
repeat: false
|
||||||
running: false
|
running: false
|
||||||
onTriggered: button.clicked();
|
onTriggered: {
|
||||||
|
button.clicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
hoverEnabled: true
|
hoverEnabled: buttonEnabled
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: asyncClickSender.start();
|
onClicked: asyncClickSender.start();
|
||||||
onEntered: {
|
onEntered: {
|
||||||
|
|
Loading…
Reference in a new issue