Selaa lähdekoodia

Added AbstractButton3D

David Catuhe 7 vuotta sitten
vanhempi
commit
25846219e0

+ 1 - 0
Tools/Gulp/config.json

@@ -1724,6 +1724,7 @@
                     "../../gui/src/3D/vector3WithInfo.ts",
                     "../../gui/src/3D/controls/control3D.ts",
                     "../../gui/src/3D/controls/container3D.ts",
+                    "../../gui/src/3D/controls/abstractButton3D.ts",
                     "../../gui/src/3D/controls/button3D.ts",
                     "../../gui/src/3D/controls/holographicButton.ts",
                     "../../gui/src/3D/controls/stackPanel3D.ts",

+ 25 - 0
gui/src/3D/controls/abstractButton3D.ts

@@ -0,0 +1,25 @@
+/// <reference path="../../../../dist/preview release/babylon.d.ts"/>
+
+module BABYLON.GUI {
+    /**
+     * Class used as a root to all buttons
+     */
+    export class AbstractButton3D extends Control3D {
+        /**
+         * Creates a new button
+         * @param name defines the control name
+         */
+        constructor(name?: string) {
+            super(name);
+        }
+
+        protected _getTypeName(): string {
+            return "AbstractButton3D";
+        }        
+
+        // Mesh association
+        protected _createNode(scene: Scene): TransformNode {
+            return new TransformNode("button" + this.name);
+        }    
+    }
+}

+ 1 - 1
gui/src/3D/controls/button3D.ts

@@ -4,7 +4,7 @@ module BABYLON.GUI {
     /**
      * Class used to create a button in 3D
      */
-    export class Button3D extends Control3D {
+    export class Button3D extends AbstractButton3D {
         /** @hidden */
         protected _currentMaterial: Material;
         private _facadeTexture: Nullable<AdvancedDynamicTexture>;

+ 5 - 1
gui/src/3D/gui3DManager.ts

@@ -65,7 +65,7 @@ module BABYLON.GUI {
             });
 
             this._pointerObserver = utilityLayerScene.onPointerObservable.add((pi, state) => {
-                this._doPicking(pi)
+                this._doPicking(pi);
             });
 
             // Scene
@@ -128,6 +128,10 @@ module BABYLON.GUI {
                     this._lastControlDown[pointerEvent.pointerId].forcePointerUp();
                     delete this._lastControlDown[pointerEvent.pointerId];
                 }
+
+                if (pointerEvent.pointerType === "touch") {
+                    this._handlePointerOut(pointerId, false);
+                }
             }
 
             return true;