From fdcbf7162395546c9507bc59cd7c6569e7936b1e Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 14 Jul 2016 15:49:32 -0700 Subject: [PATCH] Remove fade effect from toolbar buttons --- .../qml/hifi/toolbars/ToolbarButton.qml | 37 ++++++------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/interface/resources/qml/hifi/toolbars/ToolbarButton.qml b/interface/resources/qml/hifi/toolbars/ToolbarButton.qml index 4356b18253..47a52c4c36 100644 --- a/interface/resources/qml/hifi/toolbars/ToolbarButton.qml +++ b/interface/resources/qml/hifi/toolbars/ToolbarButton.qml @@ -4,7 +4,7 @@ import QtQuick.Controls 1.4 Item { id: button property alias imageURL: image.source - property alias alpha: button.opacity + property alias alpha: image.opacity property var subImage; property int yOffset: 0 property int buttonState: 0 @@ -14,32 +14,11 @@ Item { width: size; height: size property bool pinned: false clip: true - - Behavior on opacity { - NumberAnimation { - duration: 150 - easing.type: Easing.InOutCubic - } - } - - property alias fadeTargetProperty: button.opacity - - onFadeTargetPropertyChanged: { - visible = (fadeTargetProperty !== 0.0); - } - - onVisibleChanged: { - if ((!visible && fadeTargetProperty != 0.0) || (visible && fadeTargetProperty == 0.0)) { - var target = visible; - visible = !visible; - fadeTargetProperty = target ? 1.0 : 0.0; - return; - } - } - + function updateOffset() { yOffset = size * (buttonState + hoverOffset); } + onButtonStateChanged: { hoverOffset = 0; // subtle: show the new state without hover. don't wait for mouse to be moved away // The above is per UX design, but ALSO avoid a subtle issue that would be a problem because @@ -64,11 +43,19 @@ Item { width: parent.width } + Timer { + id: asyncClickSender + interval: 10 + repeat: false + running: false + onTriggered: button.clicked(); + } + MouseArea { id: mouseArea hoverEnabled: true anchors.fill: parent - onClicked: button.clicked(); + onClicked: asyncClickSender.start(); onEntered: { hoverOffset = 2; updateOffset();