From 28d825116a729837fd98bedf6be6ff883fa33b1f Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Tue, 11 Oct 2022 15:49:23 -0400 Subject: [PATCH] hide grid from below during animations --- src/kiri-mode/cam/animate.js | 6 ++++-- src/moto/space.js | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/kiri-mode/cam/animate.js b/src/kiri-mode/cam/animate.js index 9d513931..8e2adb3a 100644 --- a/src/kiri-mode/cam/animate.js +++ b/src/kiri-mode/cam/animate.js @@ -37,6 +37,7 @@ kiri.load(() => { const { api } = kiri; function animate_clear(api) { + moto.space.platform.showGridBelow(true); kiri.client.animate_cleanup(); $('layer-animate').innerHTML = ''; $('layer-toolpos').innerHTML = ''; @@ -44,7 +45,7 @@ kiri.load(() => { } function animate(api, delay) { - let alert = kiri.api.alerts.show("building animation"); + let alert = api.alerts.show("building animation"); kiri.client.animate_setup(api.conf.get(), data => { checkMeshCommands(data); if (!(data && data.mesh_add)) { @@ -73,7 +74,8 @@ kiri.load(() => { playButton.style.display = ''; pauseButton.style.display = 'none'; api.event.emit('animate', 'CAM'); - kiri.api.alerts.hide(alert); + api.alerts.hide(alert); + moto.space.platform.showGridBelow(false); }); } diff --git a/src/moto/space.js b/src/moto/space.js index bbb49012..abe51aa6 100644 --- a/src/moto/space.js +++ b/src/moto/space.js @@ -41,6 +41,7 @@ gapp.register("moto.space", [], (root, exports) => { showSkyGrid = false, showPlatform = true, hidePlatformBelow = true, + hideGridBelow = false, showFocus = 0, focalPoint = undefined, lightInfo = { @@ -549,6 +550,7 @@ gapp.register("moto.space", [], (root, exports) => { let { view, unitMinor, unitMajor, colorMajor, colorMinor, colorX, colorY } = grid; let oldView = view; view = grid.view = new THREE.Group(); + view.visible = oldView ? oldView.visible : true; let majors = [], minors = [], @@ -1167,6 +1169,7 @@ gapp.register("moto.space", [], (root, exports) => { setRound, showAxes, showVolume, + showGridBelow: (b) => { hideGridBelow = !b }, showGrid: (b) => { grid.view.visible = b }, setMaxZ: (z) => { panY = z / 2 }, setCenter: (x,y,z) => { panX = x; panY = z, panZ = y }, @@ -1328,6 +1331,10 @@ gapp.register("moto.space", [], (root, exports) => { if (platform) { platform.visible = hidePlatformBelow ? initialized && position.y >= 0 && showPlatform : showPlatform; + volume.visible = showVolume && platform.visible; + } + if (grid.view) { + grid.view.visible = hideGridBelow ? platform.visible : true; } if (cameraLight) { cameraLight.position.copy(camera.position);