Przeglądaj źródła

make hitbox for uniform scale gizmo larger

Trevor Baron 7 lat temu
rodzic
commit
d0145da23c

+ 1 - 1
dist/preview release/what's new.md

@@ -14,7 +14,7 @@
   - Gizmo manager's internal gizmos are now public ([TrevorDev](https://github.com/TrevorDev))
   - Ability to customize meshes on gizmos ([TrevorDev](https://github.com/TrevorDev))
   - Added ignoreChildren field to bounding box to save performance when using heavily nested meshes ([TrevorDev](https://github.com/TrevorDev))
-  - Add uniform scaling drag support to scale gizmo ([TrevorDev](https://github.com/TrevorDev))
+  - Add uniform scaling drag support to the scale gizmo ([TrevorDev](https://github.com/TrevorDev))
   - Support interacting with child elements ([TrevorDev](https://github.com/TrevorDev))
   - BoundingBox gizmo support for including/excluding descendants when computing the bounding box ([TrevorDev](https://github.com/TrevorDev))
   - Drag start and stop events for bounding box drag and uniform scale drag ([TrevorDev](https://github.com/TrevorDev))

+ 5 - 1
src/Gizmos/babylon.scaleGizmo.ts

@@ -43,9 +43,13 @@ module BABYLON {
             this.uniformScaleGizmo = new AxisScaleGizmo(new Vector3(0,1,0), BABYLON.Color3.Yellow().scale(0.5), gizmoLayer);
             this.uniformScaleGizmo.updateGizmoRotationToMatchAttachedMesh = false;
             this.uniformScaleGizmo.uniformScaling = true
+            var uniformScalingMesh = BABYLON.Mesh.CreatePolyhedron("", {type: 1}, this.uniformScaleGizmo.gizmoLayer.utilityLayerScene);
+            uniformScalingMesh.scaling.scaleInPlace(0.02);
+            uniformScalingMesh.visibility = 0;
             var octahedron = BABYLON.Mesh.CreatePolyhedron("", {type: 1}, this.uniformScaleGizmo.gizmoLayer.utilityLayerScene);
             octahedron.scaling.scaleInPlace(0.007);
-            this.uniformScaleGizmo.setCustomMesh(octahedron, true);
+            uniformScalingMesh.addChild(octahedron);
+            this.uniformScaleGizmo.setCustomMesh(uniformScalingMesh, true);
             
             this.attachedMesh = null;
         }