Преглед изворни кода

advanced texture conflicting with gizmos

Trevor Baron пре 7 година
родитељ
комит
4bd2f4a4a0

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

@@ -143,6 +143,7 @@
 - Initializing gamepadManager should register the gamepad update events ([TrevorDev](https://github.com/TrevorDev))
 - Do not generate mipmaps for RawCubeTexture if OES_texture_float_linear and/or EXT_color_buffer_float extensions are not supported ([PeapBoy](https://github.com/NicolasBuecher))
 - Do not modify passed camera array parameter when creating a default pipeline ([TrevorDev](https://github.com/TrevorDev))
+- AdvancedDynamicTexture should not overwrite skipOnPointerObservable to false ([TrevorDev](https://github.com/TrevorDev))
 
 ### Core Engine
 

+ 6 - 2
gui/src/2D/advancedDynamicTexture.ts

@@ -603,9 +603,13 @@ export class AdvancedDynamicTexture extends DynamicTexture {
             let y = (scene.pointerY / engine.getHardwareScalingLevel() - viewport.y * engine.getRenderHeight()) / viewport.height;
 
             this._shouldBlockPointer = false;
+            // Do picking modifies _shouldBlockPointer
             this._doPicking(x, y, pi.type, (pi.event as PointerEvent).pointerId || 0, pi.event.button);
-
-            pi.skipOnPointerObservable = this._shouldBlockPointer;
+            
+            // Avoid overwriting a true skipOnPointerObservable to false 
+            if(this._shouldBlockPointer){
+                pi.skipOnPointerObservable = this._shouldBlockPointer;
+            }
         });
 
         this._attachToOnPointerOut(scene);

+ 2 - 0
src/Gizmos/babylon.gizmo.ts

@@ -101,6 +101,8 @@ module BABYLON {
                     this.attachedMesh.scaling.copyFrom(this._tempVector);
                     this.attachedMesh.computeWorldMatrix();
                     Quaternion.FromRotationMatrixToRef(this._tmpMatrix, this._rootMesh.rotationQuaternion);
+                }else if(this._rootMesh.rotationQuaternion){
+                    this._rootMesh.rotationQuaternion.set(0,0,0,1);
                 }
                 if(this.updateGizmoPositionToMatchAttachedMesh){
                     this._rootMesh.position.copyFrom(this.attachedMesh.absolutePosition);

+ 8 - 4
src/Gizmos/babylon.gizmoManager.ts

@@ -89,8 +89,10 @@ module BABYLON {
          */
         public set positionGizmoEnabled(value:boolean){
             if(value){
-                this.gizmos.positionGizmo = this.gizmos.positionGizmo || new PositionGizmo();
-                this.gizmos.positionGizmo.updateGizmoRotationToMatchAttachedMesh = false;
+                if(!this.gizmos.positionGizmo){
+                    this.gizmos.positionGizmo = new PositionGizmo();
+                    this.gizmos.positionGizmo.updateGizmoRotationToMatchAttachedMesh = false;
+                }
                 this.gizmos.positionGizmo.attachedMesh = this._attachedMesh;
             }else if(this.gizmos.positionGizmo){
                 this.gizmos.positionGizmo.attachedMesh = null;
@@ -105,8 +107,10 @@ module BABYLON {
          */
         public set rotationGizmoEnabled(value:boolean){
             if(value){
-                this.gizmos.rotationGizmo = this.gizmos.rotationGizmo || new RotationGizmo();
-                this.gizmos.rotationGizmo.updateGizmoRotationToMatchAttachedMesh = false;
+                if(!this.gizmos.rotationGizmo){
+                    this.gizmos.rotationGizmo = new RotationGizmo();
+                    this.gizmos.rotationGizmo.updateGizmoRotationToMatchAttachedMesh = false;
+                }
                 this.gizmos.rotationGizmo.attachedMesh = this._attachedMesh;
             }else if(this.gizmos.rotationGizmo){
                 this.gizmos.rotationGizmo.attachedMesh = null;