Browse Source

Merge pull request #5815 from TrevorDev/playgroundReload

fix playground reload issue, speed up rotation gizmo
sebavan 6 years ago
parent
commit
9b98c0e00c
2 changed files with 3 additions and 2 deletions
  1. 1 1
      inspector/src/inspector.ts
  2. 2 1
      src/Behaviors/Meshes/pointerDragBehavior.ts

+ 1 - 1
inspector/src/inspector.ts

@@ -454,7 +454,7 @@ export class Inspector {
                 this._GlobalState.enableLightGizmo(g.light, false);
             }
         })
-        if(this._Scene.reservedDataStore && this._Scene.reservedDataStore.gizmoManager){
+        if(this._Scene && this._Scene.reservedDataStore && this._Scene.reservedDataStore.gizmoManager){
             this._Scene.reservedDataStore.gizmoManager.dispose();
             this._Scene.reservedDataStore.gizmoManager = null;
         }

+ 2 - 1
src/Behaviors/Meshes/pointerDragBehavior.ts

@@ -22,6 +22,7 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
     private _pointerObserver: Nullable<Observer<PointerInfo>>;
     private _beforeRenderObserver: Nullable<Observer<Scene>>;
     private static _planeScene: Scene;
+    private _useAlternatePickedPointAboveMaxDragAngleDragSpeed = -1.1;
     /**
      * The maximum tolerated angle between the drag plane and dragging pointer rays to trigger pointer events. Set to 0 to allow any angle (default: 0)
      */
@@ -342,7 +343,7 @@ export class PointerDragBehavior implements Behavior<AbstractMesh> {
                 this._tmpVector.copyFrom(ray.direction);
                 (this._attachedNode).absolutePosition.subtractToRef(ray.origin, this._alternatePickedPoint);
                 this._alternatePickedPoint.normalize();
-                this._alternatePickedPoint.scaleInPlace(-2 * Vector3.Dot(this._alternatePickedPoint, this._tmpVector));
+                this._alternatePickedPoint.scaleInPlace(this._useAlternatePickedPointAboveMaxDragAngleDragSpeed * Vector3.Dot(this._alternatePickedPoint, this._tmpVector));
                 this._tmpVector.addInPlace(this._alternatePickedPoint);
 
                 // Project resulting vector onto the drag plane and add it to the attached nodes absolute position to get a picked point