From 010f7121a377c9d7cb7a505de5eabc116ae79915 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 14 Nov 2018 15:27:18 +1300 Subject: [PATCH 1/2] Fix Goto app clicks not working Includes better card highlighting fix. --- interface/resources/qml/hifi/Card.qml | 23 +++++++++++------------ interface/resources/qml/hifi/Feed.qml | 1 - 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/interface/resources/qml/hifi/Card.qml b/interface/resources/qml/hifi/Card.qml index f7147e1264..d7fafcc165 100644 --- a/interface/resources/qml/hifi/Card.qml +++ b/interface/resources/qml/hifi/Card.qml @@ -49,7 +49,6 @@ Item { property string defaultThumbnail: Qt.resolvedUrl("../../images/default-domain.gif"); property int shadowHeight: 10; property bool hovered: false - property bool scrolling: false HifiConstants { id: hifi } @@ -238,7 +237,7 @@ Item { property var unhoverThunk: function () { }; Rectangle { anchors.fill: parent - visible: root.hovered && !root.scrolling + visible: root.hovered color: "transparent" border.width: 4 border.color: hifiStyleConstants.colors.primaryHighlight @@ -252,17 +251,17 @@ Item { goFunction("hifi://" + hifiUrl); } hoverEnabled: true; - onEntered: { - Tablet.playSound(TabletEnums.ButtonHover); - hoverThunk(); + onContainsMouseChanged: { + // Use onContainsMouseChanged rather than onEntered and onExited because the latter aren't always + // triggered correctly - e.g., if drag rightwards from right hand side of a card to the next card + // onExited doesn't fire, in which case can end up with two cards highlighted. + if (containsMouse) { + Tablet.playSound(TabletEnums.ButtonHover); + hoverThunk(); + } else { + unhoverThunk(); + } } - onExited: unhoverThunk(); - onCanceled: unhoverThunk(); - } - MouseArea { - // This second mouse area causes onEntered to fire on the first if you scroll just a little and the cursor stays on - // the original card. I.e., the original card is re-highlighted if the cursor is on it after scrolling finishes. - anchors.fill: parent } StateImage { id: actionIcon; diff --git a/interface/resources/qml/hifi/Feed.qml b/interface/resources/qml/hifi/Feed.qml index 6928fc6f02..1e89971938 100644 --- a/interface/resources/qml/hifi/Feed.qml +++ b/interface/resources/qml/hifi/Feed.qml @@ -141,7 +141,6 @@ Column { textSizeSmall: root.textSizeSmall; stackShadowNarrowing: root.stackShadowNarrowing; shadowHeight: root.stackedCardShadowHeight; - scrolling: scroll.moving hoverThunk: function () { hovered = true; From 9c5d31834143fa5e10e4ea2c3c78a0ea63c3bbda Mon Sep 17 00:00:00 2001 From: David Rowe Date: Thu, 15 Nov 2018 10:15:30 +1300 Subject: [PATCH 2/2] Fix highlighting --- interface/resources/qml/hifi/Card.qml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/interface/resources/qml/hifi/Card.qml b/interface/resources/qml/hifi/Card.qml index d7fafcc165..5c89a07b08 100644 --- a/interface/resources/qml/hifi/Card.qml +++ b/interface/resources/qml/hifi/Card.qml @@ -244,13 +244,9 @@ Item { z: 1 } MouseArea { - anchors.fill: parent; - acceptedButtons: Qt.LeftButton; - onClicked: { - Tablet.playSound(TabletEnums.ButtonClick); - goFunction("hifi://" + hifiUrl); - } - hoverEnabled: true; + anchors.fill: parent + acceptedButtons: Qt.LeftButton + hoverEnabled: true onContainsMouseChanged: { // Use onContainsMouseChanged rather than onEntered and onExited because the latter aren't always // triggered correctly - e.g., if drag rightwards from right hand side of a card to the next card @@ -263,6 +259,17 @@ Item { } } } + MouseArea { + // Separate MouseArea for click handling so that it doesn't interfere with hovering and interaction + // with containing ListView. + anchors.fill: parent + acceptedButtons: Qt.LeftButton + hoverEnabled: false + onClicked: { + Tablet.playSound(TabletEnums.ButtonClick); + goFunction("hifi://" + hifiUrl); + } + } StateImage { id: actionIcon; visible: !isAnnouncement;