@babylonjs/gui 7.20.1 → 7.21.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -835,6 +835,7 @@ export declare class Control implements IAnimatable, IFocusableControl {
835
835
  * @internal
836
836
  */
837
837
  _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: Nullable<PointerInfoBase>): void;
838
+ _onPointerPick(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi: Nullable<PointerInfoBase>): boolean;
838
839
  /**
839
840
  * @internal
840
841
  */
@@ -1908,7 +1908,9 @@ export class Control {
1908
1908
  delete this._downPointerIds[pointerId];
1909
1909
  let canNotifyClick = notifyClick;
1910
1910
  if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {
1911
- canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1911
+ if (!this._host.usePointerTapForClickEvent) {
1912
+ canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1913
+ }
1912
1914
  }
1913
1915
  const canNotify = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1914
1916
  if (canNotify && this.parent != null && !this.isPointerBlocker) {
@@ -1918,6 +1920,20 @@ export class Control {
1918
1920
  this._host._capturedPointerIds.delete(pi.event.pointerId);
1919
1921
  }
1920
1922
  }
1923
+ _onPointerPick(target, coordinates, pointerId, buttonIndex, notifyClick, pi) {
1924
+ if (!this._host.usePointerTapForClickEvent) {
1925
+ return false;
1926
+ }
1927
+ let canNotifyClick = notifyClick;
1928
+ if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {
1929
+ canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1930
+ }
1931
+ const canNotify = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
1932
+ if (canNotify && this.parent != null && !this.isPointerBlocker) {
1933
+ this.parent._onPointerPick(target, coordinates, pointerId, buttonIndex, canNotifyClick, pi);
1934
+ }
1935
+ return true;
1936
+ }
1921
1937
  /**
1922
1938
  * @internal
1923
1939
  */
@@ -1965,25 +1981,34 @@ export class Control {
1965
1981
  this._host._lastControlOver[pointerId] = this;
1966
1982
  return true;
1967
1983
  }
1968
- if (type === PointerEventTypes.POINTERDOWN) {
1984
+ else if (type === PointerEventTypes.POINTERDOWN) {
1969
1985
  this._onPointerDown(this, this._dummyVector2, pointerId, buttonIndex, pi);
1970
1986
  this._host._registerLastControlDown(this, pointerId);
1971
1987
  this._host._lastPickedControl = this;
1972
1988
  return true;
1973
1989
  }
1974
- if (type === PointerEventTypes.POINTERUP) {
1990
+ else if (type === PointerEventTypes.POINTERUP) {
1975
1991
  if (this._host._lastControlDown[pointerId]) {
1976
1992
  this._host._lastControlDown[pointerId]._onPointerUp(this, this._dummyVector2, pointerId, buttonIndex, true, pi);
1977
1993
  }
1978
- delete this._host._lastControlDown[pointerId];
1994
+ if (!this._host.usePointerTapForClickEvent) {
1995
+ delete this._host._lastControlDown[pointerId];
1996
+ }
1979
1997
  return true;
1980
1998
  }
1981
- if (type === PointerEventTypes.POINTERWHEEL) {
1999
+ else if (type === PointerEventTypes.POINTERWHEEL) {
1982
2000
  if (this._host._lastControlOver[pointerId]) {
1983
2001
  this._host._lastControlOver[pointerId]._onWheelScroll(deltaX, deltaY);
1984
2002
  return true;
1985
2003
  }
1986
2004
  }
2005
+ else if (type === PointerEventTypes.POINTERTAP) {
2006
+ if (this._host._lastControlDown[pointerId]) {
2007
+ this._host._lastControlDown[pointerId]._onPointerPick(this, this._dummyVector2, pointerId, buttonIndex, true, pi);
2008
+ }
2009
+ delete this._host._lastControlDown[pointerId];
2010
+ return true;
2011
+ }
1987
2012
  return false;
1988
2013
  }
1989
2014
  _getStyleProperty(propName, defaultValue) {