From f66b696721048964143f34b1dd668d680cf3eac0 Mon Sep 17 00:00:00 2001 From: RebeccaStankus Date: Mon, 26 Aug 2019 14:39:38 -0700 Subject: [PATCH] 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); }