laymur 0.14.2 → 0.15.1

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.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { MathUtils, Color, Vector4, Texture, Vector2, Vector3, Matrix3, Matrix4, PlaneGeometry, InstancedBufferGeometry, ShaderMaterial, InstancedBufferAttribute, Mesh, Scene, OrthographicCamera, Quaternion, CanvasTexture, UVMapping, ClampToEdgeWrapping, LinearFilter, RGBAFormat, UnsignedByteType, SRGBColorSpace, NoColorSpace, WebGLRenderTarget, PerspectiveCamera, Ray } from 'three';
2
2
 
3
- class t{constructor(t,i,r=0){this.t=new WeakMap,this.i=new Map,void 0!==t&&(void 0===i?this.i.set(t,r):this.t.set(i,new Map([[t,r]])));}insert(t,i,r=0){if(void 0===i){if(this.i.has(t))return;return void this.i.set(t,r)}const s=this.t.get(i);void 0===s?this.t.set(i,new Map([[t,r]])):s.has(t)||s.set(t,r);}remove(t,i){if(void 0===i)return void this.i.delete(t);const r=this.t.get(i);void 0!==r&&(r.delete(t),0===r.size&&this.t.delete(i));}has(t,i){if(void 0===i)return this.i.has(t);const r=this.t.get(i);return void 0!==r&&r.has(t)}getPriority(t,i){if(void 0===i)return this.i.get(t);const r=this.t.get(i);return void 0!==r?r.get(t):void 0}}class i{constructor(){this.o=new Map;}on(t,i,r,s=0){return this.h(t,false,s,i,r),this}once(t,i,r,s=0){return this.h(t,true,s,i,r),this}off(t,i,r){const s=this.o.get(t);if(void 0===s)return this;s.u&&(s.u=false,s.v=s.v.slice());const o=s.v;if(0===o.length)return this.o.delete(t),this;if(void 0===i){this.o.delete(t);for(let t=0;o.length>t;t++){const i=o[t];s.l.remove(i._,i.p);}return this}{const e=o.length;if(o[0]._===i&&o[0].p===r)return 1===e?this.o.delete(t):o.shift(),this;const n=e-1;if(o[n]._===i&&o[n].p===r)return o.pop(),this;if(10>e||o[0].M===o[n].M)for(let t=1;n>t;t++){const s=o[t];if(s._===i&&s.p===r)return o.splice(t,1),this}else {const t=s.l.getPriority(i,r);if(void 0===t)return this;let e=0,n=o.length-1;for(;n>=e;){const i=e+n>>>1;t>o[i].M?e=i+1:n=i-1;}const c=e;for(n=o.length-1;n>=e;){const i=e+n>>>1;o[i].M>t?n=i-1:e=i+1;}const h=n;for(let t=c;h>=t;t++)if(o[t]._===i&&o[t].p===r)return o.splice(t,1),this}}return this}emit(t,...i){const r=this.o.get(t);if(void 0===r)return false;if(0===r.v.length)return false;r.u?r.v=r.v.slice():r.u=true;const s=r.v;let o=false;for(let t=0;s.length>t;t++){const r=s[t];r._.apply(r.p,i),r.k&&(o=true,r.m=true);}const e=this.o.get(t);if(void 0===e)return true;e.v===s&&(e.u=false);const n=e.v;if(o){let i=0;for(let t=0;n.length>t;t++){const r=n[t];r.m?e.l.remove(r._,r.p):n[i++]=r;}0===i?this.o.delete(t):n.length=i;}return true}h(i,r,s,o,e){let n=this.o.get(i);if(void 0===n)return void this.o.set(i,{v:[{_:o,p:e,M:s,k:r,m:false}],u:false,l:new t(o,e,s)});if(n.l.has(o,e))throw Error("Event listener already exists");n.l.insert(o,e,s);const c={_:o,p:e,M:s,k:r,m:false};n.u&&(n.u=false,n.v=n.v.slice());{const t=n.v,i=c.M;if(0===t.length||i>=t[t.length-1].M)return void t.push(c);if(t[0].M>=i)return void t.unshift(c);{let r=0,s=t.length;for(;s>r;){const o=r+s>>>1;i>t[o].M?r=o+1:s=o;}t.splice(r,0,c);}}}}
3
+ class i{constructor(){this.i=0,this.t=false;}on(i){this.i>0?(this.h??(this.h=[])).push(i):this.o(i);}once(i){if(this.i>0)return (this.h??(this.h=[])).push(i),void(this.v??(this.v=new Set)).add(i);(this.l??(this.l=new Set)).add(i),this.o(i);}off(i){if(void 0!==this.h){const t=this.h.indexOf(i);if(-1!==t)return this.h.splice(t,1),void this.v?.delete(i)}this.l?.delete(i),this.i>0?this._(i):this.u(i);}m(){if(void 0!==this.l&&this.l.size>0&&(this.l.forEach(i=>{this._(i);}),this.l=void 0),this.t&&(this.t=false,this.p()),void 0!==this.h&&this.h.length>0){for(let i=0;this.h.length>i;i++){const t=this.h[i];true===this.v?.has(t)&&(this.l??(this.l=new Set)).add(t),this.o(t);}this.h=void 0,this.v=void 0;}}o(i){ void 0!==this.S?void 0!==this.I?void 0!==this.R?void 0!==this.k?void 0!==this.C?void 0!==this.F?void 0!==this.N?void 0!==this.j?void 0!==this.q?void 0!==this.A?(this.B??(this.B=[])).push(i):this.A=i:this.q=i:this.j=i:this.N=i:this.F=i:this.C=i:this.k=i:this.R=i:this.I=i:this.S=i;}_(i){if(this.t=true,this.S!==i)if(this.I!==i)if(this.R!==i)if(this.k!==i)if(this.C!==i)if(this.F!==i)if(this.N!==i)if(this.j!==i)if(this.q!==i)if(this.A!==i){if(void 0!==this.B){const t=this.B.indexOf(i);-1!==t&&(this.B[t]=void 0);}}else this.A=void 0;else this.q=void 0;else this.j=void 0;else this.N=void 0;else this.F=void 0;else this.C=void 0;else this.k=void 0;else this.R=void 0;else this.I=void 0;else this.S=void 0;}u(i){if(this.S===i)return this.S=void 0,void this.p();if(this.I===i)return this.I=void 0,void this.p();if(this.R===i)return this.R=void 0,void this.p();if(this.k===i)return this.k=void 0,void this.p();if(this.C===i)return this.C=void 0,void this.p();if(this.F===i)return this.F=void 0,void this.p();if(this.N===i)return this.N=void 0,void this.p();if(this.j===i)return this.j=void 0,void this.p();if(this.q===i)return this.q=void 0,void this.p();if(this.A===i)return this.A=void 0,void this.p();if(void 0!==this.B){const t=this.B.indexOf(i);-1!==t&&(this.B.splice(t,1),0===this.B.length&&(this.B=void 0));}}p(){const i=[];if(void 0!==this.S&&i.push(this.S),void 0!==this.I&&i.push(this.I),void 0!==this.R&&i.push(this.R),void 0!==this.k&&i.push(this.k),void 0!==this.C&&i.push(this.C),void 0!==this.F&&i.push(this.F),void 0!==this.N&&i.push(this.N),void 0!==this.j&&i.push(this.j),void 0!==this.q&&i.push(this.q),void 0!==this.A&&i.push(this.A),void 0!==this.B){for(let t=0;this.B.length>t;t++){const s=this.B[t];void 0!==s&&i.push(s);}this.B=void 0;}const t=i.length;this.S=t>0?i[0]:void 0,this.I=t>1?i[1]:void 0,this.R=t>2?i[2]:void 0,this.k=t>3?i[3]:void 0,this.C=t>4?i[4]:void 0,this.F=t>5?i[5]:void 0,this.N=t>6?i[6]:void 0,this.j=t>7?i[7]:void 0,this.q=t>8?i[8]:void 0,this.A=t>9?i[9]:void 0,t>10&&(this.B=i.slice(10));}D(i){return this.S===i||this.I===i||this.R===i||this.k===i||this.C===i||this.F===i||this.N===i||this.j===i||this.q===i||this.A===i}G(i){return !!this.D(i)||true===this.B?.includes(i)||true===this.h?.includes(i)}H(i){}J(i){}}class t extends i{emit(){if(this.i++,this.S?.(),this.I?.(),this.R?.(),this.k?.(),this.C?.(),this.F?.(),this.N?.(),this.j?.(),this.q?.(),this.A?.(),void 0!==this.B)for(let i=0;this.B.length>i;i++)this.B[i]?.();this.i--,0===this.i&&this.m();}}class s extends i{emit(i){if(this.i++,this.S?.(i),this.I?.(i),this.R?.(i),this.k?.(i),this.C?.(i),this.F?.(i),this.N?.(i),this.j?.(i),this.q?.(i),this.A?.(i),void 0!==this.B)for(let t=0;this.B.length>t;t++)this.B[t]?.(i);this.i--,0===this.i&&this.m();}}class h extends i{emit(i,t){if(this.i++,this.S?.(i,t),this.I?.(i,t),this.R?.(i,t),this.k?.(i,t),this.C?.(i,t),this.F?.(i,t),this.N?.(i,t),this.j?.(i,t),this.q?.(i,t),this.A?.(i,t),void 0!==this.B)for(let s=0;this.B.length>s;s++){const h=this.B[s];h?.(i,t);}this.i--,0===this.i&&this.m();}}class o extends i{emit(i,t,s){if(this.i++,this.S?.(i,t,s),this.I?.(i,t,s),this.R?.(i,t,s),this.k?.(i,t,s),this.C?.(i,t,s),this.F?.(i,t,s),this.N?.(i,t,s),this.j?.(i,t,s),this.q?.(i,t,s),this.A?.(i,t,s),void 0!==this.B)for(let h=0;this.B.length>h;h++){const o=this.B[h];o?.(i,t,s);}this.i--,0===this.i&&this.m();}}
4
4
 
