diff --git a/interface/resources/qml/hifi/Card.qml b/interface/resources/qml/hifi/Card.qml index 6c6fc65be2..238c26236f 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,31 +237,38 @@ 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 z: 1 } MouseArea { - anchors.fill: parent; - acceptedButtons: Qt.LeftButton; + 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 + // onExited doesn't fire, in which case can end up with two cards highlighted. + if (containsMouse) { + Tablet.playSound(TabletEnums.ButtonHover); + hoverThunk(); + } else { + unhoverThunk(); + } + } + } + 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); } - hoverEnabled: true; - onEntered: { - Tablet.playSound(TabletEnums.ButtonHover); - hoverThunk(); - } - 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;