separate setVisible and setEnabled for handles

This commit is contained in:
Stewart Allen 2025-06-17 16:01:43 -04:00
commit c71f6099df
2 changed files with 20 additions and 8 deletions

View file

@ -179,7 +179,7 @@ async function restore_space() {
// hide loading curtain
$d('curtain','none');
// restore handles visibility
handles.setVisible(api.prefs.map.space.bounds);
handles.setEnabled(api.prefs.map.space.bounds);
if (api.prefs.map.info.welcome !== false) {
api.welcome(version);
}

View file

@ -28,8 +28,8 @@ class TransformTool {
this.handleSize = 2;
this.handleColor = 0x0088ff;
this.handleOpacity = 0.5;
this.visible = false;
this.visible = true;
this.enabled = true; // persisted state
this.visible = false; // selection state
// Create materials
this.handleMaterial = new MeshBasicMaterial({
@ -67,13 +67,18 @@ class TransformTool {
});
}
setVisible(visible) {
this.visible = visible;
this.group.visible = this.visible;
setEnabled(enabled) {
this.enabled = enabled;
if (meshApi && meshApi.prefs) {
meshApi.prefs.map.space.bounds = this.visible;
meshApi.prefs.map.space.bounds = enabled;
meshApi.prefs.save();
}
this.updateVisibility();
}
setVisible(visible) {
this.visible = visible;
this.updateVisibility();
}
show() {
@ -85,7 +90,11 @@ class TransformTool {
}
toggleBounds() {
this.setVisible(!this.visible);
this.setEnabled(!this.enabled);
}
updateVisibility() {
this.group.visible = this.enabled && this.visible;
}
update() {
@ -100,6 +109,9 @@ class TransformTool {
return;
}
// Show transform tool
this.show();
// Get bounds based on selection type
let bounds;
if (sketch) {