فهرست منبع

boundingBoxRotateThroughBox

Trevor Baron 6 سال پیش
والد
کامیت
bab6f8f7ec
2فایلهای تغییر یافته به همراه7 افزوده شده و 2 حذف شده
  1. 1 1
      src/Gizmos/babylon.boundingBoxGizmo.ts
  2. 6 1
      src/Rendering/babylon.utilityLayerRenderer.ts

+ 1 - 1
src/Gizmos/babylon.boundingBoxGizmo.ts

@@ -176,7 +176,7 @@ module BABYLON {
                         var dragAxis = worldDragDirection.subtract(toSub).normalizeToNew();
 
                         // project drag delta on to the resulting drag axis and rotate based on that
-                        var projectDist = -Vector3.Dot(dragAxis, event.delta);
+                        var projectDist = Vector3.Dot(dragAxis, event.delta) < 0 ? Math.abs(event.delta.length()) : -Math.abs(event.delta.length());
 
                         // Make rotation relative to size of mesh.
                         projectDist = (projectDist / this._boundingDimensions.length()) * this._anchorMesh.scaling.length();

+ 6 - 1
src/Rendering/babylon.utilityLayerRenderer.ts

@@ -7,6 +7,11 @@ module BABYLON {
         private _lastPointerEvents: { [pointerId: number]: boolean } = {};
         private static _DefaultUtilityLayer: Nullable<UtilityLayerRenderer> = null;
         private static _DefaultKeepDepthUtilityLayer: Nullable<UtilityLayerRenderer> = null;
+
+        /**
+         * If the picking should be done on the utility layer prior to the actual scene (Default: true)
+         */
+        public pickUtilitySceneFirst = true;
         /**
          * A shared utility layer that can be used to overlay objects into a scene (Depth map of the previous scene is cleared before drawing on top of it)
          */
@@ -113,7 +118,7 @@ module BABYLON {
                     return;
                 }
 
-                if (this.utilityLayerScene.autoClearDepthAndStencil) {
+                if (this.utilityLayerScene.autoClearDepthAndStencil || this.pickUtilitySceneFirst) {
                     // If this layer is an overlay, check if this layer was hit and if so, skip pointer events for the main scene
                     if (utilityScenePick && utilityScenePick.hit) {