@onerjs/gui 8.50.5 → 8.50.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,6 +131,8 @@ export declare class Control implements IAnimatable, IFocusableControl {
131
131
  isRoot: boolean;
132
132
  private _fixed;
133
133
  private _fixedWorldPoint;
134
+ private _isPointerMoved1;
135
+ private _isPointerDown1;
134
136
  /** @internal */
135
137
  protected _urlRewriter?: (url: string) => string;
136
138
  /**
@@ -1070,6 +1070,8 @@ export class Control {
1070
1070
  this.isRoot = false;
1071
1071
  this._fixed = false;
1072
1072
  this._fixedWorldPoint = Vector2.Zero();
1073
+ this._isPointerMoved1 = false;
1074
+ this._isPointerDown1 = false;
1073
1075
  /**
1074
1076
  * Observable that fires when the control's enabled state changes
1075
1077
  */
@@ -1955,6 +1957,7 @@ export class Control {
1955
1957
  * @internal
1956
1958
  */
1957
1959
  _onPointerMove(target, coordinates, pointerId, pi) {
1960
+ this._isPointerMoved1 = true;
1958
1961
  const canNotify = this.onPointerMoveObservable.notifyObservers(coordinates, -1, target, this, pi);
1959
1962
  if (canNotify && this.parent != null && !this.isPointerBlocker) {
1960
1963
  this.parent._onPointerMove(target, coordinates, pointerId, pi);
@@ -2003,6 +2006,8 @@ export class Control {
2003
2006
  _onPointerDown(target, coordinates, pointerId, buttonIndex, pi) {
2004
2007
  // Prevent pointerout to lose control context.
2005
2008
  // Event redundancy is checked inside the function.
2009
+ this._isPointerDown1 = true;
2010
+ this._isPointerMoved1 = false;
2006
2011
  this._onPointerEnter(this, pi);
2007
2012
  if (this.tabIndex !== -1) {
2008
2013
  this.host.focusedControl = this;
@@ -2025,6 +2030,10 @@ export class Control {
2025
2030
  * @internal
2026
2031
  */
2027
2032
  _onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick, pi) {
2033
+ const isDown = this._isPointerDown1;
2034
+ const isMoved = this._isPointerMoved1;
2035
+ this._isPointerDown1 = false;
2036
+ this._isPointerMoved1 = false;
2028
2037
  if (!this._isEnabled) {
2029
2038
  return;
2030
2039
  }
@@ -2033,7 +2042,9 @@ export class Control {
2033
2042
  let canNotifyClick = notifyClick;
2034
2043
  if (notifyClick && (this._enterCount > 0 || this._enterCount === -1)) {
2035
2044
  if (!this._host.usePointerTapForClickEvent) {
2036
- canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
2045
+ if (isDown && !isMoved) {
2046
+ canNotifyClick = this.onPointerClickObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);
2047
+ }
2037
2048
  }
2038
2049
  }
2039
2050
  const canNotify = this.onPointerUpObservable.notifyObservers(new Vector2WithInfo(coordinates, buttonIndex), -1, target, this, pi);