mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 01:36:56 +02:00
pull clear timeout into a separate function
This commit is contained in:
parent
f66b696721
commit
96dbd4620d
1 changed files with 12 additions and 7 deletions
|
@ -193,14 +193,19 @@ function toggleReaction(reaction) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maybeDeleteRemoteIndicatorTimeout() {
|
||||||
|
if (restoreEmoteIndicatorTimeout) {
|
||||||
|
Script.clearTimeout(restoreEmoteIndicatorTimeout);
|
||||||
|
restoreEmoteIndicatorTimeout = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var reactionsBegun = [];
|
var reactionsBegun = [];
|
||||||
var pointReticle = null;
|
var pointReticle = null;
|
||||||
var mouseMoveEventsConnected = false;
|
var mouseMoveEventsConnected = false;
|
||||||
function beginReactionWrapper(reaction) {
|
function beginReactionWrapper(reaction) {
|
||||||
if (restoreEmoteIndicatorTimeout) {
|
maybeDeleteRemoteIndicatorTimeout();
|
||||||
Script.clearTimeout(restoreEmoteIndicatorTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
reactionsBegun.forEach(function(react) {
|
reactionsBegun.forEach(function(react) {
|
||||||
endReactionWrapper(react);
|
endReactionWrapper(react);
|
||||||
});
|
});
|
||||||
|
@ -294,9 +299,7 @@ function mouseMoveEvent(event) {
|
||||||
var WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS = 2000;
|
var WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS = 2000;
|
||||||
var restoreEmoteIndicatorTimeout;
|
var restoreEmoteIndicatorTimeout;
|
||||||
function triggerReactionWrapper(reaction) {
|
function triggerReactionWrapper(reaction) {
|
||||||
if (restoreEmoteIndicatorTimeout) {
|
maybeDeleteRemoteIndicatorTimeout();
|
||||||
Script.clearTimeout(restoreEmoteIndicatorTimeout);
|
|
||||||
}
|
|
||||||
|
|
||||||
reactionsBegun.forEach(function(react) {
|
reactionsBegun.forEach(function(react) {
|
||||||
endReactionWrapper(react);
|
endReactionWrapper(react);
|
||||||
|
@ -304,8 +307,10 @@ function triggerReactionWrapper(reaction) {
|
||||||
|
|
||||||
MyAvatar.triggerReaction(reaction);
|
MyAvatar.triggerReaction(reaction);
|
||||||
updateEmoteIndicatorIcon("images/" + reaction + "_Icon.svg");
|
updateEmoteIndicatorIcon("images/" + reaction + "_Icon.svg");
|
||||||
|
|
||||||
restoreEmoteIndicatorTimeout = Script.setTimeout(function() {
|
restoreEmoteIndicatorTimeout = Script.setTimeout(function() {
|
||||||
updateEmoteIndicatorIcon("images/emote_Icon.svg");
|
updateEmoteIndicatorIcon("images/emote_Icon.svg");
|
||||||
|
restoreEmoteIndicatorTimeout = null;
|
||||||
}, WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS);
|
}, WAIT_TO_RESTORE_EMOTE_INDICATOR_ICON_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue