From 4098dd9999fe7b02518de14f14a8d0116cfacba9 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 27 Aug 2019 12:59:57 -0700 Subject: [PATCH] BUGZ-1342: Add lock icon to Emote tray when it's locked open; Make tray close when unlocking it --- .../ui/qml/SimplifiedEmoteIndicator.qml | 33 +++++++++++++++++-- .../ui/qml/images/lock_Icon.svg | 8 +++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 scripts/simplifiedUI/simplifiedEmote/ui/qml/images/lock_Icon.svg diff --git a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml index 9aa7571494..a401feec12 100644 --- a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml +++ b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml @@ -139,6 +139,28 @@ Rectangle { opacity: emoteIndicator.source.toString().indexOf("Icon.svg") > -1 ? 1.0 : 0.0 } + Image { + id: lockIcon + width: 12 + height: 12 + anchors.top: parent.top + anchors.topMargin: 2 + anchors.left: parent.left + anchors.leftMargin: 0 + source: "images/lock_Icon.svg" + fillMode: Image.PreserveAspectFit + mipmap: true + visible: false + } + + ColorOverlay { + id: lockIconColorOverlay + anchors.fill: lockIcon + source: lockIcon + color: "#ffffff" + visible: drawerContainer.keepDrawerExpanded + } + MouseArea { id: emoteIndicatorMouseArea anchors.fill: parent @@ -147,14 +169,21 @@ Rectangle { onClicked: { Tablet.playSound(TabletEnums.ButtonClick); drawerContainer.keepDrawerExpanded = !drawerContainer.keepDrawerExpanded; + // If the drawer is no longer expanded, disable this MouseArea (which will close + // the emote tray) until the user's cursor leaves the MouseArea (see `onExited()` below). + if (!drawerContainer.keepDrawerExpanded) { + emoteIndicatorMouseArea.enabled = false; + } } onEntered: { Tablet.playSound(TabletEnums.ButtonHover); } - } - + onExited: { + emoteIndicatorMouseArea.enabled = true; + } + } } Row { diff --git a/scripts/simplifiedUI/simplifiedEmote/ui/qml/images/lock_Icon.svg b/scripts/simplifiedUI/simplifiedEmote/ui/qml/images/lock_Icon.svg new file mode 100644 index 0000000000..2195fa728f --- /dev/null +++ b/scripts/simplifiedUI/simplifiedEmote/ui/qml/images/lock_Icon.svg @@ -0,0 +1,8 @@ + + + + +