Removed use of global variable and corrected buttons bug

This commit is contained in:
Thomas FORGIONE 2015-05-12 06:23:01 +02:00
parent 19fd5abed5
commit 8822117b06
1 changed files with 11 additions and 10 deletions

View File

@ -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);
}