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 // hide loading curtain
$d('curtain','none'); $d('curtain','none');
// restore handles visibility // restore handles visibility
handles.setVisible(api.prefs.map.space.bounds); handles.setEnabled(api.prefs.map.space.bounds);
if (api.prefs.map.info.welcome !== false) { if (api.prefs.map.info.welcome !== false) {
api.welcome(version); api.welcome(version);
} }

View file

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