Просмотр исходного кода

Merge pull request #4847 from TrevorDev/snappingHelper

snapping helper
David Catuhe 7 лет назад
Родитель
Сommit
1321eca524

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

@@ -7,7 +7,7 @@
 - New GUI 3D controls toolset. [Complete doc + demos](http://doc.babylonjs.com/how_to/gui3d) ([Deltakosh](https://github.com/deltakosh))
 - Added [Environment Texture Tools](https://doc.babylonjs.com/how_to/physically_based_rendering#creating-a-compressed-environment-texture) to reduce the size of the usual .DDS file ([sebavan](http://www.github.com/sebavan))
 - New GUI control: the [Grid](http://doc.babylonjs.com/how_to/gui#grid) ([Deltakosh](https://github.com/deltakosh))
-- Gizmo and GizmoManager classes used to manipulate meshes in a scene. Gizmo types include: position, scale, rotation and bounding box. [Doc](http://doc.babylonjs.com/how_to/gizmo) ([TrevorDev](https://github.com/TrevorDev))
+- Gizmo and GizmoManager classes used to manipulate meshes in a scene. Gizmo types include: position, rotation, scale and bounding box. [Doc](http://doc.babylonjs.com/how_to/gizmo) ([TrevorDev](https://github.com/TrevorDev))
 - New behaviors: PointerDragBehavior, SixDofDragBehavior and MultiPointerScaleBehavior to enable smooth drag and drop/scaling with mouse or 6dof controller on a mesh. [Doc](http://doc.babylonjs.com/how_to/meshbehavior) ([TrevorDev](https://github.com/TrevorDev))
 - Particle system improvements ([Deltakosh](https://github.com/deltakosh))
   - Added a ParticleHelper class to create some pre-configured particle systems in a one-liner method style. [Doc](https://doc.babylonjs.com/How_To/ParticleHelper) ([Deltakosh](https://github.com/deltakosh)) / ([DevChris](https://github.com/yovanoc))

+ 14 - 0
src/Gizmos/babylon.positionGizmo.ts

@@ -45,6 +45,20 @@ module BABYLON {
         public get updateGizmoRotationToMatchAttachedMesh(){
             return this.xGizmo.updateGizmoRotationToMatchAttachedMesh;
         }
+
+        /**
+         * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)
+         */
+        public set snapDistance(value:number){
+            if(this.xGizmo){
+                this.xGizmo.snapDistance = value;
+                this.yGizmo.snapDistance = value;
+                this.zGizmo.snapDistance = value;
+            }
+        }
+        public get snapDistance(){
+            return this.xGizmo.snapDistance;
+        }
         
         /**
          * Disposes of the gizmo

+ 14 - 0
src/Gizmos/babylon.rotationGizmo.ts

@@ -47,6 +47,20 @@ module BABYLON {
         }
 
         /**
+         * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)
+         */
+        public set snapDistance(value:number){
+            if(this.xGizmo){
+                this.xGizmo.snapDistance = value;
+                this.yGizmo.snapDistance = value;
+                this.zGizmo.snapDistance = value;
+            }
+        }
+        public get snapDistance(){
+            return this.xGizmo.snapDistance;
+        }
+
+        /**
          * Disposes of the gizmo
          */
         public dispose(){

+ 14 - 0
src/Gizmos/babylon.scaleGizmo.ts

@@ -47,6 +47,20 @@ module BABYLON {
         }
 
         /**
+         * Drag distance in babylon units that the gizmo will snap to when dragged (Default: 0)
+         */
+        public set snapDistance(value:number){
+            if(this.xGizmo){
+                this.xGizmo.snapDistance = value;
+                this.yGizmo.snapDistance = value;
+                this.zGizmo.snapDistance = value;
+            }
+        }
+        public get snapDistance(){
+            return this.xGizmo.snapDistance;
+        }
+
+        /**
          * Disposes of the gizmo
          */
         public dispose(){