mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:08:54 +02:00
Fix entity edit grid not hiding when disabling tools
This commit is contained in:
parent
6b2a497810
commit
a6f027e33a
2 changed files with 9 additions and 1 deletions
|
@ -31,6 +31,7 @@ Grid = function(opts) {
|
||||||
that.getMajorIncrement = function() { return minorGridSpacing * majorGridEvery; };
|
that.getMajorIncrement = function() { return minorGridSpacing * majorGridEvery; };
|
||||||
|
|
||||||
that.visible = false;
|
that.visible = false;
|
||||||
|
that.enabled = false;
|
||||||
|
|
||||||
that.getOrigin = function() {
|
that.getOrigin = function() {
|
||||||
return origin;
|
return origin;
|
||||||
|
@ -38,6 +39,11 @@ Grid = function(opts) {
|
||||||
|
|
||||||
that.getSnapToGrid = function() { return snapToGrid; };
|
that.getSnapToGrid = function() { return snapToGrid; };
|
||||||
|
|
||||||
|
that.setEnabled = function(enabled) {
|
||||||
|
that.enabled = enabled;
|
||||||
|
updateGrid();
|
||||||
|
}
|
||||||
|
|
||||||
that.setVisible = function(visible, noUpdate) {
|
that.setVisible = function(visible, noUpdate) {
|
||||||
that.visible = visible;
|
that.visible = visible;
|
||||||
updateGrid();
|
updateGrid();
|
||||||
|
@ -127,7 +133,7 @@ Grid = function(opts) {
|
||||||
function updateGrid() {
|
function updateGrid() {
|
||||||
Overlays.editOverlay(gridOverlay, {
|
Overlays.editOverlay(gridOverlay, {
|
||||||
position: { x: origin.y, y: origin.y, z: -origin.y },
|
position: { x: origin.y, y: origin.y, z: -origin.y },
|
||||||
visible: that.visible,
|
visible: that.visible && that.enabled,
|
||||||
minorGridWidth: minorGridSpacing,
|
minorGridWidth: minorGridSpacing,
|
||||||
majorGridEvery: majorGridEvery,
|
majorGridEvery: majorGridEvery,
|
||||||
color: gridColor,
|
color: gridColor,
|
||||||
|
|
|
@ -272,11 +272,13 @@ var toolBar = (function () {
|
||||||
isActive = !isActive;
|
isActive = !isActive;
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
gridTool.setVisible(false);
|
gridTool.setVisible(false);
|
||||||
|
grid.setEnabled(false);
|
||||||
selectionManager.clearSelections();
|
selectionManager.clearSelections();
|
||||||
cameraManager.disable();
|
cameraManager.disable();
|
||||||
} else {
|
} else {
|
||||||
cameraManager.enable();
|
cameraManager.enable();
|
||||||
gridTool.setVisible(Menu.isOptionChecked(MENU_GRID_TOOL_ENABLED));
|
gridTool.setVisible(Menu.isOptionChecked(MENU_GRID_TOOL_ENABLED));
|
||||||
|
grid.setEnabled(true);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue