laymur 0.11.2 → 0.11.4

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.
Files changed (35) hide show
  1. package/README.md +0 -1
  2. package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +1 -1
  3. package/dist/elements/{UIAnchor.d.ts → UIAnchor/UIAnchor.d.ts} +3 -3
  4. package/dist/elements/{UIAnimatedImage.Internal.d.ts → UIAnimatedImage/UIAnimatedImage.Internal.d.ts} +2 -2
  5. package/dist/elements/{UIAnimatedImage.d.ts → UIAnimatedImage/UIAnimatedImage.d.ts} +6 -6
  6. package/dist/elements/UIElement/UIElement.Internal.d.ts +11 -0
  7. package/dist/elements/{UIElement.d.ts → UIElement/UIElement.d.ts} +9 -9
  8. package/dist/elements/UIGraphics/UIGraphics.Internal.d.ts +9 -0
  9. package/dist/elements/{UIGraphics.d.ts → UIGraphics/UIGraphics.d.ts} +4 -4
  10. package/dist/elements/UIImage/UIImage.Internal.d.ts +9 -0
  11. package/dist/elements/{UIImage.d.ts → UIImage/UIImage.d.ts} +7 -7
  12. package/dist/elements/{UIDummy.Internal.d.ts → UIInputDummy/UIInputDummy.Internal.d.ts} +5 -5
  13. package/dist/elements/{UIDummy.d.ts → UIInputDummy/UIInputDummy.d.ts} +11 -11
  14. package/dist/elements/{UINineSlice.Internal.d.ts → UINineSlice/UINineSlice.Internal.d.ts} +5 -5
  15. package/dist/elements/{UINineSlice.d.ts → UINineSlice/UINineSlice.d.ts} +9 -9
  16. package/dist/elements/{UIProgress.Internal.d.ts → UIProgress/UIProgress.Internal.d.ts} +5 -3
  17. package/dist/elements/{UIProgress.d.ts → UIProgress/UIProgress.d.ts} +8 -7
  18. package/dist/elements/{UIScene.Internal.d.ts → UIScene/UIScene.Internal.d.ts} +3 -3
  19. package/dist/elements/{UIScene.d.ts → UIScene/UIScene.d.ts} +3 -3
  20. package/dist/elements/UIText/UIText.Internal.d.ts +3 -3
  21. package/dist/elements/UIText/UIText.d.ts +3 -3
  22. package/dist/index.d.ts +10 -10
  23. package/dist/index.js +293 -179
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.min.js +1 -1
  26. package/dist/index.min.js.map +1 -1
  27. package/dist/miscellaneous/insets/UIInsets.Internal.d.ts +11 -0
  28. package/dist/miscellaneous/{padding/UIPadding.d.ts → insets/UIInsets.d.ts} +15 -15
  29. package/dist/miscellaneous/texture/UITextureView.d.ts +13 -9
  30. package/package.json +1 -1
  31. package/dist/elements/UIElement.Internal.d.ts +0 -11
  32. package/dist/elements/UIGraphics.Internal.d.ts +0 -7
  33. package/dist/elements/UIImage.Internal.d.ts +0 -7
  34. package/dist/miscellaneous/padding/UIPadding.Internal.d.ts +0 -11
  35. /package/dist/elements/{UIAnchor.Internal.d.ts → UIAnchor/UIAnchor.Internal.d.ts} +0 -0
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Color, Vector4, Texture, Vector2, Vector3, Matrix3, Matrix4, PlaneGeometry, InstancedBufferGeometry, ShaderMaterial, InstancedBufferAttribute, Mesh, Scene, OrthographicCamera, Quaternion, MathUtils, CanvasTexture, LinearFilter, WebGLRenderTarget, UnsignedByteType, RGBAFormat, PerspectiveCamera, Ray } from 'three';
1
+ import { Color, Vector4, Texture, Vector2, Vector3, Matrix3, Matrix4, PlaneGeometry, InstancedBufferGeometry, ShaderMaterial, InstancedBufferAttribute, Mesh, Scene, OrthographicCamera, Quaternion, MathUtils, CanvasTexture, SRGBColorSpace, LinearFilter, WebGLRenderTarget, UnsignedByteType, RGBAFormat, PerspectiveCamera, Ray } from 'three';
2
2
 
3
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;t<o.length;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(e<10||o[0].M===o[n].M)for(let t=1;t<n;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(;e<=n;){const i=e+n>>>1;o[i].M<t?e=i+1:n=i-1;}const c=e;for(n=o.length-1;e<=n;){const i=e+n>>>1;o[i].M<=t?e=i+1:n=i-1;}const h=n;for(let t=c;t<=h;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;t<s.length;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;t<n.length;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||t[t.length-1].M<=i)return void t.push(c);if(t[0].M>=i)return void t.unshift(c);{let r=0,s=t.length;for(;r<s;){const o=r+s>>>1;t[o].M<i?r=o+1:s=o;}t.splice(r,0,c);}}}}
4
4
 
