Some UI changes for clipping
This commit is contained in:
parent
b87863b925
commit
0dda5f0344
@ -75,7 +75,7 @@
|
|||||||
<a class="btn aton-btn fs-5" id="settings" title="Impostazioni">
|
<a class="btn aton-btn fs-5" id="settings" title="Impostazioni">
|
||||||
<i class="bi bi-gear-fill"></i>
|
<i class="bi bi-gear-fill"></i>
|
||||||
</a>
|
</a>
|
||||||
<a class="btn aton-btn fs-5" id="clipper" title="Clipper">
|
<a class="btn aton-btn fs-5" id="clipper" title="Attiva / disattiva sezionamento">
|
||||||
<i class="bi bi-scissors"></i>
|
<i class="bi bi-scissors"></i>
|
||||||
</a>
|
</a>
|
||||||
<div class="d-none
|
<div class="d-none
|
||||||
|
|||||||
24
js/scene.js
24
js/scene.js
@ -30,21 +30,43 @@ Scene.UI.toggleClipper = function(triggerSelector, targetSelector) {
|
|||||||
const aoCurrentState = AppState.ambientOcclusion;
|
const aoCurrentState = AppState.ambientOcclusion;
|
||||||
if (!AppState.clipping.enabled) {
|
if (!AppState.clipping.enabled) {
|
||||||
AppState.clipping.enabled = true;
|
AppState.clipping.enabled = true;
|
||||||
trigger.className += ' border border-2 border-white';
|
|
||||||
Scene.toggleAmbientOcclusion(false);
|
Scene.toggleAmbientOcclusion(false);
|
||||||
|
|
||||||
|
const btns = toolbar.querySelectorAll('button');
|
||||||
|
|
||||||
|
trigger.className += ' border border-2 border-white';
|
||||||
toolbar.addEventListener('click', event => {
|
toolbar.addEventListener('click', event => {
|
||||||
console.log('Clipping target:', event.target);
|
console.log('Clipping target:', event.target);
|
||||||
if (event.target.id === 'clipX') {
|
if (event.target.id === 'clipX') {
|
||||||
// Clip along X...
|
// Clip along X...
|
||||||
Scene.addClippingPlane('x', -1);
|
Scene.addClippingPlane('x', -1);
|
||||||
|
// Export to function...
|
||||||
|
event.target.classList.add('border', 'border-2', 'border-warning');
|
||||||
|
btns.forEach(btn => {
|
||||||
|
if (btn.id !== event.target.id) {
|
||||||
|
btn.classList.remove('border', 'border-2', 'border-warning');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (event.target.id === 'clipY') {
|
else if (event.target.id === 'clipY') {
|
||||||
// Clip along Y...
|
// Clip along Y...
|
||||||
Scene.addClippingPlane('y', -1);
|
Scene.addClippingPlane('y', -1);
|
||||||
|
event.target.classList.add('border', 'border-2', 'border-warning');
|
||||||
|
btns.forEach(btn => {
|
||||||
|
if (btn.id !== event.target.id) {
|
||||||
|
btn.classList.remove('border', 'border-2', 'border-warning');
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
else if (event.target.id === 'clipZ') {
|
else if (event.target.id === 'clipZ') {
|
||||||
// Clip along Z...
|
// Clip along Z...
|
||||||
Scene.addClippingPlane('z', 1);
|
Scene.addClippingPlane('z', 1);
|
||||||
|
event.target.classList.add('border', 'border-2', 'border-warning');
|
||||||
|
btns.forEach(btn => {
|
||||||
|
if (btn.id !== event.target.id) {
|
||||||
|
btn.classList.remove('border', 'border-2', 'border-warning');
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user