5
5
  /** Visibility and interactivity state */
6
6
  var UIMode;
@@ -4289,9 +4289,7 @@ class UISolverWrapper {
4289
4289
  * and preserves coefficients and constants.
4290
4290
  */
4291
4291
  _private_convertExpression(expression) {
4292
- return new Expression(...expression
4293
- .prepareTerms()
4294
- .map(([variableIndex, coefficient]) => {
4292
+ return new Expression(...expression.prepareTerms().map(([variableIndex, coefficient]) => {
4295
4293
  const description = this._private_variables.get(variableIndex);
4296
4294
  if (description === undefined) {
4297
4295
  throw new Error(`UISolverWrapper.convertExpression.expression: variable does not exist`);
@@ -4329,28 +4327,20 @@ class UISolverWrapper {
4329
4327
  }
4330
4328
  }
4331
4329
 
4332
- /** Layer lifecycle and state events */
4333
- var UILayerEvent;
4334
- (function (UILayerEvent) {
4335
- /** Fired when orientation changes */
4336
- UILayerEvent["ORIENTATION_CHANGED"] = "orientation_changed";
4337
- /** Fired when mode changes */
4338
- UILayerEvent["MODE_CHANGED"] = "mode_changed";
4339
- /** Fired during rendering */
4340
- UILayerEvent["RENDERING"] = "rendering";
4341
- })(UILayerEvent || (UILayerEvent = {}));
4342
4330
  const LAYER_DEFAULT_SIZE = 1024;
4343
4331
  const LAYER_DEFAULT_NAME = "";
4344
4332
  const LAYER_DEFAULT_MODE = UIMode.VISIBLE;
4345
4333
 
4346
4334
  /** Base layer for UI rendering and layout management */
4347
- class UILayer extends i {
4335
+ class UILayer {
4348
4336
  constructor(options) {
4349
- super();
4350
4337
  /** Optional layer name */
4351
4338
  this.name = "";
4352
4339
  this.inputWrapperInternal = new UIInputWrapper();
4353
4340
  this._private_solverWrapperInternal = new UISolverWrapper();
4341
+ this._private_signalOrientationChangedInternal = new h();
4342
+ this._private_signalModeChangedInternal = new h();
4343
+ this._private_signalRenderingInternal = new o();
4354
4344
  if (options.width !== undefined) {
4355
4345
  assertValidPositiveNumber(options.width, "UILayer.constructor.options.width");
4356
4346
  }
@@ -4362,8 +4352,7 @@ class UILayer extends i {
4362
4352
  this._private_sceneWrapperInternal = new UISceneWrapper(width, height);
4363
4353
  this.name = options.name ?? LAYER_DEFAULT_NAME;
4364
4354
  this._private_modeInternal = options.mode ?? LAYER_DEFAULT_MODE;
4365
- this._private_orientationInternal =
4366
- width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
4355
+ this._private_orientationInternal = width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
4367
4356
  this.xVariable = this._private_solverWrapperInternal.createVariable(0, UIPriority.P0);
4368
4357
  this.yVariable = this._private_solverWrapperInternal.createVariable(0, UIPriority.P0);
4369
4358
  this.wVariable = this._private_solverWrapperInternal.createVariable(width, UIPriority.P0);
@@ -4405,11 +4394,23 @@ class UILayer extends i {
4405
4394
  get orientation() {
4406
4395
  return this._private_orientationInternal;
4407
4396
  }
4397
+ /** Signal fired when orientation changes */
4398
+ get signalOrientationChanged() {
4399
+ return this._private_signalOrientationChangedInternal;
4400
+ }
4401
+ /** Signal fired when mode changes */
4402
+ get signalModeChanged() {
4403
+ return this._private_signalModeChangedInternal;
4404
+ }
4405
+ /** Signal fired during rendering */
4406
+ get signalRendering() {
4407
+ return this._private_signalRenderingInternal;
4408
+ }
4408
4409
  /** Updates visibility and interactivity mode */
4409
4410
  set mode(value) {
4410
4411
  if (value !== this._private_modeInternal) {
4411
4412
  this._private_modeInternal = value;
4412
- this.emit(UILayerEvent.MODE_CHANGED, this._private_modeInternal, this);
4413
+ this._private_signalModeChangedInternal.emit(this._private_modeInternal, this);
4413
4414
  }
4414
4415
  }
4415
4416
  resizeInternal(width, height) {
@@ -4419,12 +4420,12 @@ class UILayer extends i {
4419
4420
  const orientation = width > height ? UIOrientation.HORIZONTAL : UIOrientation.VERTICAL;
4420
4421
  if (orientation !== this._private_orientationInternal) {
4421
4422
  this._private_orientationInternal = orientation;
4422
- this.emit(UILayerEvent.ORIENTATION_CHANGED, this._private_orientationInternal, this);
4423
+ this._private_signalOrientationChangedInternal.emit(this._private_orientationInternal, this);
4423
4424
  }
4424
4425
  }
4425
4426
  renderInternal(renderer, deltaTime) {
4426
4427
  if (isUIModeVisible(this.mode)) {
4427
- this.emit(UILayerEvent.RENDERING, renderer, deltaTime, this);
4428
+ this._private_signalRenderingInternal.emit(renderer, deltaTime, this);
4428
4429
  this._private_sceneWrapperInternal.render(renderer);
4429
4430
  }
4430
4431
  this._private_solverWrapperInternal.dirty = false;
@@ -4440,10 +4441,7 @@ const EPSILON = 1e-6;
4440
4441
  * @returns True if object has valid layer property
4441
4442
  */
4442
4443
  function isUILayerElement(obj) {
4443
- return (typeof obj === "object" &&
4444
- obj !== null &&
4445
- "layer" in obj &&
4446
- obj.layer instanceof UILayer);
4444
+ return typeof obj === "object" && obj !== null && "layer" in obj && obj.layer instanceof UILayer;
4447
4445
  }
4448
4446
  /**
4449
4447
  * Checks if object implements UIPointElement.
@@ -4654,7 +4652,7 @@ class UISingleParameterConstraint extends UIConstraint {
4654
4652
  this._private_priorityInternal = resolvePriority(options?.priority);
4655
4653
  this._private_relationInternal = resolveRelation(options?.relation);
4656
4654
  this._private_orientationInternal = resolveOrientation(options?.orientation);
4657
- this.layer.on(UILayerEvent.ORIENTATION_CHANGED, this._private_onOrientationChange);
4655
+ this.layer.signalOrientationChanged.on(this._private_onOrientationChange);
4658
4656
  }
4659
4657
  /** Constraint priority */
4660
4658
  get priority() {
@@ -4691,7 +4689,7 @@ class UISingleParameterConstraint extends UIConstraint {
4691
4689
  }
4692
4690
  /** Removes constraint from solver and cleans up listeners */
4693
4691
  destroy() {
4694
- this.layer.off(UILayerEvent.ORIENTATION_CHANGED, this._private_onOrientationChange);
4692
+ this.layer.signalOrientationChanged.off(this._private_onOrientationChange);
4695
4693
  this.solverWrapper.removeConstraint(this.constraint);
4696
4694
  }
4697
4695
  /**
@@ -5298,9 +5296,7 @@ function normalizeUIType2D(value) {
5298
5296
  if (Array.isArray(value)) {
5299
5297
  return { h: value[0], v: value[1] };
5300
5298
  }
5301
- if (typeof value === "object" &&
5302
- value !== null &&
5303
- ("h" in value || "v" in value)) {
5299
+ if (typeof value === "object" && value !== null && ("h" in value || "v" in value)) {
5304
5300
  return value;
5305
5301
  }
5306
5302
  return { h: value, v: value };
@@ -5615,7 +5611,7 @@ const ANCHOR_DEFAULT_X = 0;
5615
5611
  const ANCHOR_DEFAULT_Y = 0;
5616
5612
 
5617
5613
  /** Point in 2D space with constraint-based positioning */
5618
- class UIAnchor extends i {
5614
+ class UIAnchor {
5619
5615
  /**
5620
5616
  * Creates a new UIAnchor instance.
5621
5617
  *
@@ -5623,14 +5619,13 @@ class UIAnchor extends i {
5623
5619
  * @param options - Configuration options
5624
5620
  */
5625
5621
  constructor(layer, options) {
5622
+ this.layer = layer;
5623
+ /** Optional identifier for debugging */
5624
+ this.name = "";
5626
5625
  const x = options?.x ?? ANCHOR_DEFAULT_X;
5627
5626
  const y = options?.y ?? ANCHOR_DEFAULT_Y;
5628
5627
  assertValidNumber(x, "UIAnchor.constructor.options.x");
5629
5628
  assertValidNumber(y, "UIAnchor.constructor.options.y");
5630
- super();
5631
- this.layer = layer;
5632
- /** Optional identifier for debugging */
5633
- this.name = "";
5634
5629
  this.solverWrapper = this.layer.solverWrapper;
5635
5630
  this.xVariable = this.solverWrapper.createVariable(x, UIPriority.P7);
5636
5631
  this.yVariable = this.solverWrapper.createVariable(y, UIPriority.P7);
@@ -5741,10 +5736,8 @@ function computeTrimmedTransformMatrix(x, y, width, height, zIndex, microX, micr
5741
5736
  else {
5742
5737
  const rawAnchorOffsetX = microAnchorX * width;
5743
5738
  const rawAnchorOffsetY = microAnchorY * height;
5744
- TEMP_POSITION.x =
5745
- x + rawAnchorOffsetX - rotatedAnchorX + microX + rotatedTrimX;
5746
- TEMP_POSITION.y =
5747
- y + rawAnchorOffsetY - rotatedAnchorY + microY + rotatedTrimY;
5739
+ TEMP_POSITION.x = x + rawAnchorOffsetX - rotatedAnchorX + microX + rotatedTrimX;
5740
+ TEMP_POSITION.y = y + rawAnchorOffsetY - rotatedAnchorY + microY + rotatedTrimY;
5748
5741
  }
5749
5742
  TEMP_POSITION.z = zIndex;
5750
5743
  TEMP_SCALE.x = trimmedWidth * microScaleX;
@@ -5756,18 +5749,11 @@ function computeTrimmedTransformMatrix(x, y, width, height, zIndex, microX, micr
5756
5749
 
5757
5750
  const TEXTURE_DEFAULT_TEXTURE = new Texture();
5758
5751
  const TEXTURE_DEFAULT_SIZE = 2;
5759
- /** Events emitted by UITexture */
5760
- var UITextureViewEvent;
5761
- (function (UITextureViewEvent) {
5762
- /** Emitted when width or height changes */
5763
- UITextureViewEvent[UITextureViewEvent["DIMENSIONS_CHANGED"] = 0] = "DIMENSIONS_CHANGED";
5764
- })(UITextureViewEvent || (UITextureViewEvent = {}));
5765
5752
 
5766
5753
  /** Wrapper for Three.js texture with atlas and trim support. Does not own the underlying texture; user must dispose it. */
5767
- class UITextureView extends i {
5754
+ class UITextureView {
5768
5755
  /** @param config Texture or atlas configuration */
5769
5756
  constructor(config) {
5770
- super();
5771
5757
  this._private_textureInternal = TEXTURE_DEFAULT_TEXTURE;
5772
5758
  this._private_sourceWidth = TEXTURE_DEFAULT_SIZE;
5773
5759
  this._private_sourceHeight = TEXTURE_DEFAULT_SIZE;
@@ -5784,6 +5770,7 @@ class UITextureView extends i {
5784
5770
  this._private_textureDirtyInternal = false;
5785
5771
  this._private_uvTransformDirtyInternal = false;
5786
5772
  this._private_trimDirtyInternal = false;
5773
+ this._private_signalDiminsionsChangedInternal = new o();
5787
5774
  if (config !== undefined) {
5788
5775
  this.set(config);
5789
5776
  }
@@ -5839,6 +5826,9 @@ class UITextureView extends i {
5839
5826
  get trimDirty() {
5840
5827
  return this._private_trimDirtyInternal;
5841
5828
  }
5829
+ get signalDiminsionsChanged() {
5830
+ return this._private_signalDiminsionsChangedInternal;
5831
+ }
5842
5832
  setTextureDirtyFalse() {
5843
5833
  this._private_textureDirtyInternal = false;
5844
5834
  }
@@ -5898,7 +5888,7 @@ class UITextureView extends i {
5898
5888
  this._private_setFromAtlasConfig(config);
5899
5889
  }
5900
5890
  if (this.width !== lastWidth || this.height !== lastHeight) {
5901
- this.emit(UITextureViewEvent.DIMENSIONS_CHANGED, this.width, this.height, this);
5891
+ this._private_signalDiminsionsChangedInternal.emit(this.width, this.height, this);
5902
5892
  }
5903
5893
  }
5904
5894
  _private_setFromTexture(texture) {
@@ -6202,21 +6192,6 @@ class UIAreaRectangle extends UIArea {
6202
6192
  }
6203
6193
  }
6204
6194
 
6205
- /** Input events emitted by UI elements */
6206
- var UIInputEvent;
6207
- (function (UIInputEvent) {
6208
- /** Pointer pressed */
6209
- UIInputEvent["PRESSED"] = "pointerdown";
6210
- /** Pointer moved */
6211
- UIInputEvent["MOVED"] = "pointermove";
6212
- /** Pointer released */
6213
- UIInputEvent["RELEASED"] = "pointerup";
6214
- /** Pointer entered element */
6215
- UIInputEvent["ENTERED"] = "pointerenter";
6216
- /** Pointer left element */
6217
- UIInputEvent["LEFT"] = "pointerleave";
6218
- })(UIInputEvent || (UIInputEvent = {}));
6219
-
6220
6195
  const DUMMY_DEFAULT_WIDTH = 64;
6221
6196
  const DUMMY_DEFAULT_HEIGHT = 32;
6222
6197
  const DUMMY_DEFAULT_MODE = UIMode.VISIBLE;
@@ -6237,17 +6212,21 @@ class UIInputDummy extends UIAnchor {
6237
6212
  assertValidPositiveNumber(h, "UIInputDummy.constructor.height");
6238
6213
  super(layer, options);
6239
6214
  this._private_wasPointerInside = false;
6215
+ this._private_signalPressedInternal = new s();
6216
+ this._private_signalMovedInternal = new s();
6217
+ this._private_signalReleasedInternal = new s();
6218
+ this._private_signalEnteredInternal = new s();
6219
+ this._private_signalLeftInternal = new s();
6240
6220
  this.catchPointerDown = (x, y, identifier) => {
6241
- return this.handleInputEvent(x, y, identifier, UIInputEvent.PRESSED);
6221
+ return this.handleInputEvent(x, y, identifier, this._private_signalPressedInternal);
6242
6222
  };
6243
6223
  this.catchPointerMove = (x, y, identifier) => {
6244
- return this.handleInputEvent(x, y, identifier, UIInputEvent.MOVED);
6224
+ return this.handleInputEvent(x, y, identifier, this._private_signalMovedInternal);
6245
6225
  };
6246
6226
  this.catchPointerUp = (x, y, identifier) => {
6247
- return this.handleInputEvent(x, y, identifier, UIInputEvent.RELEASED);
6227
+ return this.handleInputEvent(x, y, identifier, this._private_signalReleasedInternal);
6248
6228
  };
6249
- this.interactionArea =
6250
- options?.interactionArea ?? new UIAreaRectangle(0, 0, 1, 1);
6229
+ this.interactionArea = options?.interactionArea ?? new UIAreaRectangle(0, 0, 1, 1);
6251
6230
  this.modeInternal = options?.mode ?? DUMMY_DEFAULT_MODE;
6252
6231
  this.inputWrapper = this.layer.inputWrapper;
6253
6232
  this.wVariable = this.solverWrapper.createVariable(w, UIPriority.P6);
@@ -6287,6 +6266,26 @@ class UIInputDummy extends UIAnchor {
6287
6266
  get zIndex() {
6288
6267
  return this.inputWrapper.getZIndex(this._private_catcherHandler);
6289
6268
  }
6269
+ /** Signal fired when pointer is pressed */
6270
+ get signalPressed() {
6271
+ return this._private_signalPressedInternal;
6272
+ }
6273
+ /** Signal fired when pointer is moved */
6274
+ get signalMoved() {
6275
+ return this._private_signalMovedInternal;
6276
+ }
6277
+ /** Signal fired when pointer is released */
6278
+ get signalReleased() {
6279
+ return this._private_signalReleasedInternal;
6280
+ }
6281
+ /** Signal fired when pointer enters element */
6282
+ get signalEntered() {
6283
+ return this._private_signalEnteredInternal;
6284
+ }
6285
+ /** Signal fired when pointer leaves element */
6286
+ get signalLeft() {
6287
+ return this._private_signalLeftInternal;
6288
+ }
6290
6289
  /** Width in world units */
6291
6290
  set width(value) {
6292
6291
  assertValidPositiveNumber(value, "UIInputDummy.width");
@@ -6337,22 +6336,22 @@ class UIInputDummy extends UIAnchor {
6337
6336
  this.inputWrapper.destroyInputCatcher(this._private_catcherHandler);
6338
6337
  super.destroy();
6339
6338
  }
6340
- handleInputEvent(x, y, identifier, inputEvent) {
6339
+ handleInputEvent(x, y, identifier, signal) {
6341
6340
  assertValidNumber(x, "UIInputDummy.handleInputEvent.x");
6342
6341
  assertValidNumber(y, "UIInputDummy.handleInputEvent.y");
6343
6342
  assertValidNumber(identifier, "UIInputDummy.handleInputEvent.identifier");
6344
6343
  const isPointerInside = this.interactionArea.contains(MathUtils.mapLinear(x, this.x, this.oppositeX, 0, 1), MathUtils.mapLinear(y, this.y, this.oppositeY, 0, 1));
6345
6344
  if (isPointerInside) {
6346
- this.emit(inputEvent, x, y, identifier, this);
6345
+ signal.emit({ x, y, identifier, element: this });
6347
6346
  }
6348
6347
  if (this._private_wasPointerInside && !isPointerInside) {
6349
- this.emit(UIInputEvent.LEFT, x, y, identifier, this);
6348
+ this._private_signalLeftInternal.emit({ x, y, identifier, element: this });
6350
6349
  }
6351
6350
  else if (!this._private_wasPointerInside && isPointerInside) {
6352
- this.emit(UIInputEvent.ENTERED, x, y, identifier, this);
6351
+ this._private_signalEnteredInternal.emit({ x, y, identifier, element: this });
6353
6352
  }
6354
6353
  this._private_wasPointerInside = isPointerInside;
6355
- return (this.modeInternal !== UIMode.INTERACTIVE_TRANSPARENT && isPointerInside);
6354
+ return this.modeInternal !== UIMode.INTERACTIVE_TRANSPARENT && isPointerInside;
6356
6355
  }
6357
6356
  }
6358
6357
 
@@ -6372,12 +6371,15 @@ class UIElement extends UIInputDummy {
6372
6371
  super(layer, options);
6373
6372
  this._private_transparencyModeDirty = false;
6374
6373
  this._private_visibilityDirty = false;
6374
+ this._private_handleWillRender = (renderer, deltaTime) => {
6375
+ this.onWillRender(renderer, deltaTime);
6376
+ };
6375
6377
  this.micro = new UIMicro(options?.micro);
6376
6378
  this._private_transparencyModeInternal =
6377
6379
  options?.transparencyMode ?? ELEMENT_DEFAULT_TRANSPARENCY_MODE;
6378
6380
  this.sceneWrapper = this.layer.sceneWrapper;
6379
6381
  this.planeHandler = this.sceneWrapper.createPlane(source, properties, new Matrix4().identity(), isUIModeVisible(options?.mode ?? this.mode), this._private_transparencyModeInternal);
6380
- this.layer.on(UILayerEvent.RENDERING, this.onWillRender, this);
6382
+ this.layer.signalRendering.on(this._private_handleWillRender);
6381
6383
  }
6382
6384
  /** Alpha blending mode */
6383
6385
  get transparencyMode() {
@@ -6399,7 +6401,7 @@ class UIElement extends UIInputDummy {
6399
6401
  }
6400
6402
  /** Removes element and frees resources */
6401
6403
  destroy() {
6402
- this.layer.off(UILayerEvent.RENDERING, this.onWillRender, this);
6404
+ this.layer.signalRendering.off(this._private_handleWillRender);
6403
6405
  this.sceneWrapper.destroyPlane(this.planeHandler);
6404
6406
  super.destroy();
6405
6407
  }
@@ -6425,16 +6427,6 @@ class UIElement extends UIInputDummy {
6425
6427
  }
6426
6428
  }
6427
6429
 
6428
- /** Animation playback events */
6429
- var UIAnimatedImageEvent;
6430
- (function (UIAnimatedImageEvent) {
6431
- /** Animation started or resumed */
6432
- UIAnimatedImageEvent[UIAnimatedImageEvent["PLAYED"] = 0] = "PLAYED";
6433
- /** Animation paused */
6434
- UIAnimatedImageEvent[UIAnimatedImageEvent["PAUSED"] = 1] = "PAUSED";
6435
- /** Animation stopped and reset */
6436
- UIAnimatedImageEvent[UIAnimatedImageEvent["STOPPED"] = 2] = "STOPPED";
6437
- })(UIAnimatedImageEvent || (UIAnimatedImageEvent = {}));
6438
6430
  /** Animation loop behavior */
6439
6431
  var UIAnimatedImageLoopMode;
6440
6432
  (function (UIAnimatedImageLoopMode) {
@@ -6476,6 +6468,9 @@ class UIAnimatedImage extends UIElement {
6476
6468
  this._private_sequenceFrameIndex = 0;
6477
6469
  this._private_currentFrameIndexDirty = false;
6478
6470
  this._private_accumulatedTime = 0;
6471
+ this._private_signalPlayedInternal = new t();
6472
+ this._private_signalPausedInternal = new t();
6473
+ this._private_signalStoppedInternal = new t();
6479
6474
  this._private_onTextureDimensionsChanged = (width, height, texture) => {
6480
6475
  if (this._private_sequenceInternal[this._private_sequenceFrameIndex] === texture) {
6481
6476
  this.width = width;
@@ -6485,12 +6480,9 @@ class UIAnimatedImage extends UIElement {
6485
6480
  this._private_colorInternal = color;
6486
6481
  this._private_sequenceInternal = uiTextures;
6487
6482
  this._private_textureTransform = textureTransform;
6488
- this._private_frameRateInternal =
6489
- options.frameRate ?? ANIMATED_IMAGE_DEFAULT_FRAME_RATE;
6490
- this._private_timeScaleInternal =
6491
- options.timeScale ?? ANIMATED_IMAGE_DEFAULT_TIME_SCALE;
6492
- this._private_loopModeInternal =
6493
- options.loopMode ?? ANIMATED_IMAGE_DEFAULT_LOOP_MODE;
6483
+ this._private_frameRateInternal = options.frameRate ?? ANIMATED_IMAGE_DEFAULT_FRAME_RATE;
6484
+ this._private_timeScaleInternal = options.timeScale ?? ANIMATED_IMAGE_DEFAULT_TIME_SCALE;
6485
+ this._private_loopModeInternal = options.loopMode ?? ANIMATED_IMAGE_DEFAULT_LOOP_MODE;
6494
6486
  this._private_subscribeSequenceEvents();
6495
6487
  if (options.playByDefault === true) {
6496
6488
  this.play();
@@ -6520,6 +6512,18 @@ class UIAnimatedImage extends UIElement {
6520
6512
  get timeScale() {
6521
6513
  return this._private_timeScaleInternal;
6522
6514
  }
6515
+ /** Signal fired when animation starts or resumes */
6516
+ get signalPlayed() {
6517
+ return this._private_signalPlayedInternal;
6518
+ }
6519
+ /** Signal fired when animation pauses */
6520
+ get signalPaused() {
6521
+ return this._private_signalPausedInternal;
6522
+ }
6523
+ /** Signal fired when animation stops and resets */
6524
+ get signalStopped() {
6525
+ return this._private_signalStoppedInternal;
6526
+ }
6523
6527
  /** Multiplicative tint. Alpha channel controls opacity. */
6524
6528
  set color(value) {
6525
6529
  this._private_colorInternal.set(value);
@@ -6566,26 +6570,24 @@ class UIAnimatedImage extends UIElement {
6566
6570
  play() {
6567
6571
  if (!this._private_isPlaying) {
6568
6572
  this._private_isPlaying = true;
6569
- this.emit(UIAnimatedImageEvent.PLAYED);
6573
+ this._private_signalPlayedInternal.emit();
6570
6574
  }
6571
6575
  }
6572
6576
  /** Pauses animation at current frame */
6573
6577
  pause() {
6574
6578
  if (this._private_isPlaying) {
6575
6579
  this._private_isPlaying = false;
6576
- this.emit(UIAnimatedImageEvent.PAUSED);
6580
+ this._private_signalPausedInternal.emit();
6577
6581
  }
6578
6582
  }
6579
6583
  /** Stops animation and resets to first frame */
6580
6584
  stop() {
6581
- if (this._private_isPlaying ||
6582
- this._private_accumulatedTime > 0 ||
6583
- this._private_sequenceFrameIndex > 0) {
6585
+ if (this._private_isPlaying || this._private_accumulatedTime > 0 || this._private_sequenceFrameIndex > 0) {
6584
6586
  this._private_isPlaying = false;
6585
6587
  this._private_accumulatedTime = 0;
6586
6588
  this._private_sequenceFrameIndex = 0;
6587
6589
  this._private_currentFrameIndexDirty = true;
6588
- this.emit(UIAnimatedImageEvent.STOPPED);
6590
+ this._private_signalStoppedInternal.emit();
6589
6591
  }
6590
6592
  }
6591
6593
  onWillRender(renderer, deltaTime) {
@@ -6609,7 +6611,7 @@ class UIAnimatedImage extends UIElement {
6609
6611
  else {
6610
6612
  this._private_sequenceFrameIndex = lastFrameIndex;
6611
6613
  this._private_isPlaying = false;
6612
- this.emit(UIAnimatedImageEvent.PAUSED);
6614
+ this._private_signalPausedInternal.emit();
6613
6615
  break;
6614
6616
  }
6615
6617
  }
@@ -6631,7 +6633,7 @@ class UIAnimatedImage extends UIElement {
6631
6633
  else {
6632
6634
  this._private_sequenceFrameIndex = 0;
6633
6635
  this._private_isPlaying = false;
6634
- this.emit(UIAnimatedImageEvent.PAUSED);
6636
+ this._private_signalPausedInternal.emit();
6635
6637
  break;
6636
6638
  }
6637
6639
  }
@@ -6678,12 +6680,12 @@ class UIAnimatedImage extends UIElement {
6678
6680
  }
6679
6681
  _private_subscribeSequenceEvents() {
6680
6682
  for (const frame of this._private_sequenceInternal) {
6681
- frame.on(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
6683
+ frame.signalDiminsionsChanged.on(this._private_onTextureDimensionsChanged);
6682
6684
  }
6683
6685
  }
6684
6686
  _private_unsubscribeSequenceEvents() {
6685
6687
  for (const frame of this._private_sequenceInternal) {
6686
- frame.off(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
6688
+ frame.signalDiminsionsChanged.off(this._private_onTextureDimensionsChanged);
6687
6689
  }
6688
6690
  }
6689
6691
  }
@@ -6872,7 +6874,7 @@ class UIImage extends UIElement {
6872
6874
  this.texture = textureView;
6873
6875
  this._private_textureTransform = textureTransform;
6874
6876
  this._private_colorInternal = color;
6875
- this.texture.on(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
6877
+ this.texture.signalDiminsionsChanged.on(this._private_onTextureDimensionsChanged);
6876
6878
  }
6877
6879
  /** Multiplicative tint. Alpha channel controls opacity. */
6878
6880
  get color() {
@@ -6884,7 +6886,7 @@ class UIImage extends UIElement {
6884
6886
  }
6885
6887
  /** Removes image and frees resources */
6886
6888
  destroy() {
6887
- this.texture.off(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
6889
+ this.texture.signalDiminsionsChanged.off(this._private_onTextureDimensionsChanged);
6888
6890
  super.destroy();
6889
6891
  }
6890
6892
  setPlaneTransform() {
@@ -7201,7 +7203,7 @@ class UINineSlice extends UIElement {
7201
7203
  this._private_sliceRegionsVector = sliceRegionsVector;
7202
7204
  this._private_lastElementWidth = this.width;
7203
7205
  this._private_lastElementHeight = this.height;
7204
- this.texture.on(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
7206
+ this.texture.signalDiminsionsChanged.on(this._private_onTextureDimensionsChanged);
7205
7207
  }
7206
7208
  /** Multiplicative tint. Alpha channel controls opacity. */
7207
7209
  get color() {
@@ -7240,14 +7242,12 @@ class UINineSlice extends UIElement {
7240
7242
  }
7241
7243
  /** Removes nine slice and frees resources */
7242
7244
  destroy() {
7243
- this.texture.off(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
7245
+ this.texture.signalDiminsionsChanged.off(this._private_onTextureDimensionsChanged);
7244
7246
  super.destroy();
7245
7247
  }
7246
7248
  setPlaneTransform() {
7247
7249
  let properties;
7248
- const sliceBordersDirty = this._private_textureDimensionsDirty ||
7249
- this._private_sliceBordersInternal.dirty ||
7250
- this.texture.trimDirty;
7250
+ const sliceBordersDirty = this._private_textureDimensionsDirty || this._private_sliceBordersInternal.dirty || this.texture.trimDirty;
7251
7251
  if (sliceBordersDirty) {
7252
7252
  properties ?? (properties = {});
7253
7253
  properties["sliceBorders"] = this._private_calculateSliceBordersForShader(this._private_sliceBordersVector);
@@ -7447,7 +7447,7 @@ class UIProgress extends UIElement {
7447
7447
  this._private_colorInternal = color;
7448
7448
  this._private_progressInternal = progress;
7449
7449
  this._private_maskFunctionInternal = maskFunction;
7450
- this.texture.on(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
7450
+ this.texture.signalDiminsionsChanged.on(this._private_onTextureDimensionsChanged);
7451
7451
  }
7452
7452
  /** Multiplicative tint. Alpha channel controls opacity. */
7453
7453
  get color() {
@@ -7949,18 +7949,14 @@ class UITextStyle {
7949
7949
  * @returns Complete style configuration with all defaults applied
7950
7950
  */
7951
7951
  static resolve(primary, fallback) {
7952
- const fontSize = primary._private_fontSizeInternal ?? fallback._private_fontSizeInternal ??
7953
- TEXT_STYLE_DEFAULT_FONT_SIZE;
7952
+ const fontSize = primary._private_fontSizeInternal ?? fallback._private_fontSizeInternal ?? TEXT_STYLE_DEFAULT_FONT_SIZE;
7954
7953
  return {
7955
- color: primary._private_colorInternal ?? fallback._private_colorInternal ??
7956
- TEXT_STYLE_DEFAULT_COLOR,
7957
- align: primary._private_alignInternal ?? fallback._private_alignInternal ??
7958
- TEXT_STYLE_DEFAULT_ALIGN,
7954
+ color: primary._private_colorInternal ?? fallback._private_colorInternal ?? TEXT_STYLE_DEFAULT_COLOR,
7955
+ align: primary._private_alignInternal ?? fallback._private_alignInternal ?? TEXT_STYLE_DEFAULT_ALIGN,
7959
7956
  fontFamily: primary._private_fontFamilyInternal ?? fallback._private_fontFamilyInternal ??
7960
7957
  TEXT_STYLE_DEFAULT_FONT_FAMILY,
7961
7958
  fontSize,
7962
- fontStyle: primary._private_fontStyleInternal ?? fallback._private_fontStyleInternal ??
7963
- TEXT_STYLE_DEFAULT_FONT_STYLE,
7959
+ fontStyle: primary._private_fontStyleInternal ?? fallback._private_fontStyleInternal ?? TEXT_STYLE_DEFAULT_FONT_STYLE,
7964
7960
  fontWeight: primary._private_fontWeightInternal ?? fallback._private_fontWeightInternal ??
7965
7961
  TEXT_STYLE_DEFAULT_FONT_WEIGHT,
7966
7962
  lineHeight: primary._private_lineHeightInternal ?? fallback._private_lineHeightInternal ??
@@ -7995,8 +7991,7 @@ class UITextStyle {
7995
7991
  this._private_fontSizeInternal !== TEXT_STYLE_DEFAULT_FONT_SIZE ||
7996
7992
  this._private_fontStyleInternal !== TEXT_STYLE_DEFAULT_FONT_STYLE ||
7997
7993
  this._private_fontWeightInternal !== TEXT_STYLE_DEFAULT_FONT_WEIGHT ||
7998
- this._private_lineHeightInternal !==
7999
- TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT ||
7994
+ this._private_lineHeightInternal !== TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT ||
8000
7995
  this._private_enableShadowInternal !== TEXT_STYLE_DEFAULT_ENABLE_SHADOW ||
8001
7996
  this._private_shadowOffsetXInternal !== TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X ||
8002
7997
  this._private_shadowOffsetYInternal !== TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y ||
@@ -8011,8 +8006,7 @@ class UITextStyle {
8011
8006
  this._private_fontSizeInternal = TEXT_STYLE_DEFAULT_FONT_SIZE;
8012
8007
  this._private_fontStyleInternal = TEXT_STYLE_DEFAULT_FONT_STYLE;
8013
8008
  this._private_fontWeightInternal = TEXT_STYLE_DEFAULT_FONT_WEIGHT;
8014
- this._private_lineHeightInternal =
8015
- TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT;
8009
+ this._private_lineHeightInternal = TEXT_STYLE_DEFAULT_FONT_SIZE * TEXT_STYLE_DEFAULT_LINE_HEIGHT;
8016
8010
  this._private_enableShadowInternal = TEXT_STYLE_DEFAULT_ENABLE_SHADOW;
8017
8011
  this._private_shadowOffsetXInternal = TEXT_STYLE_DEFAULT_SHADOW_OFFSET_X;
8018
8012
  this._private_shadowOffsetYInternal = TEXT_STYLE_DEFAULT_SHADOW_OFFSET_Y;
@@ -8226,8 +8220,7 @@ function buildTextLines(maxWidth, textChunks) {
8226
8220
  currentLineHeight = 0;
8227
8221
  continue;
8228
8222
  }
8229
- if (currentLine.length === 0 ||
8230
- currentWidth + textChunk.metrics.width <= maxWidth) {
8223
+ if (currentLine.length === 0 || currentWidth + textChunk.metrics.width <= maxWidth) {
8231
8224
  currentLine.push(textChunk);
8232
8225
  currentWidth += textChunk.metrics.width;
8233
8226
  currentHeight = Math.max(currentHeight, textChunk.metrics.height);
@@ -8401,8 +8394,7 @@ class UIText extends UIElement {
8401
8394
  this._private_colorInternal = color;
8402
8395
  this._private_paddingInternal = new UIInsets(options.padding);
8403
8396
  this.commonStyle = new UITextStyle(options.commonStyle);
8404
- this._private_maxLineWidthInternal =
8405
- options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
8397
+ this._private_maxLineWidthInternal = options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
8406
8398
  this._private_resizeModeInternal = options.resizeMode ?? TEXT_DEFAULT_RESIZE_MODE;
8407
8399
  this._private_canvas = canvas;
8408
8400
  this._private_context = context;
@@ -8450,9 +8442,7 @@ class UIText extends UIElement {
8450
8442
  set content(value) {
8451
8443
  if (this._private_contentInternal !== value) {
8452
8444
  if (typeof value === "string") {
8453
- this._private_contentInternal = [
8454
- new UITextSpan({ text: value, style: new UITextStyle() }),
8455
- ];
8445
+ this._private_contentInternal = [new UITextSpan({ text: value, style: new UITextStyle() })];
8456
8446
  }
8457
8447
  else if (Array.isArray(value)) {
8458
8448
  this._private_contentInternal = value.map((span) => typeof span === "string"
@@ -8514,8 +8504,7 @@ class UIText extends UIElement {
8514
8504
  !this._private_maxLineWidthDirty &&
8515
8505
  !this._private_paddingInternal.dirty &&
8516
8506
  !(this.solverWrapper.dirty &&
8517
- this._private_lastWidth / this._private_lastHeight !==
8518
- Math.round(this.width) / Math.round(this.height)) &&
8507
+ this._private_lastWidth / this._private_lastHeight !== Math.round(this.width) / Math.round(this.height)) &&
8519
8508
  !this._private_checkContentDirty()) {
8520
8509
  return;
8521
8510
  }
@@ -8608,15 +8597,14 @@ class UIText extends UIElement {
8608
8597
  }
8609
8598
  _private_checkDimensionsDirty() {
8610
8599
  return (this.solverWrapper.dirty &&
8611
- (this._private_lastWidth !== Math.round(this.width) ||
8612
- this._private_lastHeight !== Math.round(this.height)));
8600
+ (this._private_lastWidth !== Math.round(this.width) || this._private_lastHeight !== Math.round(this.height)));
8613
8601
  }
8614
8602
  _private_setDimensionsDirtyFalse() {
8615
8603
  this._private_lastWidth = Math.round(this.width);
8616
8604
  this._private_lastHeight = Math.round(this.height);
8617
8605
  }
8618
8606
  _private_checkContentDirty() {
8619
- return (this._private_contentDirty || this.content.some((span) => span.dirty));
8607
+ return this._private_contentDirty || this.content.some((span) => span.dirty);
8620
8608
  }
8621
8609
  _private_setContentDirtyFalse() {
8622
8610
  this._private_contentDirty = false;
@@ -8656,6 +8644,9 @@ class UIFullscreenLayer extends UILayer {
8656
8644
  ...options,
8657
8645
  });
8658
8646
  this._private_resizePolicyDirty = false;
8647
+ this._private_signalPressedInternal = new s();
8648
+ this._private_signalMovedInternal = new s();
8649
+ this._private_signalReleasedInternal = new s();
8659
8650
  this._private_onResize = () => {
8660
8651
  const scale = this.resizePolicy.calculateScale(window.innerWidth, window.innerHeight);
8661
8652
  this.resizePolicy.dirty = false;
@@ -8663,13 +8654,13 @@ class UIFullscreenLayer extends UILayer {
8663
8654
  this.resizeInternal(window.innerWidth * scale, window.innerHeight * scale);
8664
8655
  };
8665
8656
  this._private_onPointerDown = (event) => {
8666
- this._private_handleWindowInput(event, "onPointerDown", UIInputEvent.PRESSED);
8657
+ this._private_handleWindowInput(event, "onPointerDown", this._private_signalPressedInternal);
8667
8658
  };
8668
8659
  this._private_onPointerMove = (event) => {
8669
- this._private_handleWindowInput(event, "onPointerMove", UIInputEvent.MOVED);
8660
+ this._private_handleWindowInput(event, "onPointerMove", this._private_signalMovedInternal);
8670
8661
  };
8671
8662
  this._private_onPointerUp = (event) => {
8672
- this._private_handleWindowInput(event, "onPointerUp", UIInputEvent.RELEASED);
8663
+ this._private_handleWindowInput(event, "onPointerUp", this._private_signalReleasedInternal);
8673
8664
  };
8674
8665
  this._private_resizePolicyInternal = resizePolicy;
8675
8666
  window.addEventListener("resize", this._private_onResize);
@@ -8681,6 +8672,18 @@ class UIFullscreenLayer extends UILayer {
8681
8672
  get resizePolicy() {
8682
8673
  return this._private_resizePolicyInternal;
8683
8674
  }
8675
+ /** Signal fired when pointer is pressed */
8676
+ get signalPressed() {
8677
+ return this._private_signalPressedInternal;
8678
+ }
8679
+ /** Signal fired when pointer is moved */
8680
+ get signalMoved() {
8681
+ return this._private_signalMovedInternal;
8682
+ }
8683
+ /** Signal fired when pointer is released */
8684
+ get signalReleased() {
8685
+ return this._private_signalReleasedInternal;
8686
+ }
8684
8687
  /** Updates resize policy */
8685
8688
  set resizePolicy(value) {
8686
8689
  if (this._private_resizePolicyInternal !== value) {
@@ -8746,19 +8749,20 @@ class UIFullscreenLayer extends UILayer {
8746
8749
  const direction = far.sub(near).normalize();
8747
8750
  return result.set(near, direction);
8748
8751
  }
8749
- _private_handleWindowInput(event, pointerFunctionName, inputEvent) {
8750
- const rect = event.target instanceof HTMLElement
8751
- ? event.target.getBoundingClientRect()
8752
- : null;
8752
+ _private_handleWindowInput(event, pointerFunctionName, signal) {
8753
+ const rect = event.target instanceof HTMLElement ? event.target.getBoundingClientRect() : null;
8753
8754
  const x = rect ? event.clientX - rect.left : event.clientX;
8754
- const y = rect
8755
- ? rect.bottom - event.clientY
8756
- : window.innerHeight - event.clientY;
8755
+ const y = rect ? rect.bottom - event.clientY : window.innerHeight - event.clientY;
8757
8756
  const scale = this.resizePolicy.calculateScale(window.innerWidth, window.innerHeight);
8758
8757
  const scaledX = x * scale;
8759
8758
  const scaledY = y * scale;
8760
8759
  if (isUIModeInteractive(this.mode)) {
8761
- this.emit(inputEvent, scaledX, scaledY, event.pointerId);
8760
+ signal.emit({
8761
+ x: scaledX,
8762
+ y: scaledY,
8763
+ identifier: event.pointerId,
8764
+ layer: this,
8765
+ });
8762
8766
  this.inputWrapperInternal[pointerFunctionName](scaledX, scaledY, event.pointerId);
8763
8767
  }
8764
8768
  }
@@ -8820,10 +8824,7 @@ class UIAreaPolygon extends UIArea {
8820
8824
  const previousX = previousVertex.x;
8821
8825
  const previousY = previousVertex.y;
8822
8826
  if (currentY > pointY !== previousY > pointY &&
8823
- pointX <
8824
- ((previousX - currentX) * (pointY - currentY)) /
8825
- (previousY - currentY) +
8826
- currentX) {
8827
+ pointX < ((previousX - currentX) * (pointY - currentY)) / (previousY - currentY) + currentX) {
8827
8828
  inside = !inside;
8828
8829
  }
8829
8830
  }
@@ -9231,5 +9232,5 @@ class UIResizePolicyFixedWidth extends UIResizePolicy {
9231
9232
  }
9232
9233
  }
9233
9234
 
9234
- export { UIAnchor, UIAnimatedImage, UIAnimatedImageLoopMode, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint, UIExpression, UIFitConstraintBuilder, UIFullscreenLayer, UIGraphics, UIHeightConstraint, UIHorizontalDistanceConstraint, UIHorizontalInterpolationConstraint, UIHorizontalProportionConstraint, UIImage, UIInputDummy, UIInputEvent, UIMicro, UIMicroAnchorMode, UIMode, UINineSlice, UINineSliceRegionMode, UIOrientation, UIPriority, UIProgress, UIProgressMaskFunctionCircular, UIProgressMaskFunctionDirectional, UIRelation, UIResizePolicyCover, UIResizePolicyCross, UIResizePolicyCrossInverted, UIResizePolicyFit, UIResizePolicyFixedHeight, UIResizePolicyFixedWidth, UIResizePolicyNone, UIScene, UISceneUpdateMode, UISingleParameterConstraint, UIText, UITextResizeMode, UITransparencyMode, UIVerticalDistanceConstraint, UIVerticalInterpolationConstraint, UIVerticalProportionConstraint, UIWidthConstraint };
9235
+ export { UIAnchor, UIAnimatedImage, UIAnimatedImageLoopMode, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint, UIExpression, UIFitConstraintBuilder, UIFullscreenLayer, UIGraphics, UIHeightConstraint, UIHorizontalDistanceConstraint, UIHorizontalInterpolationConstraint, UIHorizontalProportionConstraint, UIImage, UIInputDummy, UIMicro, UIMicroAnchorMode, UIMode, UINineSlice, UINineSliceRegionMode, UIOrientation, UIPriority, UIProgress, UIProgressMaskFunctionCircular, UIProgressMaskFunctionDirectional, UIRelation, UIResizePolicyCover, UIResizePolicyCross, UIResizePolicyCrossInverted, UIResizePolicyFit, UIResizePolicyFixedHeight, UIResizePolicyFixedWidth, UIResizePolicyNone, UIScene, UISceneUpdateMode, UISingleParameterConstraint, UIText, UITextResizeMode, UITransparencyMode, UIVerticalDistanceConstraint, UIVerticalInterpolationConstraint, UIVerticalProportionConstraint, UIWidthConstraint };
9235
9236
  //# sourceMappingURL=index.js.map