From 8822117b06ab16059df60690ebef47f38e9ac188 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Tue, 12 May 2015 06:23:01 +0200 Subject: [PATCH] Removed use of global variable and corrected buttons bug --- static/js/prototype/ButtonManager.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/static/js/prototype/ButtonManager.js b/static/js/prototype/ButtonManager.js index 892cd24..8b71945 100644 --- a/static/js/prototype/ButtonManager.js +++ b/static/js/prototype/ButtonManager.js @@ -14,22 +14,23 @@ var ButtonManager = function(cameras) { this.showarrowsElement = document.getElementById('showarrows'); this.fullscreenElement.onclick = function() {}; - this.resetElement.onclick = cameras.mainCamera().reset(); (function(self) { - self.undoElement.onclick = function() {cameras.mainCamera().undo(); self.updateElements();} - self.redoElement.onclick = function() {cameras.mainCamera().redo(); self.updateElements();} + self.undoElement.onclick = function() {self.cameras.mainCamera().undo(); self.updateElements();} + self.redoElement.onclick = function() {self.cameras.mainCamera().redo(); self.updateElements();} self.fullElement.onclick = function() { - cameras.map(function(camera) { - if (!(camera instanceof PointerCamera)) { - camera.fullArrow = self.fullElement.checked; - } - }); + self.cameras.map(function(camera) { + if (!(camera instanceof PointerCamera)) { + camera.fullArrow = self.fullElement.checked; + } + }); - self.collisionElement.onchange = function() {cameras.mainCamera().collisions = self.collisionElement.checked;} - self.showarrowsElement.onchange = function() {self.showArrows = self.showarrowsElement.checked;} }; + + self.collisionElement.onchange = function() {self.cameras.mainCamera().collisions = self.collisionElement.checked;} + self.showarrowsElement.onchange = function() {self.showArrows = self.showarrowsElement.checked;} + self.resetElement.onclick = function() {self.cameras.mainCamera().reset();} })(this); }