hide grid from below during animations

This commit is contained in:
Stewart Allen 2022-10-11 15:49:23 -04:00
commit 28d825116a
2 changed files with 11 additions and 2 deletions

View file

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

View file

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