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">
|
||||
<i class="bi bi-gear-fill"></i>
|
||||
</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>
|
||||
</a>
|
||||
<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;
|
||||
if (!AppState.clipping.enabled) {
|
||||
AppState.clipping.enabled = true;
|
||||
trigger.className += ' border border-2 border-white';
|
||||
Scene.toggleAmbientOcclusion(false);
|
||||
|
||||
const btns = toolbar.querySelectorAll('button');
|
||||
|
||||
trigger.className += ' border border-2 border-white';
|
||||
toolbar.addEventListener('click', event => {
|
||||
console.log('Clipping target:', event.target);
|
||||
if (event.target.id === 'clipX') {
|
||||
// Clip along X...
|
||||
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') {
|
||||
// Clip along Y...
|
||||
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') {
|
||||
// Clip along Z...
|
||||
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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user