From a6f027e33aadc9bc22cd1ac74b2f6003ebd7b354 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 13 Nov 2014 18:31:32 -0800 Subject: [PATCH] Fix entity edit grid not hiding when disabling tools --- examples/libraries/gridTool.js | 8 +++++++- examples/newEditEntities.js | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/libraries/gridTool.js b/examples/libraries/gridTool.js index 9945fe3e98..d8b84babf9 100644 --- a/examples/libraries/gridTool.js +++ b/examples/libraries/gridTool.js @@ -31,6 +31,7 @@ Grid = function(opts) { that.getMajorIncrement = function() { return minorGridSpacing * majorGridEvery; }; that.visible = false; + that.enabled = false; that.getOrigin = function() { return origin; @@ -38,6 +39,11 @@ Grid = function(opts) { that.getSnapToGrid = function() { return snapToGrid; }; + that.setEnabled = function(enabled) { + that.enabled = enabled; + updateGrid(); + } + that.setVisible = function(visible, noUpdate) { that.visible = visible; updateGrid(); @@ -127,7 +133,7 @@ Grid = function(opts) { function updateGrid() { Overlays.editOverlay(gridOverlay, { position: { x: origin.y, y: origin.y, z: -origin.y }, - visible: that.visible, + visible: that.visible && that.enabled, minorGridWidth: minorGridSpacing, majorGridEvery: majorGridEvery, color: gridColor, diff --git a/examples/newEditEntities.js b/examples/newEditEntities.js index 8a2c8a636d..0b8eebfee5 100644 --- a/examples/newEditEntities.js +++ b/examples/newEditEntities.js @@ -272,11 +272,13 @@ var toolBar = (function () { isActive = !isActive; if (!isActive) { gridTool.setVisible(false); + grid.setEnabled(false); selectionManager.clearSelections(); cameraManager.disable(); } else { cameraManager.enable(); gridTool.setVisible(Menu.isOptionChecked(MENU_GRID_TOOL_ENABLED)); + grid.setEnabled(true); } return true; }