Browse Source

Merge pull request #9263 from aWeirdo/patch-1

Update axisScaleGizmo.ts
Raanan Weber 4 years ago
parent
commit
f27ac29042
2 changed files with 6 additions and 10 deletions
  1. 1 0
      dist/preview release/what's new.md
  2. 5 10
      src/Gizmos/axisScaleGizmo.ts

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

@@ -58,6 +58,7 @@
 - Removed all references to HTML element from cameras' attach and detach control functions ([RaananW](https://github.com/RaananW))
 - Removed all references to HTML element from cameras' attach and detach control functions ([RaananW](https://github.com/RaananW))
 - Added `boundingBoxRenderer.onResourcesReadyObservable` ([aWeirdo](https://github.com/aWeirdo))
 - Added `boundingBoxRenderer.onResourcesReadyObservable` ([aWeirdo](https://github.com/aWeirdo))
 - Added `copyTools.GenerateBase64StringFromTexture` ([aWeirdo](https://github.com/aWeirdo))
 - Added `copyTools.GenerateBase64StringFromTexture` ([aWeirdo](https://github.com/aWeirdo))
+- Updated `axisScaleGizmo` to follow pointer on drag ([aWeirdo](https://github.com/aWeirdo))
 
 
 ### Engine
 ### Engine
 
 

+ 5 - 10
src/Gizmos/axisScaleGizmo.ts

@@ -88,16 +88,11 @@ export class AxisScaleGizmo extends Gizmo {
         const lineScale = arrowTail.scaling.clone();
         const lineScale = arrowTail.scaling.clone();
 
 
         const increaseGizmoMesh = (dragDistance: number) => {
         const increaseGizmoMesh = (dragDistance: number) => {
-            const dragStrength = this.sensitivity * dragDistance * ((this.scaleRatio * 3) / this._rootMesh.scaling.length());
-            const scalar = 1; // This will increase the rate of gizmo size on drag
-            const originalScale = arrowTail.scaling.y;
-            const newScale = originalScale + dragStrength * scalar;
-            const newMeshPosition = arrowMesh.position.z + ((newScale - originalScale) / 4);
-            if (newMeshPosition >= 0) {
-                arrowMesh.position.z = newMeshPosition;
-                arrowTail.scaling.y = newScale;
-                arrowTail.position.z = arrowMesh.position.z / 2;
-            }
+            const dragStrength = (dragDistance * (3 / this._rootMesh.scaling.length())) * 6;
+
+            arrowMesh.position.z += dragStrength / 3.5;
+            arrowTail.scaling.y += dragStrength;
+            arrowTail.position.z = arrowMesh.position.z / 2;
         };
         };
 
 
         const resetGizmoMesh = () => {
         const resetGizmoMesh = () => {