Move ResizeGizmo handles inside bounding box for better selection

- 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 <noreply@anthropic.com>
This commit is contained in:
Michael Mainguy 2025-11-13 18:00:05 -06:00
parent 26b48b26c8
commit 204ef670f9
2 changed files with 13 additions and 17 deletions

View File

@ -19,9 +19,9 @@ export class HandleGeometry {
const max = boundingBox.maximumWorld; const max = boundingBox.maximumWorld;
const center = boundingBox.centerWorld; const center = boundingBox.centerWorld;
// Apply padding // Apply padding to position handles inward from bounding box edges
const paddedMin = min.subtract(new Vector3(padding, padding, padding)); const paddedMin = min.add(new Vector3(padding, padding, padding));
const paddedMax = max.add(new Vector3(padding, padding, padding)); const paddedMax = max.subtract(new Vector3(padding, padding, padding));
const corners: HandlePosition[] = []; const corners: HandlePosition[] = [];
const positions = [ const positions = [
@ -60,9 +60,9 @@ export class HandleGeometry {
const max = boundingBox.maximumWorld; const max = boundingBox.maximumWorld;
const center = boundingBox.centerWorld; const center = boundingBox.centerWorld;
// Apply padding // Apply padding to position handles inward from bounding box edges
const paddedMin = min.subtract(new Vector3(padding, padding, padding)); const paddedMin = min.add(new Vector3(padding, padding, padding));
const paddedMax = max.add(new Vector3(padding, padding, padding)); const paddedMax = max.subtract(new Vector3(padding, padding, padding));
// Calculate midpoints // Calculate midpoints
const midX = (paddedMin.x + paddedMax.x) / 2; const midX = (paddedMin.x + paddedMax.x) / 2;
@ -178,9 +178,9 @@ export class HandleGeometry {
const min = boundingBox.minimumWorld; const min = boundingBox.minimumWorld;
const max = boundingBox.maximumWorld; const max = boundingBox.maximumWorld;
// Apply padding // Apply padding to position handles inward from bounding box edges
const paddedMin = min.subtract(new Vector3(padding, padding, padding)); const paddedMin = min.add(new Vector3(padding, padding, padding));
const paddedMax = max.add(new Vector3(padding, padding, padding)); const paddedMax = max.subtract(new Vector3(padding, padding, padding));
// Calculate midpoints // Calculate midpoints
const midX = (paddedMin.x + paddedMax.x) / 2; const midX = (paddedMin.x + paddedMax.x) / 2;

View File

@ -135,14 +135,10 @@ export class ResizeGizmoVisuals {
const min = boundingBox.minimumWorld; const min = boundingBox.minimumWorld;
const max = boundingBox.maximumWorld; const max = boundingBox.maximumWorld;
// Calculate padding // Use original bounding box without padding for wireframe
const padding = HandleGeometry.calculatePadding( // (handles are now positioned inside, so box matches actual mesh bounds)
boundingBox, const paddedMin = min;
this._config.current.boundingBoxPadding const paddedMax = max;
);
const paddedMin = min.subtract(new Vector3(padding, padding, padding));
const paddedMax = max.add(new Vector3(padding, padding, padding));
// Create line points for bounding box edges // Create line points for bounding box edges
const points = [ const points = [