|
@@ -46,6 +46,7 @@ module BABYLON.GUI {
|
|
|
private _downCount = 0;
|
|
|
private _enterCount = 0;
|
|
|
private _doNotRender = false;
|
|
|
+ private _downPointerIds:{[id:number] : boolean} = {};
|
|
|
|
|
|
public isHitTestVisible = true;
|
|
|
public isPointerBlocker = false;
|
|
@@ -859,7 +860,7 @@ module BABYLON.GUI {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public _processPicking(x: number, y: number, type: number, buttonIndex: number): boolean {
|
|
|
+ public _processPicking(x: number, y: number, type: number, pointerId:number, buttonIndex: number): boolean {
|
|
|
if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {
|
|
|
return false;
|
|
|
}
|
|
@@ -868,7 +869,7 @@ module BABYLON.GUI {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- this._processObservables(type, x, y, buttonIndex);
|
|
|
+ this._processObservables(type, x, y, pointerId, buttonIndex);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -901,33 +902,43 @@ module BABYLON.GUI {
|
|
|
if (canNotify && this.parent != null) this.parent._onPointerOut(target);
|
|
|
}
|
|
|
|
|
|
- public _onPointerDown(target: Control, coordinates: Vector2, buttonIndex: number): boolean {
|
|
|
+ public _onPointerDown(target: Control, coordinates: Vector2, pointerId:number, buttonIndex: number): boolean {
|
|
|
if (this._downCount !== 0) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
this._downCount++;
|
|
|
|
|
|
+ this._downPointerIds[pointerId] = true;
|
|
|
+
|
|
|
var canNotify: boolean = this.onPointerDownObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this);
|
|
|
|
|
|
- if (canNotify && this.parent != null) this.parent._onPointerDown(target, coordinates, buttonIndex);
|
|
|
+ if (canNotify && this.parent != null) this.parent._onPointerDown(target, coordinates, pointerId, buttonIndex);
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- public _onPointerUp(target: Control, coordinates: Vector2, buttonIndex: number): void {
|
|
|
+ public _onPointerUp(target: Control, coordinates: Vector2, pointerId:number, buttonIndex: number): void {
|
|
|
this._downCount = 0;
|
|
|
|
|
|
+ delete this._downPointerIds[pointerId];
|
|
|
+
|
|
|
var canNotify: boolean = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this);
|
|
|
|
|
|
- if (canNotify && this.parent != null) this.parent._onPointerUp(target, coordinates, buttonIndex);
|
|
|
+ if (canNotify && this.parent != null) this.parent._onPointerUp(target, coordinates, pointerId, buttonIndex);
|
|
|
}
|
|
|
|
|
|
- public forcePointerUp() {
|
|
|
- this._onPointerUp(this, Vector2.Zero(), 0);
|
|
|
+ public forcePointerUp(pointerId:Nullable<number> = null) {
|
|
|
+ if(pointerId !== null){
|
|
|
+ this._onPointerUp(this, Vector2.Zero(), pointerId, 0);
|
|
|
+ }else{
|
|
|
+ for(var key in this._downPointerIds){
|
|
|
+ this._onPointerUp(this, Vector2.Zero(), +key as number, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public _processObservables(type: number, x: number, y: number, buttonIndex: number): boolean {
|
|
|
+ public _processObservables(type: number, x: number, y: number, pointerId:number, buttonIndex: number): boolean {
|
|
|
this._dummyVector2.copyFromFloats(x, y);
|
|
|
if (type === BABYLON.PointerEventTypes.POINTERMOVE) {
|
|
|
this._onPointerMove(this, this._dummyVector2);
|
|
@@ -946,7 +957,7 @@ module BABYLON.GUI {
|
|
|
}
|
|
|
|
|
|
if (type === BABYLON.PointerEventTypes.POINTERDOWN) {
|
|
|
- this._onPointerDown(this, this._dummyVector2, buttonIndex);
|
|
|
+ this._onPointerDown(this, this._dummyVector2, pointerId, buttonIndex);
|
|
|
this._host._lastControlDown = this;
|
|
|
this._host._lastPickedControl = this;
|
|
|
return true;
|
|
@@ -954,7 +965,7 @@ module BABYLON.GUI {
|
|
|
|
|
|
if (type === BABYLON.PointerEventTypes.POINTERUP) {
|
|
|
if (this._host._lastControlDown) {
|
|
|
- this._host._lastControlDown._onPointerUp(this, this._dummyVector2, buttonIndex);
|
|
|
+ this._host._lastControlDown._onPointerUp(this, this._dummyVector2, pointerId, buttonIndex);
|
|
|
}
|
|
|
this._host._lastControlDown = null;
|
|
|
return true;
|