Bladeren bron

sensitivity

Cedric Guillemet 5 jaren geleden
bovenliggende
commit
1d66aa04b1
2 gewijzigde bestanden met toevoegingen van 6 en 5 verwijderingen
  1. 2 2
      src/Gizmos/axisScaleGizmo.ts
  2. 4 3
      src/Gizmos/scaleGizmo.ts

+ 2 - 2
src/Gizmos/axisScaleGizmo.ts

@@ -40,7 +40,7 @@ export class AxisScaleGizmo extends Gizmo {
     /**
     /**
      * Custom sensibility value for the drag strength
      * Custom sensibility value for the drag strength
      */
      */
-    public sensibility = 1;
+    public sensitivity = 1;
 
 
     private _isEnabled: boolean = true;
     private _isEnabled: boolean = true;
     private _parent: Nullable<ScaleGizmo> = null;
     private _parent: Nullable<ScaleGizmo> = null;
@@ -96,7 +96,7 @@ export class AxisScaleGizmo extends Gizmo {
         this.dragBehavior.onDragObservable.add((event) => {
         this.dragBehavior.onDragObservable.add((event) => {
             if (this.attachedMesh) {
             if (this.attachedMesh) {
                 // Drag strength is modified by the scale of the gizmo (eg. for small objects like boombox the strength will be increased to match the behavior of larger objects)
                 // Drag strength is modified by the scale of the gizmo (eg. for small objects like boombox the strength will be increased to match the behavior of larger objects)
-                var dragStrength = this.sensibility * event.dragDistance * ((this.scaleRatio * 3) / this._rootMesh.scaling.length());
+                var dragStrength = this.sensitivity * event.dragDistance * ((this.scaleRatio * 3) / this._rootMesh.scaling.length());
 
 
                 // Snapping logic
                 // Snapping logic
                 var snapped = false;
                 var snapped = false;

+ 4 - 3
src/Gizmos/scaleGizmo.ts

@@ -37,6 +37,7 @@ export class ScaleGizmo extends Gizmo {
     private _scaleRatio: number;
     private _scaleRatio: number;
     private _uniformScalingMesh: Mesh;
     private _uniformScalingMesh: Mesh;
     private _octahedron: Mesh;
     private _octahedron: Mesh;
+    private _sensitivity: number = 1;
 
 
     /** Fires an event when any of it's sub gizmos are dragged */
     /** Fires an event when any of it's sub gizmos are dragged */
     public onDragStartObservable = new Observable();
     public onDragStartObservable = new Observable();
@@ -145,15 +146,15 @@ export class ScaleGizmo extends Gizmo {
      * Ratio for the scale of the gizmo (Default: 1)
      * Ratio for the scale of the gizmo (Default: 1)
      */
      */
     public set sensibility(value: number) {
     public set sensibility(value: number) {
-        this._sensibility = value;
+        this._sensitivity = value;
         [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach((gizmo) => {
         [this.xGizmo, this.yGizmo, this.zGizmo, this.uniformScaleGizmo].forEach((gizmo) => {
             if (gizmo) {
             if (gizmo) {
-                gizmo.sensibility = value;
+                gizmo.sensitivity = value;
             }
             }
         });
         });
     }
     }
     public get sensibility() {
     public get sensibility() {
-        return this._sensibility;
+        return this._sensitivity;
     }
     }
 
 
     /**
     /**