Minor fixes and guard clauses

TODO: Bootstrap ms-* and ps-* can't account for all possible levels of indentation/nesting...
This commit is contained in:
2026-04-07 22:03:16 +02:00
parent a617985789
commit c6e0314769
3 changed files with 22 additions and 16 deletions

View File

@@ -93,10 +93,10 @@ function loadNodes(nodes) {
AppState.clipping.boundingSphere = node.getBound(); AppState.clipping.boundingSphere = node.getBound();
} }
if (!AppState.clipping.boundingSphere) {
console.error("There is no computed bounding sphere, clipping will fail. Missing main node?");
}
AppState.nodes.push({id: n.label, active: true}); AppState.nodes.push({id: n.label, active: true});
}); });
if (!AppState.clipping.boundingSphere) {
console.error("No bounding sphere computed, clipping will fail. Ensure one node has 'isMain: true'.");
}
} }

View File

@@ -166,8 +166,8 @@ function toggleSettingsPanel(triggerId) {
<label class="form-check-label" for="shadowsSwitch">Ombre <i class="bi bi-info-circle ms-2 c-hand" title=""></i></label> <label class="form-check-label" for="shadowsSwitch">Ombre <i class="bi bi-info-circle ms-2 c-hand" title=""></i></label>
`; `;
shadowsSwitch.querySelector('input[type="checkbox"').checked = AppState.shadows; shadowsSwitch.querySelector('input[type="checkbox"]').checked = AppState.shadows;
ambientOcclSwitch.querySelector('input[type="checkbox"').checked = AppState.ambientOcclusion; ambientOcclSwitch.querySelector('input[type="checkbox"]').checked = AppState.ambientOcclusion;
ATON.UI.elSidePanel.appendChild(ambientOcclSwitch); ATON.UI.elSidePanel.appendChild(ambientOcclSwitch);
ATON.UI.elSidePanel.appendChild(shadowsSwitch); ATON.UI.elSidePanel.appendChild(shadowsSwitch);

View File

@@ -131,6 +131,8 @@ function updateClipper (vector, point) {
export function resetClipping () { export function resetClipping () {
AppState.clipping.enabled = false; AppState.clipping.enabled = false;
ATON.disableClipPlanes(); ATON.disableClipPlanes();
if (AppState.clipping.controls) {
AppState.clipping.controls.deactivate(); AppState.clipping.controls.deactivate();
// Manually remove event listeners from DragControls!! // Manually remove event listeners from DragControls!!
AppState.renderer.domElement.removeEventListener( 'pointermove', AppState.clipping.controls.onPointerMove ); AppState.renderer.domElement.removeEventListener( 'pointermove', AppState.clipping.controls.onPointerMove );
@@ -138,9 +140,13 @@ export function resetClipping () {
AppState.renderer.domElement.removeEventListener( 'pointerup', AppState.clipping.controls.onPointerCancel ); AppState.renderer.domElement.removeEventListener( 'pointerup', AppState.clipping.controls.onPointerCancel );
AppState.renderer.domElement.removeEventListener( 'pointerleave', AppState.clipping.controls.onPointerCancel ) AppState.renderer.domElement.removeEventListener( 'pointerleave', AppState.clipping.controls.onPointerCancel )
AppState.clipping.controls = null; AppState.clipping.controls = null;
}
if (AppState.clipping.helper) {
AppState.clipping.helper.removeFromParent(); AppState.clipping.helper.removeFromParent();
AppState.root.remove(AppState.clipping.helper); AppState.root.remove(AppState.clipping.helper);
AppState.clipping.helper = null; AppState.clipping.helper = null;
}
AppState.clipping.plane = null; AppState.clipping.plane = null;
AppState.clipping.vector = null; AppState.clipping.vector = null;
// Ensure nav controls are reactivated! // Ensure nav controls are reactivated!