Merge pull request #16132 from MiladNazeri/dev-486/emote-ui-toggle-fix

Dev-486 : emote indicator should still be showing
This commit is contained in:
Zach Fox 2019-09-04 13:11:24 -07:00 committed by GitHub
commit df3f7fcb72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 28 deletions

View file

@ -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;
}
}

View file

@ -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) {

View file

@ -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 {