From e3d4cae5157c4118303a18ad2d5d71de5396d159 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 26 Jan 2017 14:29:49 -0800 Subject: [PATCH] avoid having the snapshot script be multi-activated by a single button-click --- scripts/system/snapshot.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index fa2f2df7d3..ed22b60242 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -22,6 +22,8 @@ var buttonName = "SNAP"; var tablet = null; var toolBar = null; +var buttonConnected = false; + if (Settings.getValue("HUDUIEnabled")) { toolBar = Toolbars.getToolbar("com.highfidelity.interface.toolbar.system"); button = toolBar.addButton({ @@ -177,7 +179,10 @@ function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) { } } else { // Allow the user to click the snapshot HUD button again - button.clicked.connect(onClicked); + if (!buttonConnected) { + button.clicked.connect(onClicked); + buttonConnected = true; + } } Window.snapshotTaken.disconnect(resetButtons); @@ -205,6 +210,7 @@ function processingGif() { Reticle.visible = reticleVisible; button.clicked.disconnect(onClicked); + buttonConnected = false; // show overlays if they were on if (resetOverlays) { Menu.setIsOptionChecked("Overlays", true); @@ -212,11 +218,13 @@ function processingGif() { } button.clicked.connect(onClicked); +buttonConnected = true; Window.snapshotShared.connect(snapshotShared); Window.processingGif.connect(processingGif); Script.scriptEnding.connect(function () { button.clicked.disconnect(onClicked); + buttonConnected = false; if (tablet) { tablet.removeButton(button); }