@@ -4955,19 +4955,21 @@ class UITextureView extends i {
4955
4955
  constructor(config) {
4956
4956
  super();
4957
4957
  this._private_textureInternal = TEXTURE_DEFAULT_TEXTURE;
4958
- this._private_rotatedInternal = false;
4958
+ this._private_sourceWidth = TEXTURE_DEFAULT_SIZE;
4959
+ this._private_sourceHeight = TEXTURE_DEFAULT_SIZE;
4959
4960
  this._private_frameX = 0;
4960
4961
  this._private_frameY = 0;
4961
4962
  this._private_frameWidth = TEXTURE_DEFAULT_SIZE;
4962
4963
  this._private_frameHeight = TEXTURE_DEFAULT_SIZE;
4963
- this._private_sourceWidth = TEXTURE_DEFAULT_SIZE;
4964
- this._private_sourceHeight = TEXTURE_DEFAULT_SIZE;
4964
+ this._private_rotatedInternal = false;
4965
+ this._private_scaleInternal = 1;
4965
4966
  this._private_trimLeft = 0;
4966
4967
  this._private_trimRight = 0;
4967
4968
  this._private_trimTop = 0;
4968
4969
  this._private_trimBottom = 0;
4969
- this._private_scaleInternal = 1;
4970
- this._private_dirtyInternal = false;
4970
+ this._private_textureDirtyInternal = false;
4971
+ this._private_uvTransformDirtyInternal = false;
4972
+ this._private_trimDirtyInternal = false;
4971
4973
  if (config !== undefined) {
4972
4974
  this.set(config);
4973
4975
  }
@@ -5012,13 +5014,27 @@ class UITextureView extends i {
5012
5014
  bottom: this._private_trimBottom / s,
5013
5015
  };
5014
5016
  }
5015
- /** Whether texture has been modified since last check */
5016
- get dirty() {
5017
- return this._private_dirtyInternal;
5017
+ get textureDirty() {
5018
+ return this._private_textureDirtyInternal;
5018
5019
  }
5019
- /** Marks texture as clean. @internal */
5020
- setDirtyFalse() {
5021
- this._private_dirtyInternal = false;
5020
+ /** Whether UV transform inputs changed since last check */
5021
+ get uvTransformDirty() {
5022
+ return this._private_uvTransformDirtyInternal;
5023
+ }
5024
+ /** Whether trim values changed since last check */
5025
+ get trimDirty() {
5026
+ return this._private_trimDirtyInternal;
5027
+ }
5028
+ setTextureDirtyFalse() {
5029
+ this._private_textureDirtyInternal = false;
5030
+ }
5031
+ /** Marks UV transform as clean. @internal */
5032
+ setUVTransformDirtyFalse() {
5033
+ this._private_uvTransformDirtyInternal = false;
5034
+ }
5035
+ /** Marks trim as clean. @internal */
5036
+ setTrimDirtyFalse() {
5037
+ this._private_trimDirtyInternal = false;
5022
5038
  }
5023
5039
  /**
5024
5040
  * Calculates UV transform matrix for shader sampling.
@@ -5059,91 +5075,94 @@ class UITextureView extends i {
5059
5075
  * @param config Texture or atlas configuration
5060
5076
  */
5061
5077
  set(config) {
5062
- const previousWidth = this.width;
5063
- const previousHeight = this.height;
5078
+ const lastWidth = this.width;
5079
+ const lastHeight = this.height;
5064
5080
  if (config instanceof Texture) {
5065
5081
  this._private_setFromTexture(config);
5066
5082
  }
5067
5083
  else {
5068
5084
  this._private_setFromAtlasConfig(config);
5069
5085
  }
5070
- this._private_dirtyInternal = true;
5071
- if (this.width !== previousWidth || this.height !== previousHeight) {
5086
+ if (this.width !== lastWidth || this.height !== lastHeight) {
5072
5087
  this.emit(UITextureViewEvent.DIMENSIONS_CHANGED, this.width, this.height, this);
5073
5088
  }
5074
5089
  }
5075
- /** Resets to default empty texture */
5076
- reset() {
5077
- const previousWidth = this.width;
5078
- const previousHeight = this.height;
5079
- this._private_textureInternal = new Texture();
5080
- this._private_frameX = 0;
5081
- this._private_frameY = 0;
5082
- this._private_frameWidth = TEXTURE_DEFAULT_SIZE;
5083
- this._private_frameHeight = TEXTURE_DEFAULT_SIZE;
5084
- this._private_rotatedInternal = false;
5085
- this._private_sourceWidth = TEXTURE_DEFAULT_SIZE;
5086
- this._private_sourceHeight = TEXTURE_DEFAULT_SIZE;
5087
- this._private_trimLeft = 0;
5088
- this._private_trimRight = 0;
5089
- this._private_trimTop = 0;
5090
- this._private_trimBottom = 0;
5091
- this._private_scaleInternal = 1;
5092
- this._private_dirtyInternal = true;
5093
- if (this.width !== previousWidth || this.height !== previousHeight) {
5094
- this.emit(UITextureViewEvent.DIMENSIONS_CHANGED, this.width, this.height);
5095
- }
5096
- }
5097
5090
  _private_setFromTexture(texture) {
5098
5091
  const width = texture.image?.naturalWidth ?? TEXTURE_DEFAULT_SIZE;
5099
5092
  const height = texture.image?.naturalHeight ?? TEXTURE_DEFAULT_SIZE;
5100
- this._private_textureInternal = texture;
5101
- this._private_frameX = 0;
5102
- this._private_frameY = 0;
5103
- this._private_frameWidth = width;
5104
- this._private_frameHeight = height;
5105
- this._private_rotatedInternal = false;
5106
5093
  this._private_sourceWidth = width;
5107
5094
  this._private_sourceHeight = height;
5108
- this._private_trimLeft = 0;
5109
- this._private_trimRight = 0;
5110
- this._private_trimTop = 0;
5111
- this._private_trimBottom = 0;
5112
- this._private_scaleInternal = 1;
5095
+ if (this.texture !== texture) {
5096
+ this._private_textureInternal = texture;
5097
+ this._private_textureDirtyInternal = true;
5098
+ }
5099
+ if (this._private_frameX !== 0 ||
5100
+ this._private_frameY !== 0 ||
5101
+ this._private_frameWidth !== width ||
5102
+ this._private_frameHeight !== height ||
5103
+ this._private_scaleInternal !== 1 || this._private_rotatedInternal) {
5104
+ this._private_frameX = 0;
5105
+ this._private_frameY = 0;
5106
+ this._private_frameWidth = width;
5107
+ this._private_frameHeight = height;
5108
+ this._private_rotatedInternal = false;
5109
+ this._private_scaleInternal = 1;
5110
+ this._private_uvTransformDirtyInternal = true;
5111
+ }
5112
+ if (this._private_trimLeft !== 0 ||
5113
+ this._private_trimRight !== 0 ||
5114
+ this._private_trimTop !== 0 ||
5115
+ this._private_trimBottom !== 0) {
5116
+ this._private_trimLeft = 0;
5117
+ this._private_trimRight = 0;
5118
+ this._private_trimTop = 0;
5119
+ this._private_trimBottom = 0;
5120
+ this._private_trimDirtyInternal = true;
5121
+ }
5113
5122
  }
5114
5123
  _private_setFromAtlasConfig(config) {
5115
- this._private_textureInternal = config.texture;
5116
- this._private_frameX = config.frame.x;
5117
- this._private_frameY = config.frame.y;
5118
- this._private_frameWidth = config.frame.w;
5119
- this._private_frameHeight = config.frame.h;
5120
- this._private_rotatedInternal = config.rotated ?? false;
5121
5124
  this._private_sourceWidth = config.sourceSize.w;
5122
5125
  this._private_sourceHeight = config.sourceSize.h;
5123
- this._private_scaleInternal = config.scale ?? 1;
5126
+ if (this.texture !== config.texture) {
5127
+ this._private_textureInternal = config.texture;
5128
+ this._private_textureDirtyInternal = true;
5129
+ }
5130
+ const scale = config.scale ?? 1;
5131
+ const rotated = config.rotated ?? false;
5132
+ if (this._private_frameX !== 0 ||
5133
+ this._private_frameY !== 0 ||
5134
+ this._private_frameWidth !== config.frame.w ||
5135
+ this._private_frameHeight !== config.frame.h ||
5136
+ this._private_scaleInternal !== scale ||
5137
+ this._private_rotatedInternal !== rotated) {
5138
+ this._private_frameX = config.frame.x;
5139
+ this._private_frameY = config.frame.y;
5140
+ this._private_frameWidth = config.frame.w;
5141
+ this._private_frameHeight = config.frame.h;
5142
+ this._private_scaleInternal = scale;
5143
+ this._private_rotatedInternal = rotated;
5144
+ this._private_uvTransformDirtyInternal = true;
5145
+ }
5124
5146
  const spriteSource = config.spriteSourceSize;
5125
- this._private_trimLeft = spriteSource.x;
5126
- this._private_trimTop = spriteSource.y;
5127
- this._private_trimRight = this._private_sourceWidth - spriteSource.x - spriteSource.w;
5128
- this._private_trimBottom = this._private_sourceHeight - spriteSource.y - spriteSource.h;
5147
+ const trimLeft = spriteSource.x;
5148
+ const trimTop = spriteSource.y;
5149
+ const trimRight = this._private_sourceWidth - spriteSource.x - spriteSource.w;
5150
+ const trimBottom = this._private_sourceHeight - spriteSource.y - spriteSource.h;
5151
+ if (this._private_trimLeft !== trimLeft ||
5152
+ this._private_trimRight !== trimRight ||
5153
+ this._private_trimTop !== trimTop ||
5154
+ this._private_trimBottom !== trimBottom) {
5155
+ this._private_trimLeft = trimLeft;
5156
+ this._private_trimRight = trimRight;
5157
+ this._private_trimTop = trimTop;
5158
+ this._private_trimBottom = trimBottom;
5159
+ this._private_trimDirtyInternal = true;
5160
+ }
5129
5161
  }
5130
5162
  }
5131
5163
 
5132
5164
  var source$4 = "vec4 draw(){vec2 transformedUV=(p_textureTransform*vec3(p_uv,1.0)).xy;return texture2D(p_texture,transformedUV)*p_color;}";
5133
5165
 
5134
- /** Animation playback events */
5135
- var UIAnimatedImageEvent;
5136
- (function (UIAnimatedImageEvent) {
5137
- /** Animation started or resumed */
5138
- UIAnimatedImageEvent[UIAnimatedImageEvent["PLAYED"] = 0] = "PLAYED";
5139
- /** Animation paused */
5140
- UIAnimatedImageEvent[UIAnimatedImageEvent["PAUSED"] = 1] = "PAUSED";
5141
- /** Animation stopped and reset */
5142
- UIAnimatedImageEvent[UIAnimatedImageEvent["STOPPED"] = 2] = "STOPPED";
5143
- })(UIAnimatedImageEvent || (UIAnimatedImageEvent = {}));
5144
- const ANIMATED_IMAGE_DEFAULT_FRAME_RATE = 24;
5145
- const ANIMATED_IMAGE_DEFAULT_LOOP = true;
5146
-
5147
5166
  /** Transforms that don't affect constraints */
5148
5167
  class UIMicro {
5149
5168
  /**
@@ -5371,9 +5390,9 @@ const DUMMY_DEFAULT_MODE = UIMode.VISIBLE;
5371
5390
  const DUMMY_DEFAULT_Z_INDEX = 0;
5372
5391
 
5373
5392
  /** Rectangular area with dimensions but no rendering */
5374
- class UIDummy extends UIAnchor {
5393
+ class UIInputDummy extends UIAnchor {
5375
5394
  /**
5376
- * Creates a new UIDummy instance.
5395
+ * Creates a new UIInputDummy instance.
5377
5396
  *
5378
5397
  * @param layer - Layer containing this element
5379
5398
  * @param options - Configuration options
@@ -5381,8 +5400,8 @@ class UIDummy extends UIAnchor {
5381
5400
  constructor(layer, options) {
5382
5401
  const w = options?.width ?? DUMMY_DEFAULT_WIDTH;
5383
5402
  const h = options?.height ?? DUMMY_DEFAULT_HEIGHT;
5384
- assertValidPositiveNumber(w, "UIDummy.constructor.width");
5385
- assertValidPositiveNumber(h, "UIDummy.constructor.height");
5403
+ assertValidPositiveNumber(w, "UIInputDummy.constructor.width");
5404
+ assertValidPositiveNumber(h, "UIInputDummy.constructor.height");
5386
5405
  super(layer, options);
5387
5406
  this._private_lastPointerInside = false;
5388
5407
  this.catchPointerDown = (x, y, identifier) => {
@@ -5437,32 +5456,32 @@ class UIDummy extends UIAnchor {
5437
5456
  }
5438
5457
  /** Width in world units */
5439
5458
  set width(value) {
5440
- assertValidPositiveNumber(value, "UIDummy.width");
5459
+ assertValidPositiveNumber(value, "UIInputDummy.width");
5441
5460
  this.solverWrapper.suggestVariableValue(this.wVariable, value);
5442
5461
  }
5443
5462
  /** Height in world units */
5444
5463
  set height(value) {
5445
- assertValidPositiveNumber(value, "UIDummy.height");
5464
+ assertValidPositiveNumber(value, "UIInputDummy.height");
5446
5465
  this.solverWrapper.suggestVariableValue(this.hVariable, value);
5447
5466
  }
5448
5467
  /** X coordinate of right edge */
5449
5468
  set oppositeX(value) {
5450
- assertValidNumber(value, "UIDummy.oppositeX");
5469
+ assertValidNumber(value, "UIInputDummy.oppositeX");
5451
5470
  this.x = value - this.width;
5452
5471
  }
5453
5472
  /** Y coordinate of top edge */
5454
5473
  set oppositeY(value) {
5455
- assertValidNumber(value, "UIDummy.oppositeY");
5474
+ assertValidNumber(value, "UIInputDummy.oppositeY");
5456
5475
  this.y = value - this.height;
5457
5476
  }
5458
5477
  /** X coordinate of horizontal center */
5459
5478
  set centerX(value) {
5460
- assertValidNumber(value, "UIDummy.centerX");
5479
+ assertValidNumber(value, "UIInputDummy.centerX");
5461
5480
  this.x = value - this.width / 2;
5462
5481
  }
5463
5482
  /** Y coordinate of vertical center */
5464
5483
  set centerY(value) {
5465
- assertValidNumber(value, "UIDummy.centerY");
5484
+ assertValidNumber(value, "UIInputDummy.centerY");
5466
5485
  this.y = value - this.height / 2;
5467
5486
  }
5468
5487
  /** Controls visibility and interactivity */
@@ -5475,7 +5494,7 @@ class UIDummy extends UIAnchor {
5475
5494
  }
5476
5495
  /** Rendering and input priority. Higher values on top. */
5477
5496
  set zIndex(value) {
5478
- assertValidNumber(value, "UIDummy.zIndex");
5497
+ assertValidNumber(value, "UIInputDummy.zIndex");
5479
5498
  this.inputWrapper.setZIndex(this._private_catcherHandler, value);
5480
5499
  }
5481
5500
  /** Removes element and frees resources */
@@ -5486,9 +5505,9 @@ class UIDummy extends UIAnchor {
5486
5505
  super.destroy();
5487
5506
  }
5488
5507
  handleInputEvent(x, y, identifier, inputEvent) {
5489
- assertValidNumber(x, "UIDummy.handleInputEvent.x");
5490
- assertValidNumber(y, "UIDummy.handleInputEvent.y");
5491
- assertValidNumber(identifier, "UIDummy.handleInputEvent.identifier");
5508
+ assertValidNumber(x, "UIInputDummy.handleInputEvent.x");
5509
+ assertValidNumber(y, "UIInputDummy.handleInputEvent.y");
5510
+ assertValidNumber(identifier, "UIInputDummy.handleInputEvent.identifier");
5492
5511
  const isPointerInside = this.interactionArea.contains(MathUtils.mapLinear(x, this.x, this.oppositeX, 0, 1), MathUtils.mapLinear(y, this.y, this.oppositeY, 0, 1));
5493
5512
  if (isPointerInside) {
5494
5513
  this.emit(inputEvent, x, y, identifier, this);
@@ -5509,7 +5528,7 @@ class UIDummy extends UIAnchor {
5509
5528
  const ELEMENT_DEFAULT_TRANSPARENCY_MODE = UITransparencyMode.BLEND;
5510
5529
 
5511
5530
  /** Base class for renderable UI elements */
5512
- class UIElement extends UIDummy {
5531
+ class UIElement extends UIInputDummy {
5513
5532
  /**
5514
5533
  * Creates a new UIElement instance.
5515
5534
  *
@@ -5527,6 +5546,9 @@ class UIElement extends UIDummy {
5527
5546
  options?.transparencyMode ?? ELEMENT_DEFAULT_TRANSPARENCY_MODE;
5528
5547
  this.sceneWrapper = this.layer.sceneWrapper;
5529
5548
  this.planeHandler = this.sceneWrapper.createPlane(source, properties, this._private_transparencyModeInternal);
5549
+ if (options?.mode !== undefined && !isUIModeVisible(options.mode)) {
5550
+ this._private_visibilityDirty = true;
5551
+ }
5530
5552
  this.layer.on(UILayerEvent.RENDERING, this.onWillRender, this);
5531
5553
  }
5532
5554
  /** Alpha blending mode */
@@ -5553,7 +5575,7 @@ class UIElement extends UIDummy {
5553
5575
  this.sceneWrapper.destroyPlane(this.planeHandler);
5554
5576
  super.destroy();
5555
5577
  }
5556
- updatePlaneTransform() {
5578
+ setPlaneTransform() {
5557
5579
  if (this.micro.dirty ||
5558
5580
  this.inputWrapper.dirty ||
5559
5581
  this.solverWrapper.dirty) {
@@ -5561,11 +5583,8 @@ class UIElement extends UIDummy {
5561
5583
  this.micro.setDirtyFalse();
5562
5584
  }
5563
5585
  }
5564
- onWillRender(
5565
- // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Required by UILayer event interface but not used in base implementation
5566
- renderer,
5567
5586
  // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Required by UILayer event interface but not used in base implementation
5568
- deltaTime) {
5587
+ onWillRender(renderer, deltaTime) {
5569
5588
  if (this._private_transparencyModeDirty) {
5570
5589
  this.sceneWrapper.setTransparency(this.planeHandler, this._private_transparencyModeInternal);
5571
5590
  this._private_transparencyModeDirty = false;
@@ -5574,10 +5593,23 @@ class UIElement extends UIDummy {
5574
5593
  this.sceneWrapper.setVisibility(this.planeHandler, isUIModeVisible(this.modeInternal));
5575
5594
  this._private_visibilityDirty = false;
5576
5595
  }
5577
- this.updatePlaneTransform();
5596
+ this.setPlaneTransform();
5578
5597
  }
5579
5598
  }
5580
5599
 
5600
+ /** Animation playback events */
5601
+ var UIAnimatedImageEvent;
5602
+ (function (UIAnimatedImageEvent) {
5603
+ /** Animation started or resumed */
5604
+ UIAnimatedImageEvent[UIAnimatedImageEvent["PLAYED"] = 0] = "PLAYED";
5605
+ /** Animation paused */
5606
+ UIAnimatedImageEvent[UIAnimatedImageEvent["PAUSED"] = 1] = "PAUSED";
5607
+ /** Animation stopped and reset */
5608
+ UIAnimatedImageEvent[UIAnimatedImageEvent["STOPPED"] = 2] = "STOPPED";
5609
+ })(UIAnimatedImageEvent || (UIAnimatedImageEvent = {}));
5610
+ const ANIMATED_IMAGE_DEFAULT_FRAME_RATE = 24;
5611
+ const ANIMATED_IMAGE_DEFAULT_LOOP = true;
5612
+
5581
5613
  /** Frame-based texture animation element */
5582
5614
  class UIAnimatedImage extends UIElement {
5583
5615
  /**
@@ -5718,7 +5750,7 @@ class UIAnimatedImage extends UIElement {
5718
5750
  }
5719
5751
  super.onWillRender(renderer, deltaTime);
5720
5752
  }
5721
- updatePlaneTransform() {
5753
+ setPlaneTransform() {
5722
5754
  const frame = this._private_sequenceInternal[this._private_sequenceFrameIndex];
5723
5755
  if (this.color.dirty || this._private_currentFrameIndexDirty) {
5724
5756
  this.sceneWrapper.setProperties(this.planeHandler, {
@@ -5729,16 +5761,20 @@ class UIAnimatedImage extends UIElement {
5729
5761
  this.color.setDirtyFalse();
5730
5762
  }
5731
5763
  if (this._private_currentFrameIndexDirty ||
5732
- frame.dirty ||
5764
+ frame.textureDirty ||
5765
+ frame.uvTransformDirty ||
5766
+ frame.trimDirty ||
5733
5767
  this.micro.dirty ||
5734
5768
  this.inputWrapper.dirty ||
5735
5769
  this.solverWrapper.dirty) {
5736
- const trim = frame.trim;
5737
5770
  const micro = this.micro;
5738
- this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, trim.left, trim.right, trim.top, trim.bottom));
5739
- frame.setDirtyFalse();
5740
- this._private_currentFrameIndexDirty = false;
5771
+ const textureTrim = frame.trim;
5772
+ this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
5741
5773
  this.micro.setDirtyFalse();
5774
+ frame.setTextureDirtyFalse();
5775
+ frame.setUVTransformDirtyFalse();
5776
+ frame.setTrimDirtyFalse();
5777
+ this._private_currentFrameIndexDirty = false;
5742
5778
  }
5743
5779
  }
5744
5780
  _private_subscribeSequenceEvents() {
@@ -5753,6 +5789,8 @@ class UIAnimatedImage extends UIElement {
5753
5789
  }
5754
5790
  }
5755
5791
 
5792
+ const GRAPHICS_TEMP_PROPERTIES = {};
5793
+
5756
5794
  /** Canvas-based 2D drawing element */
5757
5795
  class UIGraphics extends UIElement {
5758
5796
  /**
@@ -5771,8 +5809,10 @@ class UIGraphics extends UIElement {
5771
5809
  throw new Error("UIGraphics.constructor: failed to get 2D context from OffscreenCanvas");
5772
5810
  }
5773
5811
  const texture = new CanvasTexture(canvas);
5812
+ texture.colorSpace = SRGBColorSpace;
5774
5813
  texture.minFilter = LinearFilter;
5775
5814
  texture.magFilter = LinearFilter;
5815
+ texture.needsUpdate = true;
5776
5816
  super(layer, source$4, {
5777
5817
  texture: texture,
5778
5818
  textureTransform: texture.matrix,
@@ -5855,13 +5895,19 @@ class UIGraphics extends UIElement {
5855
5895
  }
5856
5896
  onWillRender(renderer, deltaTime) {
5857
5897
  if (this.color.dirty) {
5858
- this.sceneWrapper.setProperties(this.planeHandler, { color: this.color });
5898
+ GRAPHICS_TEMP_PROPERTIES["color"] = this.color;
5859
5899
  this.color.setDirtyFalse();
5860
5900
  }
5901
+ else {
5902
+ delete GRAPHICS_TEMP_PROPERTIES["color"];
5903
+ }
5904
+ this.sceneWrapper.setProperties(this.planeHandler, GRAPHICS_TEMP_PROPERTIES);
5861
5905
  super.onWillRender(renderer, deltaTime);
5862
5906
  }
5863
5907
  }
5864
5908
 
5909
+ const IMAGE_TEMP_PROPERTIES = {};
5910
+
5865
5911
  /** Textured image element */
5866
5912
  class UIImage extends UIElement {
5867
5913
  /**
@@ -5898,47 +5944,63 @@ class UIImage extends UIElement {
5898
5944
  this.texture.off(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
5899
5945
  super.destroy();
5900
5946
  }
5901
- updatePlaneTransform() {
5902
- if (this.texture.dirty || this.color.dirty) {
5903
- this.sceneWrapper.setProperties(this.planeHandler, {
5904
- texture: this.texture.texture,
5905
- textureTransform: this.texture.calculateUVTransform(this._private_textureTransform),
5906
- color: this.color,
5907
- });
5947
+ setPlaneTransform() {
5948
+ if (this.color.dirty) {
5949
+ IMAGE_TEMP_PROPERTIES["color"] = this.color;
5908
5950
  this.color.setDirtyFalse();
5909
5951
  }
5910
- if (this.texture.dirty ||
5911
- this.micro.dirty ||
5952
+ else {
5953
+ delete IMAGE_TEMP_PROPERTIES["color"];
5954
+ }
5955
+ if (this.texture.textureDirty) {
5956
+ IMAGE_TEMP_PROPERTIES["texture"] = this.texture.texture;
5957
+ this.texture.setTextureDirtyFalse();
5958
+ }
5959
+ else {
5960
+ delete IMAGE_TEMP_PROPERTIES["texture"];
5961
+ }
5962
+ if (this.texture.uvTransformDirty) {
5963
+ IMAGE_TEMP_PROPERTIES["textureTransform"] =
5964
+ this.texture.calculateUVTransform(this._private_textureTransform);
5965
+ this.texture.setUVTransformDirtyFalse();
5966
+ }
5967
+ else {
5968
+ delete IMAGE_TEMP_PROPERTIES["textureTransform"];
5969
+ }
5970
+ this.sceneWrapper.setProperties(this.planeHandler, IMAGE_TEMP_PROPERTIES);
5971
+ const isTransformDirty = this.micro.dirty ||
5972
+ this.texture.trimDirty ||
5912
5973
  this.inputWrapper.dirty ||
5913
- this.solverWrapper.dirty) {
5914
- const trim = this.texture.trim;
5974
+ this.solverWrapper.dirty;
5975
+ if (isTransformDirty) {
5915
5976
  const micro = this.micro;
5916
- this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, trim.left, trim.right, trim.top, trim.bottom));
5917
- this.texture.setDirtyFalse();
5977
+ const textureTrim = this.texture.trim;
5978
+ this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
5918
5979
  this.micro.setDirtyFalse();
5980
+ this.texture.setTrimDirtyFalse();
5919
5981
  }
5920
5982
  }
5921
5983
  }
5922
5984
 
5923
- const PADDING_DEFAULT_VALUE = 0;
5985
+ const INSETS_DEFAULT_VALUE = 0;
5924
5986
 
5925
- /** Padding values for four sides */
5926
- class UIPadding {
5987
+ /** Insets values for four sides */
5988
+ class UIInsets {
5927
5989
  /**
5928
- * Creates UIPadding instance.
5990
+ * Creates UIInsets instance.
5929
5991
  *
5930
- * @param config - Padding configuration
5992
+ * @param config - Insets configuration
5931
5993
  */
5932
5994
  constructor(config) {
5933
5995
  this._private_dirtyInternal = false;
5934
5996
  if (config === undefined) {
5935
- this._private_lInternal = PADDING_DEFAULT_VALUE;
5936
- this._private_rInternal = PADDING_DEFAULT_VALUE;
5937
- this._private_tInternal = PADDING_DEFAULT_VALUE;
5938
- this._private_bInternal = PADDING_DEFAULT_VALUE;
5997
+ this._private_lInternal = INSETS_DEFAULT_VALUE;
5998
+ this._private_rInternal = INSETS_DEFAULT_VALUE;
5999
+ this._private_tInternal = INSETS_DEFAULT_VALUE;
6000
+ this._private_bInternal = INSETS_DEFAULT_VALUE;
5939
6001
  }
5940
6002
  else if (typeof config === "number") {
5941
- assertValidNonNegativeNumber(config, "UIPadding.constructor.config");
6003
+ assertValidNonNegativeNumber(config, "UIInsets.constructor.config");
5942
6004
  this._private_lInternal = config;
5943
6005
  this._private_rInternal = config;
5944
6006
  this._private_tInternal = config;
@@ -5949,10 +6011,10 @@ class UIPadding {
5949
6011
  const right = config.right;
5950
6012
  const top = config.top;
5951
6013
  const bottom = config.bottom;
5952
- assertValidNonNegativeNumber(left, "UIPadding.constructor.config.left");
5953
- assertValidNonNegativeNumber(right, "UIPadding.constructor.config.right");
5954
- assertValidNonNegativeNumber(top, "UIPadding.constructor.config.top");
5955
- assertValidNonNegativeNumber(bottom, "UIPadding.constructor.config.bottom");
6014
+ assertValidNonNegativeNumber(left, "UIInsets.constructor.config.left");
6015
+ assertValidNonNegativeNumber(right, "UIInsets.constructor.config.right");
6016
+ assertValidNonNegativeNumber(top, "UIInsets.constructor.config.top");
6017
+ assertValidNonNegativeNumber(bottom, "UIInsets.constructor.config.bottom");
5956
6018
  this._private_lInternal = left;
5957
6019
  this._private_rInternal = right;
5958
6020
  this._private_tInternal = top;
@@ -5961,27 +6023,27 @@ class UIPadding {
5961
6023
  else {
5962
6024
  const horizontal = config.horizontal;
5963
6025
  const vertical = config.vertical;
5964
- assertValidNonNegativeNumber(horizontal, "UIPadding.constructor.config.horizontal");
5965
- assertValidNonNegativeNumber(vertical, "UIPadding.constructor.config.vertical");
6026
+ assertValidNonNegativeNumber(horizontal, "UIInsets.constructor.config.horizontal");
6027
+ assertValidNonNegativeNumber(vertical, "UIInsets.constructor.config.vertical");
5966
6028
  this._private_lInternal = horizontal;
5967
6029
  this._private_rInternal = horizontal;
5968
6030
  this._private_tInternal = vertical;
5969
6031
  this._private_bInternal = vertical;
5970
6032
  }
5971
6033
  }
5972
- /** Left padding */
6034
+ /** Left inset */
5973
6035
  get left() {
5974
6036
  return this._private_lInternal;
5975
6037
  }
5976
- /** Right padding */
6038
+ /** Right inset */
5977
6039
  get right() {
5978
6040
  return this._private_rInternal;
5979
6041
  }
5980
- /** Top padding */
6042
+ /** Top inset */
5981
6043
  get top() {
5982
6044
  return this._private_tInternal;
5983
6045
  }
5984
- /** Bottom padding */
6046
+ /** Bottom inset */
5985
6047
  get bottom() {
5986
6048
  return this._private_bInternal;
5987
6049
  }
@@ -5989,33 +6051,33 @@ class UIPadding {
5989
6051
  get dirty() {
5990
6052
  return this._private_dirtyInternal;
5991
6053
  }
5992
- /** Left padding */
6054
+ /** Left inset */
5993
6055
  set left(value) {
5994
- assertValidNonNegativeNumber(value, "UIPadding.left");
6056
+ assertValidNonNegativeNumber(value, "UIInsets.left");
5995
6057
  if (this._private_lInternal !== value) {
5996
6058
  this._private_lInternal = value;
5997
6059
  this._private_dirtyInternal = true;
5998
6060
  }
5999
6061
  }
6000
- /** Right padding */
6062
+ /** Right inset */
6001
6063
  set right(value) {
6002
- assertValidNonNegativeNumber(value, "UIPadding.right");
6064
+ assertValidNonNegativeNumber(value, "UIInsets.right");
6003
6065
  if (this._private_rInternal !== value) {
6004
6066
  this._private_rInternal = value;
6005
6067
  this._private_dirtyInternal = true;
6006
6068
  }
6007
6069
  }
6008
- /** Top padding */
6070
+ /** Top inset */
6009
6071
  set top(value) {
6010
- assertValidNonNegativeNumber(value, "UIPadding.top");
6072
+ assertValidNonNegativeNumber(value, "UIInsets.top");
6011
6073
  if (this._private_tInternal !== value) {
6012
6074
  this._private_tInternal = value;
6013
6075
  this._private_dirtyInternal = true;
6014
6076
  }
6015
6077
  }
6016
- /** Bottom padding */
6078
+ /** Bottom inset */
6017
6079
  set bottom(value) {
6018
- assertValidNonNegativeNumber(value, "UIPadding.bottom");
6080
+ assertValidNonNegativeNumber(value, "UIInsets.bottom");
6019
6081
  if (this._private_bInternal !== value) {
6020
6082
  this._private_bInternal = value;
6021
6083
  this._private_dirtyInternal = true;
@@ -6023,7 +6085,7 @@ class UIPadding {
6023
6085
  }
6024
6086
  /** Sets left and right to same value */
6025
6087
  setHorizontal(value) {
6026
- assertValidNonNegativeNumber(value, "UIPadding.setHorizontal.value");
6088
+ assertValidNonNegativeNumber(value, "UIInsets.setHorizontal.value");
6027
6089
  if (this._private_lInternal !== value || this._private_rInternal !== value) {
6028
6090
  this._private_lInternal = value;
6029
6091
  this._private_rInternal = value;
@@ -6032,7 +6094,7 @@ class UIPadding {
6032
6094
  }
6033
6095
  /** Sets top and bottom to same value */
6034
6096
  setVertical(value) {
6035
- assertValidNonNegativeNumber(value, "UIPadding.setVertical.value");
6097
+ assertValidNonNegativeNumber(value, "UIInsets.setVertical.value");
6036
6098
  if (this._private_tInternal !== value || this._private_bInternal !== value) {
6037
6099
  this._private_tInternal = value;
6038
6100
  this._private_bInternal = value;
@@ -6041,7 +6103,7 @@ class UIPadding {
6041
6103
  }
6042
6104
  /** Sets all sides to same value */
6043
6105
  setUnified(value) {
6044
- assertValidNonNegativeNumber(value, "UIPadding.setUnified.value");
6106
+ assertValidNonNegativeNumber(value, "UIInsets.setUnified.value");
6045
6107
  if (this._private_lInternal !== value ||
6046
6108
  this._private_rInternal !== value ||
6047
6109
  this._private_tInternal !== value ||
@@ -6055,10 +6117,10 @@ class UIPadding {
6055
6117
  }
6056
6118
  /** Sets from Vector4 (x=left, y=right, z=top, w=bottom) */
6057
6119
  setVector4(vector) {
6058
- assertValidNonNegativeNumber(vector.x, "UIPadding.setVector4.vector.x");
6059
- assertValidNonNegativeNumber(vector.y, "UIPadding.setVector4.vector.y");
6060
- assertValidNonNegativeNumber(vector.z, "UIPadding.setVector4.vector.z");
6061
- assertValidNonNegativeNumber(vector.w, "UIPadding.setVector4.vector.w");
6120
+ assertValidNonNegativeNumber(vector.x, "UIInsets.setVector4.vector.x");
6121
+ assertValidNonNegativeNumber(vector.y, "UIInsets.setVector4.vector.y");
6122
+ assertValidNonNegativeNumber(vector.z, "UIInsets.setVector4.vector.z");
6123
+ assertValidNonNegativeNumber(vector.w, "UIInsets.setVector4.vector.w");
6062
6124
  if (this._private_lInternal !== vector.x ||
6063
6125
  this._private_rInternal !== vector.y ||
6064
6126
  this._private_tInternal !== vector.z ||
@@ -6127,8 +6189,8 @@ class UINineSlice extends UIElement {
6127
6189
  const textureTransform = textureView.calculateUVTransform();
6128
6190
  options.width = options.width ?? textureView.width;
6129
6191
  options.height = options.height ?? textureView.height;
6130
- const sliceBorders = new UIPadding(options.sliceBorders ?? NINE_SLICE_DEFAULT_BORDER);
6131
- const sliceRegions = new UIPadding(options.sliceRegions ?? NINE_SLICE_DEFAULT_BORDER);
6192
+ const sliceBorders = new UIInsets(options.sliceBorders ?? NINE_SLICE_DEFAULT_BORDER);
6193
+ const sliceRegions = new UIInsets(options.sliceRegions ?? NINE_SLICE_DEFAULT_BORDER);
6132
6194
  const regionMode = options.regionMode ?? NINE_SLICE_DEFAULT_REGION_MODE;
6133
6195
  const sliceBordersVector = new Vector4();
6134
6196
  const sliceRegionsVector = new Vector4();
@@ -6164,9 +6226,11 @@ class UINineSlice extends UIElement {
6164
6226
  this._private_regionModeDirty = true;
6165
6227
  }
6166
6228
  }
6167
- updatePlaneTransform() {
6229
+ setPlaneTransform() {
6168
6230
  if (this._private_regionModeDirty ||
6169
- this.texture.dirty ||
6231
+ this.texture.textureDirty ||
6232
+ this.texture.uvTransformDirty ||
6233
+ this.texture.trimDirty ||
6170
6234
  this.color.dirty ||
6171
6235
  this.sliceBorders.dirty ||
6172
6236
  this.sliceRegions.dirty ||
@@ -6187,14 +6251,18 @@ class UINineSlice extends UIElement {
6187
6251
  this.sliceRegions.setDirtyFalse();
6188
6252
  this._private_setDimensionsDirtyFalse();
6189
6253
  }
6190
- if (this.texture.dirty ||
6254
+ if (this.texture.textureDirty ||
6255
+ this.texture.uvTransformDirty ||
6256
+ this.texture.trimDirty ||
6191
6257
  this.micro.dirty ||
6192
6258
  this.inputWrapper.dirty ||
6193
6259
  this.solverWrapper.dirty) {
6194
6260
  const trim = this.texture.trim;
6195
6261
  const micro = this.micro;
6196
6262
  this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, trim.left, trim.right, trim.top, trim.bottom));
6197
- this.texture.setDirtyFalse();
6263
+ this.texture.setTextureDirtyFalse();
6264
+ this.texture.setUVTransformDirtyFalse();
6265
+ this.texture.setTrimDirtyFalse();
6198
6266
  this.micro.setDirtyFalse();
6199
6267
  }
6200
6268
  }
@@ -6304,6 +6372,7 @@ class UIProgressMaskFunctionDirectional extends UIProgressMaskFunction {
6304
6372
  var source$1 = "vec4 draw(){vec2 transformedUV=(p_textureTransform*vec3(p_uv,1.0)).xy;vec4 diffuseColor=texture2D(p_texture,transformedUV)*p_color;diffuseColor.a*=calculateMask();return diffuseColor;}";
6305
6373
 
6306
6374
  const PROGRESS_DEFAULT_VALUE = 1;
6375
+ const PROGRESS_TEMP_PROPERTIES = {};
6307
6376
  function simplifyGLSLSource(source) {
6308
6377
  return source
6309
6378
  .replace(/\/\*[\s\S]*?\*\//g, "")
@@ -6342,10 +6411,14 @@ class UIProgress extends UIElement {
6342
6411
  progress,
6343
6412
  ...maskFunction.enumerateProperties(),
6344
6413
  }, options);
6345
- this._private_dirty = false;
6414
+ this._private_progressDirty = false;
6415
+ this._private_textureResolutionDirty = false;
6346
6416
  this._private_onTextureDimensionsChanged = (width, height) => {
6347
- this.width = width;
6348
- this.height = height;
6417
+ if (this.width !== width || this.height !== height) {
6418
+ this.width = width;
6419
+ this.height = height;
6420
+ this._private_textureResolutionDirty = true;
6421
+ }
6349
6422
  };
6350
6423
  this.texture = textureView;
6351
6424
  this._private_textureTransform = textureTransform;
@@ -6363,32 +6436,70 @@ class UIProgress extends UIElement {
6363
6436
  set progress(value) {
6364
6437
  if (this._private_progressInternal !== value) {
6365
6438
  this._private_progressInternal = value;
6366
- this._private_dirty = true;
6439
+ this._private_progressDirty = true;
6367
6440
  }
6368
6441
  }
6369
- updatePlaneTransform() {
6370
- if (this._private_dirty ||
6371
- this.texture.dirty ||
6372
- this.color.dirty ||
6373
- this.maskFunction.dirty) {
6374
- this.sceneWrapper.setProperties(this.planeHandler, {
6375
- texture: this.texture.texture,
6376
- textureTransform: this.texture.calculateUVTransform(this._private_textureTransform),
6377
- textureResolution: this.texture.getResolution(this._private_textureResolution),
6378
- color: this.color,
6379
- progress: this._private_progressInternal,
6380
- });
6381
- this._private_dirty = false;
6442
+ setPlaneTransform() {
6443
+ if (this.color.dirty) {
6444
+ PROGRESS_TEMP_PROPERTIES["color"] = this.color;
6382
6445
  this.color.setDirtyFalse();
6446
+ }
6447
+ else {
6448
+ delete PROGRESS_TEMP_PROPERTIES["color"];
6449
+ }
6450
+ if (this.texture.textureDirty) {
6451
+ PROGRESS_TEMP_PROPERTIES["texture"] = this.texture.texture;
6452
+ this.texture.setTextureDirtyFalse();
6453
+ }
6454
+ else {
6455
+ delete PROGRESS_TEMP_PROPERTIES["texture"];
6456
+ }
6457
+ if (this.texture.uvTransformDirty) {
6458
+ PROGRESS_TEMP_PROPERTIES["textureTransform"] =
6459
+ this.texture.calculateUVTransform(this._private_textureTransform);
6460
+ this.texture.setUVTransformDirtyFalse();
6461
+ }
6462
+ else {
6463
+ delete PROGRESS_TEMP_PROPERTIES["textureTransform"];
6464
+ }
6465
+ if (this.texture.uvTransformDirty) {
6466
+ PROGRESS_TEMP_PROPERTIES["progress"] = this._private_progressInternal;
6467
+ this._private_progressDirty = false;
6468
+ }
6469
+ else {
6470
+ delete PROGRESS_TEMP_PROPERTIES["progress"];
6471
+ }
6472
+ if (this._private_textureResolutionDirty) {
6473
+ PROGRESS_TEMP_PROPERTIES["textureResolution"] =
6474
+ this.texture.getResolution(this._private_textureResolution);
6475
+ this._private_textureResolutionDirty = false;
6476
+ }
6477
+ else {
6478
+ delete PROGRESS_TEMP_PROPERTIES["textureResolution"];
6479
+ }
6480
+ if (this.maskFunction.dirty) {
6481
+ const properties = this.maskFunction.enumerateProperties();
6482
+ for (const key in properties) {
6483
+ PROGRESS_TEMP_PROPERTIES[key] = properties[key];
6484
+ }
6383
6485
  this.maskFunction.setDirtyFalse();
6384
6486
  }
6385
- if (this.solverWrapper.dirty ||
6487
+ else {
6488
+ for (const key in this.maskFunction.enumerateProperties()) {
6489
+ delete PROGRESS_TEMP_PROPERTIES[key];
6490
+ }
6491
+ }
6492
+ this.sceneWrapper.setProperties(this.planeHandler, PROGRESS_TEMP_PROPERTIES);
6493
+ const isTransformDirty = this.micro.dirty ||
6494
+ this.texture.trimDirty ||
6386
6495
  this.inputWrapper.dirty ||
6387
- this.texture.dirty ||
6388
- this.micro.dirty) {
6389
- this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, this.micro.x, this.micro.y, this.micro.anchorX, this.micro.anchorY, this.micro.scaleX, this.micro.scaleY, this.micro.rotation, this.micro.anchorMode, this.texture.trim.left, this.texture.trim.right, this.texture.trim.top, this.texture.trim.bottom));
6390
- this.texture.setDirtyFalse();
6496
+ this.solverWrapper.dirty;
6497
+ if (isTransformDirty) {
6498
+ const micro = this.micro;
6499
+ const textureTrim = this.texture.trim;
6500
+ this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
6391
6501
  this.micro.setDirtyFalse();
6502
+ this.texture.setTrimDirtyFalse();
6392
6503
  }
6393
6504
  }
6394
6505
  }
@@ -7206,6 +7317,8 @@ class UIText extends UIElement {
7206
7317
  throw new Error("UIText.constructor: failed to create canvas context");
7207
7318
  }
7208
7319
  const texture = new CanvasTexture(canvas);
7320
+ texture.colorSpace = SRGBColorSpace;
7321
+ texture.needsUpdate = true;
7209
7322
  const color = new UIColor(options.color);
7210
7323
  super(layer, source$4, {
7211
7324
  texture: texture,
@@ -7219,7 +7332,7 @@ class UIText extends UIElement {
7219
7332
  this._private_textChunks = [];
7220
7333
  this._private_textChunksDirty = false;
7221
7334
  this.color = color;
7222
- this.padding = new UIPadding(options.padding);
7335
+ this.padding = new UIInsets(options.padding);
7223
7336
  this.commonStyle = new UITextStyle(options.commonStyle);
7224
7337
  this._private_maxLineWidthInternal =
7225
7338
  options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
@@ -7394,6 +7507,7 @@ class UIText extends UIElement {
7394
7507
  _private_rebuildTexture() {
7395
7508
  this._private_texture.dispose();
7396
7509
  this._private_texture = new CanvasTexture(this._private_canvas);
7510
+ this._private_texture.colorSpace = SRGBColorSpace;
7397
7511
  this._private_texture.needsUpdate = true;
7398
7512
  this.sceneWrapper.setProperties(this.planeHandler, {
7399
7513
  texture: this._private_texture,
@@ -8008,5 +8122,5 @@ class UIResizePolicyFixedWidth extends UIResizePolicy {
8008
8122
  }
8009
8123
  }
8010
8124
 
8011
- export { UIAnchor, UIAnimatedImage, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint, UIDummy, UIExpression, UIFitConstraintBuilder, UIFullscreenLayer, UIGraphics, UIHeightConstraint, UIHorizontalDistanceConstraint, UIHorizontalProportionConstraint, UIImage, 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, UIVerticalProportionConstraint, UIWidthConstraint };
8125
+ export { UIAnchor, UIAnimatedImage, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint, UIExpression, UIFitConstraintBuilder, UIFullscreenLayer, UIGraphics, UIHeightConstraint, UIHorizontalDistanceConstraint, 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, UIVerticalProportionConstraint, UIWidthConstraint };
8012
8126
  //# sourceMappingURL=index.js.map