diff --git a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml index 9e58a0aa98..24fff2dae4 100644 --- a/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml +++ b/interface/resources/qml/hifi/simplifiedUI/settingsApp/general/General.qml @@ -136,17 +136,17 @@ Flickable { Layout.preferredHeight: 18 Layout.preferredWidth: parent.width labelTextOn: "Show Emote UI" - checked: Settings.getValue("simplifiedUI/emoteIndicatorVisible", true) + checked: Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true) onClicked: { - var currentSetting = Settings.getValue("simplifiedUI/emoteIndicatorVisible", true); - Settings.setValue("simplifiedUI/emoteIndicatorVisible", !currentSetting); + var currentSetting = Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true); + Settings.setValue("simplifiedUI/allowEmoteDrawerExpansion", !currentSetting); } Connections { target: Settings onValueChanged: { - if (setting === "simplifiedUI/emoteIndicatorVisible") { + if (setting === "simplifiedUI/allowEmoteDrawerExpansion") { emoteSwitch.checked = value; } } diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js index cd6c80dd64..ab2cef7cb2 100644 --- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js +++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js @@ -425,7 +425,7 @@ function onGeometryChanged(rect) { function onWindowMinimizedChanged(isMinimized) { if (isMinimized) { handleEmoteIndicatorVisibleChanged(false); - } else if (!HMD.active && Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)) { + } else if (!HMD.active) { handleEmoteIndicatorVisibleChanged(true); } } @@ -520,8 +520,8 @@ function showEmoteAppBar() { } -function handleEmoteIndicatorVisibleChanged(newValue) { - if (newValue && !emoteAppBarWindow) { +function handleEmoteIndicatorVisibleChanged(shouldBeVisible) { + if (shouldBeVisible && !emoteAppBarWindow) { showEmoteAppBar(); } else if (emoteAppBarWindow) { emoteAppBarWindow.fromQml.disconnect(onMessageFromEmoteAppBar); @@ -531,13 +531,6 @@ function handleEmoteIndicatorVisibleChanged(newValue) { } -function onSettingsValueChanged(settingName, newValue) { - if (settingName === "simplifiedUI/emoteIndicatorVisible") { - handleEmoteIndicatorVisibleChanged(newValue); - } -} - - function onDisplayModeChanged(isHMDMode) { reactionsBegun.forEach(function(react) { endReactionWrapper(react); @@ -545,7 +538,7 @@ function onDisplayModeChanged(isHMDMode) { if (isHMDMode) { handleEmoteIndicatorVisibleChanged(false); - } else if (Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)) { + } else { handleEmoteIndicatorVisibleChanged(true); } } @@ -584,12 +577,11 @@ function init() { Window.minimizedChanged.connect(onWindowMinimizedChanged); Window.geometryChanged.connect(onGeometryChanged); - Settings.valueChanged.connect(onSettingsValueChanged); HMD.displayModeChanged.connect(onDisplayModeChanged); emojiAPI.startup(); getSounds(); - handleEmoteIndicatorVisibleChanged(Settings.getValue("simplifiedUI/emoteIndicatorVisible", true)); + handleEmoteIndicatorVisibleChanged(true); Controller.keyPressEvent.connect(keyPressHandler); Controller.keyReleaseEvent.connect(keyReleaseHandler); @@ -621,7 +613,6 @@ function shutdown() { Window.minimizedChanged.disconnect(onWindowMinimizedChanged); Window.geometryChanged.disconnect(onGeometryChanged); - Settings.valueChanged.disconnect(onSettingsValueChanged); HMD.displayModeChanged.disconnect(onDisplayModeChanged); if (keyPressSignalsConnected) { diff --git a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml index a401feec12..787ccadd62 100644 --- a/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml +++ b/scripts/simplifiedUI/simplifiedEmote/ui/qml/SimplifiedEmoteIndicator.qml @@ -21,20 +21,24 @@ Rectangle { id: root color: simplifiedUI.colors.white anchors.fill: parent - property int originalWidth: 48 property int expandedWidth: mainEmojiContainer.width + drawerContainer.width // For the below to work, the Repeater's Item's second child must be the individual button's `MouseArea` - property int requestedWidth: (drawerContainer.keepDrawerExpanded || - emoteIndicatorMouseArea.containsMouse || - emoteButtonsRepeater.itemAt(0).hovered || - emoteButtonsRepeater.itemAt(1).hovered || - emoteButtonsRepeater.itemAt(2).hovered || - emoteButtonsRepeater.itemAt(3).hovered || - emoteButtonsRepeater.itemAt(4).hovered || - emoteButtonsRepeater.itemAt(5).hovered) ? expandedWidth : originalWidth; + property int requestedWidth: ( + root.allowEmoteDrawerExpansion && ( + drawerContainer.keepDrawerExpanded || + emoteIndicatorMouseArea.containsMouse || + emoteButtonsRepeater.itemAt(0).hovered || + emoteButtonsRepeater.itemAt(1).hovered || + emoteButtonsRepeater.itemAt(2).hovered || + emoteButtonsRepeater.itemAt(3).hovered || + emoteButtonsRepeater.itemAt(4).hovered || + emoteButtonsRepeater.itemAt(5).hovered) + ) ? expandedWidth : originalWidth; readonly property int totalEmojiDurationMS: 7000 // Must match `TOTAL_EMOJI_DURATION_MS` in `simplifiedEmoji.js` readonly property string emoteIconSource: "images/emote_Icon.svg" + property bool allowEmoteDrawerExpansion: Settings.getValue("simplifiedUI/allowEmoteDrawerExpansion", true) + onRequestedWidthChanged: { root.requestNewWidth(root.requestedWidth); @@ -45,6 +49,16 @@ Rectangle { SmoothedAnimation { duration: 220 } } + Connections { + target: Settings + + onValueChanged: { + if (setting === "simplifiedUI/allowEmoteDrawerExpansion") { + root.allowEmoteDrawerExpansion = value; + } + } + } + SimplifiedConstants.SimplifiedConstants { id: simplifiedUI } @@ -158,7 +172,7 @@ Rectangle { anchors.fill: lockIcon source: lockIcon color: "#ffffff" - visible: drawerContainer.keepDrawerExpanded + visible: root.allowEmoteDrawerExpansion && drawerContainer.keepDrawerExpanded } MouseArea {