From c3dfc4e8d8c7c222d64c1a01ca358f6645910b82 Mon Sep 17 00:00:00 2001 From: RebeccaStankus Date: Mon, 26 Aug 2019 14:23:27 -0700 Subject: [PATCH 1/4] Restore emote indicator after reaction emote --- scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js index d4044218fc..01b53cd77f 100644 --- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js +++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js @@ -150,7 +150,7 @@ function getClapPosition() { var validLeftJoints = ["LeftHandMiddle2", "LeftHand", "LeftArm"]; var leftPosition = getValidJointPosition(validLeftJoints); - var validRightJoints = ["RightHandMiddle2", "RightHand", "RightArm"];; + var validRightJoints = ["RightHandMiddle2", "RightHand", "RightArm"]; var rightPosition = getValidJointPosition(validRightJoints); var centerPosition = Vec3.sum(leftPosition, rightPosition); @@ -287,6 +287,7 @@ function mouseMoveEvent(event) { } +var WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS = 2000; function triggerReactionWrapper(reaction) { reactionsBegun.forEach(function(react) { endReactionWrapper(react); @@ -294,6 +295,9 @@ function triggerReactionWrapper(reaction) { MyAvatar.triggerReaction(reaction); updateEmoteIndicatorIcon("images/" + reaction + "_Icon.svg"); + Script.setTimeout(function() { + updateEmoteIndicatorIcon("images/emote_Icon.svg"); + }, WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS); } function maybeClearReticleUpdateLimiterTimeout() { @@ -326,7 +330,6 @@ function endReactionWrapper(reaction) { mouseMoveEventsConnected = false; } maybeClearReticleUpdateLimiterTimeout(); - intersectedEntityOrAvatarID = null; deleteOldReticles(); break; } @@ -538,6 +541,7 @@ var EmojiAPI = Script.require("./emojiApp/simplifiedEmoji.js"); var emojiAPI = new EmojiAPI(); var keyPressSignalsConnected = false; var emojiCodeMap; +var customEmojiCodeMap; function init() { deleteOldReticles(); From f66b696721048964143f34b1dd668d680cf3eac0 Mon Sep 17 00:00:00 2001 From: RebeccaStankus Date: Mon, 26 Aug 2019 14:39:38 -0700 Subject: [PATCH 2/4] Clear timeout on selecting a different emote --- .../simplifiedUI/simplifiedEmote/simplifiedEmote.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js index 01b53cd77f..69de612428 100644 --- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js +++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js @@ -197,6 +197,10 @@ var reactionsBegun = []; var pointReticle = null; var mouseMoveEventsConnected = false; function beginReactionWrapper(reaction) { + if (restoreEmoteIndicatorTimeout) { + Script.clearTimeout(restoreEmoteIndicatorTimeout); + } + reactionsBegun.forEach(function(react) { endReactionWrapper(react); }); @@ -288,14 +292,19 @@ function mouseMoveEvent(event) { var WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS = 2000; +var restoreEmoteIndicatorTimeout; function triggerReactionWrapper(reaction) { + if (restoreEmoteIndicatorTimeout) { + Script.clearTimeout(restoreEmoteIndicatorTimeout); + } + reactionsBegun.forEach(function(react) { endReactionWrapper(react); }); MyAvatar.triggerReaction(reaction); updateEmoteIndicatorIcon("images/" + reaction + "_Icon.svg"); - Script.setTimeout(function() { + restoreEmoteIndicatorTimeout = Script.setTimeout(function() { updateEmoteIndicatorIcon("images/emote_Icon.svg"); }, WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS); } From 96dbd4620d459623975288ef1eaa95db26b9a896 Mon Sep 17 00:00:00 2001 From: RebeccaStankus Date: Mon, 26 Aug 2019 15:08:18 -0700 Subject: [PATCH 3/4] pull clear timeout into a separate function --- .../simplifiedEmote/simplifiedEmote.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js index 69de612428..ea9e8a5b2c 100644 --- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js +++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js @@ -193,14 +193,19 @@ function toggleReaction(reaction) { } } +function maybeDeleteRemoteIndicatorTimeout() { + if (restoreEmoteIndicatorTimeout) { + Script.clearTimeout(restoreEmoteIndicatorTimeout); + restoreEmoteIndicatorTimeout = null; + } +} + var reactionsBegun = []; var pointReticle = null; var mouseMoveEventsConnected = false; function beginReactionWrapper(reaction) { - if (restoreEmoteIndicatorTimeout) { - Script.clearTimeout(restoreEmoteIndicatorTimeout); - } - + maybeDeleteRemoteIndicatorTimeout(); + reactionsBegun.forEach(function(react) { endReactionWrapper(react); }); @@ -294,9 +299,7 @@ function mouseMoveEvent(event) { var WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS = 2000; var restoreEmoteIndicatorTimeout; function triggerReactionWrapper(reaction) { - if (restoreEmoteIndicatorTimeout) { - Script.clearTimeout(restoreEmoteIndicatorTimeout); - } + maybeDeleteRemoteIndicatorTimeout(); reactionsBegun.forEach(function(react) { endReactionWrapper(react); @@ -304,8 +307,10 @@ function triggerReactionWrapper(reaction) { MyAvatar.triggerReaction(reaction); updateEmoteIndicatorIcon("images/" + reaction + "_Icon.svg"); + restoreEmoteIndicatorTimeout = Script.setTimeout(function() { updateEmoteIndicatorIcon("images/emote_Icon.svg"); + restoreEmoteIndicatorTimeout = null; }, WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS); } From abd4f24770a4882f9c6fd6e4f3c4098dffa0929d Mon Sep 17 00:00:00 2001 From: RebeccaStankus Date: Mon, 26 Aug 2019 15:15:25 -0700 Subject: [PATCH 4/4] Added unload check that timeout is not running --- scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js index ea9e8a5b2c..cd6c80dd64 100644 --- a/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js +++ b/scripts/simplifiedUI/simplifiedEmote/simplifiedEmote.js @@ -617,6 +617,7 @@ function shutdown() { emojiAPI.unload(); maybeClearClapSoundInterval(); maybeClearReticleUpdateLimiterTimeout(); + maybeDeleteRemoteIndicatorTimeout(); Window.minimizedChanged.disconnect(onWindowMinimizedChanged); Window.geometryChanged.disconnect(onGeometryChanged);