From 204ef670f9074ae037db443fb613fbf6bbe80647 Mon Sep 17 00:00:00 2001 From: Michael Mainguy Date: Thu, 13 Nov 2025 18:00:05 -0600 Subject: [PATCH] Move ResizeGizmo handles inside bounding box for better selection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Reverse padding direction in HandleGeometry: - Corner handles now positioned inward (add padding to min, subtract from max) - Edge handles now positioned inward (same reversal) - Face handles now positioned inward (same reversal) - Remove padding from bounding box wireframe to match mesh bounds - Handles are now 5% inside edges instead of 5% outside - Improves handle selection reliability - Prevents unwanted gizmo auto-hide when pointer moves to handles 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/gizmos/ResizeGizmo/HandleGeometry.ts | 18 +++++++++--------- src/gizmos/ResizeGizmo/ResizeGizmoVisuals.ts | 12 ++++-------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/gizmos/ResizeGizmo/HandleGeometry.ts b/src/gizmos/ResizeGizmo/HandleGeometry.ts index ec58230..0784695 100644 --- a/src/gizmos/ResizeGizmo/HandleGeometry.ts +++ b/src/gizmos/ResizeGizmo/HandleGeometry.ts @@ -19,9 +19,9 @@ export class HandleGeometry { const max = boundingBox.maximumWorld; const center = boundingBox.centerWorld; - // Apply padding - const paddedMin = min.subtract(new Vector3(padding, padding, padding)); - const paddedMax = max.add(new Vector3(padding, padding, padding)); + // Apply padding to position handles inward from bounding box edges + const paddedMin = min.add(new Vector3(padding, padding, padding)); + const paddedMax = max.subtract(new Vector3(padding, padding, padding)); const corners: HandlePosition[] = []; const positions = [ @@ -60,9 +60,9 @@ export class HandleGeometry { const max = boundingBox.maximumWorld; const center = boundingBox.centerWorld; - // Apply padding - const paddedMin = min.subtract(new Vector3(padding, padding, padding)); - const paddedMax = max.add(new Vector3(padding, padding, padding)); + // Apply padding to position handles inward from bounding box edges + const paddedMin = min.add(new Vector3(padding, padding, padding)); + const paddedMax = max.subtract(new Vector3(padding, padding, padding)); // Calculate midpoints const midX = (paddedMin.x + paddedMax.x) / 2; @@ -178,9 +178,9 @@ export class HandleGeometry { const min = boundingBox.minimumWorld; const max = boundingBox.maximumWorld; - // Apply padding - const paddedMin = min.subtract(new Vector3(padding, padding, padding)); - const paddedMax = max.add(new Vector3(padding, padding, padding)); + // Apply padding to position handles inward from bounding box edges + const paddedMin = min.add(new Vector3(padding, padding, padding)); + const paddedMax = max.subtract(new Vector3(padding, padding, padding)); // Calculate midpoints const midX = (paddedMin.x + paddedMax.x) / 2; diff --git a/src/gizmos/ResizeGizmo/ResizeGizmoVisuals.ts b/src/gizmos/ResizeGizmo/ResizeGizmoVisuals.ts index 66d4bfd..58d92c8 100644 --- a/src/gizmos/ResizeGizmo/ResizeGizmoVisuals.ts +++ b/src/gizmos/ResizeGizmo/ResizeGizmoVisuals.ts @@ -135,14 +135,10 @@ export class ResizeGizmoVisuals { const min = boundingBox.minimumWorld; const max = boundingBox.maximumWorld; - // Calculate padding - const padding = HandleGeometry.calculatePadding( - boundingBox, - this._config.current.boundingBoxPadding - ); - - const paddedMin = min.subtract(new Vector3(padding, padding, padding)); - const paddedMax = max.add(new Vector3(padding, padding, padding)); + // Use original bounding box without padding for wireframe + // (handles are now positioned inside, so box matches actual mesh bounds) + const paddedMin = min; + const paddedMax = max; // Create line points for bounding box edges const points = [