|
@@ -7,6 +7,7 @@ module BABYLON.GUI {
|
|
|
private _zIndex = 0;
|
|
|
public _root: Container;
|
|
|
public _host: AdvancedDynamicTexture;
|
|
|
+ public parent: Container;
|
|
|
public _currentMeasure = Measure.Empty();
|
|
|
private _fontFamily = "Arial";
|
|
|
private _fontStyle = "";
|
|
@@ -835,68 +836,72 @@ module BABYLON.GUI {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- protected _onPointerMove(coordinates: Vector2): void {
|
|
|
- if (this.onPointerMoveObservable.hasObservers()) {
|
|
|
- this.onPointerMoveObservable.notifyObservers(coordinates);
|
|
|
- }
|
|
|
+ public _onPointerMove(target: Control, coordinates: Vector2): void {
|
|
|
+ var canNotify: boolean = this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this);
|
|
|
+
|
|
|
+ if (canNotify && this.parent != null) this.parent._onPointerMove(target, coordinates);
|
|
|
}
|
|
|
|
|
|
- protected _onPointerEnter(): boolean {
|
|
|
+ public _onPointerEnter(target: Control): boolean {
|
|
|
if (this._enterCount !== 0) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
this._enterCount++;
|
|
|
- if (this.onPointerEnterObservable.hasObservers()) {
|
|
|
- this.onPointerEnterObservable.notifyObservers(this);
|
|
|
- }
|
|
|
+
|
|
|
+ var canNotify: boolean = this.onPointerEnterObservable.notifyObservers(this, -1, target, this);
|
|
|
+
|
|
|
+ if (canNotify && this.parent != null) this.parent._onPointerEnter(target);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public _onPointerOut(): void {
|
|
|
+ public _onPointerOut(target: Control): void {
|
|
|
this._enterCount = 0;
|
|
|
- if (this.onPointerOutObservable.hasObservers()) {
|
|
|
- this.onPointerOutObservable.notifyObservers(this);
|
|
|
- }
|
|
|
+
|
|
|
+ var canNotify: boolean = this.onPointerOutObservable.notifyObservers(this, -1, target, this);
|
|
|
+
|
|
|
+ if (canNotify && this.parent != null) this.parent._onPointerOut(target);
|
|
|
}
|
|
|
|
|
|
- protected _onPointerDown(coordinates: Vector2, buttonIndex: number): boolean {
|
|
|
+ public _onPointerDown(target: Control, coordinates: Vector2, buttonIndex: number): boolean {
|
|
|
if (this._downCount !== 0) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- this._downCount++;
|
|
|
- if (this.onPointerDownObservable.hasObservers()) {
|
|
|
- this.onPointerDownObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex));
|
|
|
- }
|
|
|
+ this._downCount++;
|
|
|
+
|
|
|
+ var canNotify: boolean = this.onPointerDownObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this);
|
|
|
+
|
|
|
+ if (canNotify && this.parent != null) this.parent._onPointerDown(target, coordinates, buttonIndex);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- protected _onPointerUp(coordinates: Vector2, buttonIndex: number): void {
|
|
|
+ public _onPointerUp(target: Control, coordinates: Vector2, buttonIndex: number): void {
|
|
|
this._downCount = 0;
|
|
|
- if (this.onPointerUpObservable.hasObservers()) {
|
|
|
- this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex));
|
|
|
- }
|
|
|
+
|
|
|
+ var canNotify: boolean = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this);
|
|
|
+
|
|
|
+ if (canNotify && this.parent != null) this.parent._onPointerUp(target, coordinates, buttonIndex);
|
|
|
}
|
|
|
|
|
|
public forcePointerUp() {
|
|
|
- this._onPointerUp(Vector2.Zero(), 0);
|
|
|
+ this._onPointerUp(this, Vector2.Zero(), 0);
|
|
|
}
|
|
|
|
|
|
public _processObservables(type: number, x: number, y: number, buttonIndex: number): boolean {
|
|
|
this._dummyVector2.copyFromFloats(x, y);
|
|
|
if (type === BABYLON.PointerEventTypes.POINTERMOVE) {
|
|
|
- this._onPointerMove(this._dummyVector2);
|
|
|
+ this._onPointerMove(this, this._dummyVector2);
|
|
|
|
|
|
var previousControlOver = this._host._lastControlOver;
|
|
|
if (previousControlOver && previousControlOver !== this) {
|
|
|
- previousControlOver._onPointerOut();
|
|
|
+ previousControlOver._onPointerOut(this);
|
|
|
}
|
|
|
|
|
|
if (previousControlOver !== this) {
|
|
|
- this._onPointerEnter();
|
|
|
+ this._onPointerEnter(this);
|
|
|
}
|
|
|
|
|
|
this._host._lastControlOver = this;
|
|
@@ -904,7 +909,7 @@ module BABYLON.GUI {
|
|
|
}
|
|
|
|
|
|
if (type === BABYLON.PointerEventTypes.POINTERDOWN) {
|
|
|
- this._onPointerDown(this._dummyVector2, buttonIndex);
|
|
|
+ this._onPointerDown(this, this._dummyVector2, buttonIndex);
|
|
|
this._host._lastControlDown = this;
|
|
|
this._host._lastPickedControl = this;
|
|
|
return true;
|
|
@@ -912,7 +917,7 @@ module BABYLON.GUI {
|
|
|
|
|
|
if (type === BABYLON.PointerEventTypes.POINTERUP) {
|
|
|
if (this._host._lastControlDown) {
|
|
|
- this._host._lastControlDown._onPointerUp(this._dummyVector2, buttonIndex);
|
|
|
+ this._host._lastControlDown._onPointerUp(this, this._dummyVector2, buttonIndex);
|
|
|
}
|
|
|
this._host._lastControlDown = null;
|
|
|
return true;
|