diff --git a/scripts/system/+android/displayNames.js b/scripts/system/+android/displayNames.js index 2e2e6938ad..1e9735d205 100644 --- a/scripts/system/+android/displayNames.js +++ b/scripts/system/+android/displayNames.js @@ -124,6 +124,10 @@ function touchEnd(event) { currentTouchToAnalyze = null; } +function excludeMyAvatar() { + rayExclusionList = [MyAvatar.sessionUUID]; +} + function ending() { Controller.touchBeginEvent.disconnect(touchBegin); Controller.touchEndEvent.disconnect(touchEnd); @@ -137,6 +141,8 @@ function ending() { if (currentlyShownAvatar.avatar) { currentlyShownAvatar.avatar = null; } + + MyAvatar.sessionUUIDChanged.disconnect(excludeMyAvatar); } function init() { @@ -150,11 +156,14 @@ function init() { }); rayExclusionList = [MyAvatar.sessionUUID]; - MyAvatar.sessionUUIDChanged.connect(function() { - rayExclusionList = [MyAvatar.sessionUUID]; - }); + MyAvatar.sessionUUIDChanged.connect(excludeMyAvatar); } -init(); +module.exports = { + init: init, + ending: ending +} + +//init(); // Enable to use in desktop as a standalone }()); // END LOCAL_SCOPE \ No newline at end of file diff --git a/scripts/system/+android/modes.js b/scripts/system/+android/modes.js index 0b6e98541d..2c155ae386 100644 --- a/scripts/system/+android/modes.js +++ b/scripts/system/+android/modes.js @@ -88,8 +88,10 @@ function switchToMode(newMode) { if (currentMode == MODE_RADAR) { radar.startRadarMode(); + displayNames.ending(); } else if (currentMode == MODE_MY_VIEW) { // nothing to do yet + displayNames.init(); } else { printd("Unknown view mode " + currentMode); }