Fix entity edit grid not hiding when disabling tools

This commit is contained in:
Ryan Huffman 2014-11-13 18:31:32 -08:00
parent 6b2a497810
commit a6f027e33a
2 changed files with 9 additions and 1 deletions

View file

@ -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,

View file

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