Browse Source

ADT: Better control behavior for buttons

David Catuhe 8 năm trước cách đây
mục cha
commit
4a769cf47a

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3477 - 3477
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3477 - 3477
dist/preview release/babylon.module.d.ts


+ 11 - 0
gui/src/controls/button.ts

@@ -6,6 +6,17 @@ module BABYLON.GUI {
             super(name);
         }
 
+        // While being a container, the button behaves like a control.
+        public _processPicking(x: number, y: number, type: number): boolean {
+            if (!this._contains(x, y)) {
+                return false;
+            }
+
+            this._processObservables(type);
+
+            return true;
+        }
+
         // Statics
         public static CreateImageButton(name: string, text: string, imageUrl: string): Button {
             var result = new Button(name);

+ 3 - 1
gui/src/controls/control.ts

@@ -407,7 +407,9 @@ module BABYLON.GUI {
                 return false;
             }
 
-            return this._processObservables(type);
+            this._processObservables(type);
+
+            return true;
         }
 
         protected _processObservables(type: number): boolean {