laymur 0.11.3 → 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.
- package/README.md +0 -1
- package/dist/constraints/builders/UIConstraint2DBuilder.d.ts +1 -1
- package/dist/elements/{UIAnchor.d.ts → UIAnchor/UIAnchor.d.ts} +3 -3
- package/dist/elements/{UIAnimatedImage.Internal.d.ts → UIAnimatedImage/UIAnimatedImage.Internal.d.ts} +2 -2
- package/dist/elements/{UIAnimatedImage.d.ts → UIAnimatedImage/UIAnimatedImage.d.ts} +6 -6
- package/dist/elements/UIElement/UIElement.Internal.d.ts +11 -0
- package/dist/elements/{UIElement.d.ts → UIElement/UIElement.d.ts} +9 -9
- package/dist/elements/UIGraphics/UIGraphics.Internal.d.ts +9 -0
- package/dist/elements/{UIGraphics.d.ts → UIGraphics/UIGraphics.d.ts} +4 -4
- package/dist/elements/UIImage/UIImage.Internal.d.ts +9 -0
- package/dist/elements/{UIImage.d.ts → UIImage/UIImage.d.ts} +7 -7
- package/dist/elements/{UIDummy.Internal.d.ts → UIInputDummy/UIInputDummy.Internal.d.ts} +5 -5
- package/dist/elements/{UIDummy.d.ts → UIInputDummy/UIInputDummy.d.ts} +11 -11
- package/dist/elements/{UINineSlice.Internal.d.ts → UINineSlice/UINineSlice.Internal.d.ts} +5 -5
- package/dist/elements/{UINineSlice.d.ts → UINineSlice/UINineSlice.d.ts} +9 -9
- package/dist/elements/{UIProgress.Internal.d.ts → UIProgress/UIProgress.Internal.d.ts} +5 -3
- package/dist/elements/{UIProgress.d.ts → UIProgress/UIProgress.d.ts} +8 -7
- package/dist/elements/{UIScene.Internal.d.ts → UIScene/UIScene.Internal.d.ts} +3 -3
- package/dist/elements/{UIScene.d.ts → UIScene/UIScene.d.ts} +3 -3
- package/dist/elements/UIText/UIText.Internal.d.ts +3 -3
- package/dist/elements/UIText/UIText.d.ts +3 -3
- package/dist/index.d.ts +10 -10
- package/dist/index.js +290 -179
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/miscellaneous/insets/UIInsets.Internal.d.ts +11 -0
- package/dist/miscellaneous/{padding/UIPadding.d.ts → insets/UIInsets.d.ts} +15 -15
- package/dist/miscellaneous/texture/UITextureView.d.ts +13 -9
- package/package.json +1 -1
- package/dist/elements/UIElement.Internal.d.ts +0 -11
- package/dist/elements/UIGraphics.Internal.d.ts +0 -7
- package/dist/elements/UIImage.Internal.d.ts +0 -7
- package/dist/miscellaneous/padding/UIPadding.Internal.d.ts +0 -11
- /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.
|
|
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.
|
|
4964
|
-
this.
|
|
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.
|
|
4970
|
-
this.
|
|
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
|
-
|
|
5016
|
-
|
|
5017
|
-
return this._private_dirtyInternal;
|
|
5017
|
+
get textureDirty() {
|
|
5018
|
+
return this._private_textureDirtyInternal;
|
|
5018
5019
|
}
|
|
5019
|
-
/**
|
|
5020
|
-
|
|
5021
|
-
this.
|
|
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
|
|
5063
|
-
const
|
|
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.
|
|
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.
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
this.
|
|
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.
|
|
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
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
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
|
|
5393
|
+
class UIInputDummy extends UIAnchor {
|
|
5375
5394
|
/**
|
|
5376
|
-
* Creates a new
|
|
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, "
|
|
5385
|
-
assertValidPositiveNumber(h, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
5490
|
-
assertValidNumber(y, "
|
|
5491
|
-
assertValidNumber(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
|
|
5531
|
+
class UIElement extends UIInputDummy {
|
|
5513
5532
|
/**
|
|
5514
5533
|
* Creates a new UIElement instance.
|
|
5515
5534
|
*
|
|
@@ -5556,7 +5575,7 @@ class UIElement extends UIDummy {
|
|
|
5556
5575
|
this.sceneWrapper.destroyPlane(this.planeHandler);
|
|
5557
5576
|
super.destroy();
|
|
5558
5577
|
}
|
|
5559
|
-
|
|
5578
|
+
setPlaneTransform() {
|
|
5560
5579
|
if (this.micro.dirty ||
|
|
5561
5580
|
this.inputWrapper.dirty ||
|
|
5562
5581
|
this.solverWrapper.dirty) {
|
|
@@ -5564,11 +5583,8 @@ class UIElement extends UIDummy {
|
|
|
5564
5583
|
this.micro.setDirtyFalse();
|
|
5565
5584
|
}
|
|
5566
5585
|
}
|
|
5567
|
-
onWillRender(
|
|
5568
5586
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Required by UILayer event interface but not used in base implementation
|
|
5569
|
-
renderer,
|
|
5570
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Required by UILayer event interface but not used in base implementation
|
|
5571
|
-
deltaTime) {
|
|
5587
|
+
onWillRender(renderer, deltaTime) {
|
|
5572
5588
|
if (this._private_transparencyModeDirty) {
|
|
5573
5589
|
this.sceneWrapper.setTransparency(this.planeHandler, this._private_transparencyModeInternal);
|
|
5574
5590
|
this._private_transparencyModeDirty = false;
|
|
@@ -5577,10 +5593,23 @@ class UIElement extends UIDummy {
|
|
|
5577
5593
|
this.sceneWrapper.setVisibility(this.planeHandler, isUIModeVisible(this.modeInternal));
|
|
5578
5594
|
this._private_visibilityDirty = false;
|
|
5579
5595
|
}
|
|
5580
|
-
this.
|
|
5596
|
+
this.setPlaneTransform();
|
|
5581
5597
|
}
|
|
5582
5598
|
}
|
|
5583
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
|
+
|
|
5584
5613
|
/** Frame-based texture animation element */
|
|
5585
5614
|
class UIAnimatedImage extends UIElement {
|
|
5586
5615
|
/**
|
|
@@ -5721,7 +5750,7 @@ class UIAnimatedImage extends UIElement {
|
|
|
5721
5750
|
}
|
|
5722
5751
|
super.onWillRender(renderer, deltaTime);
|
|
5723
5752
|
}
|
|
5724
|
-
|
|
5753
|
+
setPlaneTransform() {
|
|
5725
5754
|
const frame = this._private_sequenceInternal[this._private_sequenceFrameIndex];
|
|
5726
5755
|
if (this.color.dirty || this._private_currentFrameIndexDirty) {
|
|
5727
5756
|
this.sceneWrapper.setProperties(this.planeHandler, {
|
|
@@ -5732,16 +5761,20 @@ class UIAnimatedImage extends UIElement {
|
|
|
5732
5761
|
this.color.setDirtyFalse();
|
|
5733
5762
|
}
|
|
5734
5763
|
if (this._private_currentFrameIndexDirty ||
|
|
5735
|
-
frame.
|
|
5764
|
+
frame.textureDirty ||
|
|
5765
|
+
frame.uvTransformDirty ||
|
|
5766
|
+
frame.trimDirty ||
|
|
5736
5767
|
this.micro.dirty ||
|
|
5737
5768
|
this.inputWrapper.dirty ||
|
|
5738
5769
|
this.solverWrapper.dirty) {
|
|
5739
|
-
const trim = frame.trim;
|
|
5740
5770
|
const micro = this.micro;
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
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));
|
|
5744
5773
|
this.micro.setDirtyFalse();
|
|
5774
|
+
frame.setTextureDirtyFalse();
|
|
5775
|
+
frame.setUVTransformDirtyFalse();
|
|
5776
|
+
frame.setTrimDirtyFalse();
|
|
5777
|
+
this._private_currentFrameIndexDirty = false;
|
|
5745
5778
|
}
|
|
5746
5779
|
}
|
|
5747
5780
|
_private_subscribeSequenceEvents() {
|
|
@@ -5756,6 +5789,8 @@ class UIAnimatedImage extends UIElement {
|
|
|
5756
5789
|
}
|
|
5757
5790
|
}
|
|
5758
5791
|
|
|
5792
|
+
const GRAPHICS_TEMP_PROPERTIES = {};
|
|
5793
|
+
|
|
5759
5794
|
/** Canvas-based 2D drawing element */
|
|
5760
5795
|
class UIGraphics extends UIElement {
|
|
5761
5796
|
/**
|
|
@@ -5774,8 +5809,10 @@ class UIGraphics extends UIElement {
|
|
|
5774
5809
|
throw new Error("UIGraphics.constructor: failed to get 2D context from OffscreenCanvas");
|
|
5775
5810
|
}
|
|
5776
5811
|
const texture = new CanvasTexture(canvas);
|
|
5812
|
+
texture.colorSpace = SRGBColorSpace;
|
|
5777
5813
|
texture.minFilter = LinearFilter;
|
|
5778
5814
|
texture.magFilter = LinearFilter;
|
|
5815
|
+
texture.needsUpdate = true;
|
|
5779
5816
|
super(layer, source$4, {
|
|
5780
5817
|
texture: texture,
|
|
5781
5818
|
textureTransform: texture.matrix,
|
|
@@ -5858,13 +5895,19 @@ class UIGraphics extends UIElement {
|
|
|
5858
5895
|
}
|
|
5859
5896
|
onWillRender(renderer, deltaTime) {
|
|
5860
5897
|
if (this.color.dirty) {
|
|
5861
|
-
|
|
5898
|
+
GRAPHICS_TEMP_PROPERTIES["color"] = this.color;
|
|
5862
5899
|
this.color.setDirtyFalse();
|
|
5863
5900
|
}
|
|
5901
|
+
else {
|
|
5902
|
+
delete GRAPHICS_TEMP_PROPERTIES["color"];
|
|
5903
|
+
}
|
|
5904
|
+
this.sceneWrapper.setProperties(this.planeHandler, GRAPHICS_TEMP_PROPERTIES);
|
|
5864
5905
|
super.onWillRender(renderer, deltaTime);
|
|
5865
5906
|
}
|
|
5866
5907
|
}
|
|
5867
5908
|
|
|
5909
|
+
const IMAGE_TEMP_PROPERTIES = {};
|
|
5910
|
+
|
|
5868
5911
|
/** Textured image element */
|
|
5869
5912
|
class UIImage extends UIElement {
|
|
5870
5913
|
/**
|
|
@@ -5901,47 +5944,63 @@ class UIImage extends UIElement {
|
|
|
5901
5944
|
this.texture.off(UITextureViewEvent.DIMENSIONS_CHANGED, this._private_onTextureDimensionsChanged);
|
|
5902
5945
|
super.destroy();
|
|
5903
5946
|
}
|
|
5904
|
-
|
|
5905
|
-
if (this.
|
|
5906
|
-
this.
|
|
5907
|
-
texture: this.texture.texture,
|
|
5908
|
-
textureTransform: this.texture.calculateUVTransform(this._private_textureTransform),
|
|
5909
|
-
color: this.color,
|
|
5910
|
-
});
|
|
5947
|
+
setPlaneTransform() {
|
|
5948
|
+
if (this.color.dirty) {
|
|
5949
|
+
IMAGE_TEMP_PROPERTIES["color"] = this.color;
|
|
5911
5950
|
this.color.setDirtyFalse();
|
|
5912
5951
|
}
|
|
5913
|
-
|
|
5914
|
-
|
|
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 ||
|
|
5915
5973
|
this.inputWrapper.dirty ||
|
|
5916
|
-
this.solverWrapper.dirty
|
|
5917
|
-
|
|
5974
|
+
this.solverWrapper.dirty;
|
|
5975
|
+
if (isTransformDirty) {
|
|
5918
5976
|
const micro = this.micro;
|
|
5919
|
-
|
|
5920
|
-
this.
|
|
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));
|
|
5921
5979
|
this.micro.setDirtyFalse();
|
|
5980
|
+
this.texture.setTrimDirtyFalse();
|
|
5922
5981
|
}
|
|
5923
5982
|
}
|
|
5924
5983
|
}
|
|
5925
5984
|
|
|
5926
|
-
const
|
|
5985
|
+
const INSETS_DEFAULT_VALUE = 0;
|
|
5927
5986
|
|
|
5928
|
-
/**
|
|
5929
|
-
class
|
|
5987
|
+
/** Insets values for four sides */
|
|
5988
|
+
class UIInsets {
|
|
5930
5989
|
/**
|
|
5931
|
-
* Creates
|
|
5990
|
+
* Creates UIInsets instance.
|
|
5932
5991
|
*
|
|
5933
|
-
* @param config -
|
|
5992
|
+
* @param config - Insets configuration
|
|
5934
5993
|
*/
|
|
5935
5994
|
constructor(config) {
|
|
5936
5995
|
this._private_dirtyInternal = false;
|
|
5937
5996
|
if (config === undefined) {
|
|
5938
|
-
this._private_lInternal =
|
|
5939
|
-
this._private_rInternal =
|
|
5940
|
-
this._private_tInternal =
|
|
5941
|
-
this._private_bInternal =
|
|
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;
|
|
5942
6001
|
}
|
|
5943
6002
|
else if (typeof config === "number") {
|
|
5944
|
-
assertValidNonNegativeNumber(config, "
|
|
6003
|
+
assertValidNonNegativeNumber(config, "UIInsets.constructor.config");
|
|
5945
6004
|
this._private_lInternal = config;
|
|
5946
6005
|
this._private_rInternal = config;
|
|
5947
6006
|
this._private_tInternal = config;
|
|
@@ -5952,10 +6011,10 @@ class UIPadding {
|
|
|
5952
6011
|
const right = config.right;
|
|
5953
6012
|
const top = config.top;
|
|
5954
6013
|
const bottom = config.bottom;
|
|
5955
|
-
assertValidNonNegativeNumber(left, "
|
|
5956
|
-
assertValidNonNegativeNumber(right, "
|
|
5957
|
-
assertValidNonNegativeNumber(top, "
|
|
5958
|
-
assertValidNonNegativeNumber(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");
|
|
5959
6018
|
this._private_lInternal = left;
|
|
5960
6019
|
this._private_rInternal = right;
|
|
5961
6020
|
this._private_tInternal = top;
|
|
@@ -5964,27 +6023,27 @@ class UIPadding {
|
|
|
5964
6023
|
else {
|
|
5965
6024
|
const horizontal = config.horizontal;
|
|
5966
6025
|
const vertical = config.vertical;
|
|
5967
|
-
assertValidNonNegativeNumber(horizontal, "
|
|
5968
|
-
assertValidNonNegativeNumber(vertical, "
|
|
6026
|
+
assertValidNonNegativeNumber(horizontal, "UIInsets.constructor.config.horizontal");
|
|
6027
|
+
assertValidNonNegativeNumber(vertical, "UIInsets.constructor.config.vertical");
|
|
5969
6028
|
this._private_lInternal = horizontal;
|
|
5970
6029
|
this._private_rInternal = horizontal;
|
|
5971
6030
|
this._private_tInternal = vertical;
|
|
5972
6031
|
this._private_bInternal = vertical;
|
|
5973
6032
|
}
|
|
5974
6033
|
}
|
|
5975
|
-
/** Left
|
|
6034
|
+
/** Left inset */
|
|
5976
6035
|
get left() {
|
|
5977
6036
|
return this._private_lInternal;
|
|
5978
6037
|
}
|
|
5979
|
-
/** Right
|
|
6038
|
+
/** Right inset */
|
|
5980
6039
|
get right() {
|
|
5981
6040
|
return this._private_rInternal;
|
|
5982
6041
|
}
|
|
5983
|
-
/** Top
|
|
6042
|
+
/** Top inset */
|
|
5984
6043
|
get top() {
|
|
5985
6044
|
return this._private_tInternal;
|
|
5986
6045
|
}
|
|
5987
|
-
/** Bottom
|
|
6046
|
+
/** Bottom inset */
|
|
5988
6047
|
get bottom() {
|
|
5989
6048
|
return this._private_bInternal;
|
|
5990
6049
|
}
|
|
@@ -5992,33 +6051,33 @@ class UIPadding {
|
|
|
5992
6051
|
get dirty() {
|
|
5993
6052
|
return this._private_dirtyInternal;
|
|
5994
6053
|
}
|
|
5995
|
-
/** Left
|
|
6054
|
+
/** Left inset */
|
|
5996
6055
|
set left(value) {
|
|
5997
|
-
assertValidNonNegativeNumber(value, "
|
|
6056
|
+
assertValidNonNegativeNumber(value, "UIInsets.left");
|
|
5998
6057
|
if (this._private_lInternal !== value) {
|
|
5999
6058
|
this._private_lInternal = value;
|
|
6000
6059
|
this._private_dirtyInternal = true;
|
|
6001
6060
|
}
|
|
6002
6061
|
}
|
|
6003
|
-
/** Right
|
|
6062
|
+
/** Right inset */
|
|
6004
6063
|
set right(value) {
|
|
6005
|
-
assertValidNonNegativeNumber(value, "
|
|
6064
|
+
assertValidNonNegativeNumber(value, "UIInsets.right");
|
|
6006
6065
|
if (this._private_rInternal !== value) {
|
|
6007
6066
|
this._private_rInternal = value;
|
|
6008
6067
|
this._private_dirtyInternal = true;
|
|
6009
6068
|
}
|
|
6010
6069
|
}
|
|
6011
|
-
/** Top
|
|
6070
|
+
/** Top inset */
|
|
6012
6071
|
set top(value) {
|
|
6013
|
-
assertValidNonNegativeNumber(value, "
|
|
6072
|
+
assertValidNonNegativeNumber(value, "UIInsets.top");
|
|
6014
6073
|
if (this._private_tInternal !== value) {
|
|
6015
6074
|
this._private_tInternal = value;
|
|
6016
6075
|
this._private_dirtyInternal = true;
|
|
6017
6076
|
}
|
|
6018
6077
|
}
|
|
6019
|
-
/** Bottom
|
|
6078
|
+
/** Bottom inset */
|
|
6020
6079
|
set bottom(value) {
|
|
6021
|
-
assertValidNonNegativeNumber(value, "
|
|
6080
|
+
assertValidNonNegativeNumber(value, "UIInsets.bottom");
|
|
6022
6081
|
if (this._private_bInternal !== value) {
|
|
6023
6082
|
this._private_bInternal = value;
|
|
6024
6083
|
this._private_dirtyInternal = true;
|
|
@@ -6026,7 +6085,7 @@ class UIPadding {
|
|
|
6026
6085
|
}
|
|
6027
6086
|
/** Sets left and right to same value */
|
|
6028
6087
|
setHorizontal(value) {
|
|
6029
|
-
assertValidNonNegativeNumber(value, "
|
|
6088
|
+
assertValidNonNegativeNumber(value, "UIInsets.setHorizontal.value");
|
|
6030
6089
|
if (this._private_lInternal !== value || this._private_rInternal !== value) {
|
|
6031
6090
|
this._private_lInternal = value;
|
|
6032
6091
|
this._private_rInternal = value;
|
|
@@ -6035,7 +6094,7 @@ class UIPadding {
|
|
|
6035
6094
|
}
|
|
6036
6095
|
/** Sets top and bottom to same value */
|
|
6037
6096
|
setVertical(value) {
|
|
6038
|
-
assertValidNonNegativeNumber(value, "
|
|
6097
|
+
assertValidNonNegativeNumber(value, "UIInsets.setVertical.value");
|
|
6039
6098
|
if (this._private_tInternal !== value || this._private_bInternal !== value) {
|
|
6040
6099
|
this._private_tInternal = value;
|
|
6041
6100
|
this._private_bInternal = value;
|
|
@@ -6044,7 +6103,7 @@ class UIPadding {
|
|
|
6044
6103
|
}
|
|
6045
6104
|
/** Sets all sides to same value */
|
|
6046
6105
|
setUnified(value) {
|
|
6047
|
-
assertValidNonNegativeNumber(value, "
|
|
6106
|
+
assertValidNonNegativeNumber(value, "UIInsets.setUnified.value");
|
|
6048
6107
|
if (this._private_lInternal !== value ||
|
|
6049
6108
|
this._private_rInternal !== value ||
|
|
6050
6109
|
this._private_tInternal !== value ||
|
|
@@ -6058,10 +6117,10 @@ class UIPadding {
|
|
|
6058
6117
|
}
|
|
6059
6118
|
/** Sets from Vector4 (x=left, y=right, z=top, w=bottom) */
|
|
6060
6119
|
setVector4(vector) {
|
|
6061
|
-
assertValidNonNegativeNumber(vector.x, "
|
|
6062
|
-
assertValidNonNegativeNumber(vector.y, "
|
|
6063
|
-
assertValidNonNegativeNumber(vector.z, "
|
|
6064
|
-
assertValidNonNegativeNumber(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");
|
|
6065
6124
|
if (this._private_lInternal !== vector.x ||
|
|
6066
6125
|
this._private_rInternal !== vector.y ||
|
|
6067
6126
|
this._private_tInternal !== vector.z ||
|
|
@@ -6130,8 +6189,8 @@ class UINineSlice extends UIElement {
|
|
|
6130
6189
|
const textureTransform = textureView.calculateUVTransform();
|
|
6131
6190
|
options.width = options.width ?? textureView.width;
|
|
6132
6191
|
options.height = options.height ?? textureView.height;
|
|
6133
|
-
const sliceBorders = new
|
|
6134
|
-
const sliceRegions = new
|
|
6192
|
+
const sliceBorders = new UIInsets(options.sliceBorders ?? NINE_SLICE_DEFAULT_BORDER);
|
|
6193
|
+
const sliceRegions = new UIInsets(options.sliceRegions ?? NINE_SLICE_DEFAULT_BORDER);
|
|
6135
6194
|
const regionMode = options.regionMode ?? NINE_SLICE_DEFAULT_REGION_MODE;
|
|
6136
6195
|
const sliceBordersVector = new Vector4();
|
|
6137
6196
|
const sliceRegionsVector = new Vector4();
|
|
@@ -6167,9 +6226,11 @@ class UINineSlice extends UIElement {
|
|
|
6167
6226
|
this._private_regionModeDirty = true;
|
|
6168
6227
|
}
|
|
6169
6228
|
}
|
|
6170
|
-
|
|
6229
|
+
setPlaneTransform() {
|
|
6171
6230
|
if (this._private_regionModeDirty ||
|
|
6172
|
-
this.texture.
|
|
6231
|
+
this.texture.textureDirty ||
|
|
6232
|
+
this.texture.uvTransformDirty ||
|
|
6233
|
+
this.texture.trimDirty ||
|
|
6173
6234
|
this.color.dirty ||
|
|
6174
6235
|
this.sliceBorders.dirty ||
|
|
6175
6236
|
this.sliceRegions.dirty ||
|
|
@@ -6190,14 +6251,18 @@ class UINineSlice extends UIElement {
|
|
|
6190
6251
|
this.sliceRegions.setDirtyFalse();
|
|
6191
6252
|
this._private_setDimensionsDirtyFalse();
|
|
6192
6253
|
}
|
|
6193
|
-
if (this.texture.
|
|
6254
|
+
if (this.texture.textureDirty ||
|
|
6255
|
+
this.texture.uvTransformDirty ||
|
|
6256
|
+
this.texture.trimDirty ||
|
|
6194
6257
|
this.micro.dirty ||
|
|
6195
6258
|
this.inputWrapper.dirty ||
|
|
6196
6259
|
this.solverWrapper.dirty) {
|
|
6197
6260
|
const trim = this.texture.trim;
|
|
6198
6261
|
const micro = this.micro;
|
|
6199
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));
|
|
6200
|
-
this.texture.
|
|
6263
|
+
this.texture.setTextureDirtyFalse();
|
|
6264
|
+
this.texture.setUVTransformDirtyFalse();
|
|
6265
|
+
this.texture.setTrimDirtyFalse();
|
|
6201
6266
|
this.micro.setDirtyFalse();
|
|
6202
6267
|
}
|
|
6203
6268
|
}
|
|
@@ -6307,6 +6372,7 @@ class UIProgressMaskFunctionDirectional extends UIProgressMaskFunction {
|
|
|
6307
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;}";
|
|
6308
6373
|
|
|
6309
6374
|
const PROGRESS_DEFAULT_VALUE = 1;
|
|
6375
|
+
const PROGRESS_TEMP_PROPERTIES = {};
|
|
6310
6376
|
function simplifyGLSLSource(source) {
|
|
6311
6377
|
return source
|
|
6312
6378
|
.replace(/\/\*[\s\S]*?\*\//g, "")
|
|
@@ -6345,10 +6411,14 @@ class UIProgress extends UIElement {
|
|
|
6345
6411
|
progress,
|
|
6346
6412
|
...maskFunction.enumerateProperties(),
|
|
6347
6413
|
}, options);
|
|
6348
|
-
this.
|
|
6414
|
+
this._private_progressDirty = false;
|
|
6415
|
+
this._private_textureResolutionDirty = false;
|
|
6349
6416
|
this._private_onTextureDimensionsChanged = (width, height) => {
|
|
6350
|
-
this.width
|
|
6351
|
-
|
|
6417
|
+
if (this.width !== width || this.height !== height) {
|
|
6418
|
+
this.width = width;
|
|
6419
|
+
this.height = height;
|
|
6420
|
+
this._private_textureResolutionDirty = true;
|
|
6421
|
+
}
|
|
6352
6422
|
};
|
|
6353
6423
|
this.texture = textureView;
|
|
6354
6424
|
this._private_textureTransform = textureTransform;
|
|
@@ -6366,32 +6436,70 @@ class UIProgress extends UIElement {
|
|
|
6366
6436
|
set progress(value) {
|
|
6367
6437
|
if (this._private_progressInternal !== value) {
|
|
6368
6438
|
this._private_progressInternal = value;
|
|
6369
|
-
this.
|
|
6439
|
+
this._private_progressDirty = true;
|
|
6370
6440
|
}
|
|
6371
6441
|
}
|
|
6372
|
-
|
|
6373
|
-
if (this.
|
|
6374
|
-
this.
|
|
6375
|
-
this.color.dirty ||
|
|
6376
|
-
this.maskFunction.dirty) {
|
|
6377
|
-
this.sceneWrapper.setProperties(this.planeHandler, {
|
|
6378
|
-
texture: this.texture.texture,
|
|
6379
|
-
textureTransform: this.texture.calculateUVTransform(this._private_textureTransform),
|
|
6380
|
-
textureResolution: this.texture.getResolution(this._private_textureResolution),
|
|
6381
|
-
color: this.color,
|
|
6382
|
-
progress: this._private_progressInternal,
|
|
6383
|
-
});
|
|
6384
|
-
this._private_dirty = false;
|
|
6442
|
+
setPlaneTransform() {
|
|
6443
|
+
if (this.color.dirty) {
|
|
6444
|
+
PROGRESS_TEMP_PROPERTIES["color"] = this.color;
|
|
6385
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
|
+
}
|
|
6386
6485
|
this.maskFunction.setDirtyFalse();
|
|
6387
6486
|
}
|
|
6388
|
-
|
|
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 ||
|
|
6389
6495
|
this.inputWrapper.dirty ||
|
|
6390
|
-
this.
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
this.texture.
|
|
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));
|
|
6394
6501
|
this.micro.setDirtyFalse();
|
|
6502
|
+
this.texture.setTrimDirtyFalse();
|
|
6395
6503
|
}
|
|
6396
6504
|
}
|
|
6397
6505
|
}
|
|
@@ -7209,6 +7317,8 @@ class UIText extends UIElement {
|
|
|
7209
7317
|
throw new Error("UIText.constructor: failed to create canvas context");
|
|
7210
7318
|
}
|
|
7211
7319
|
const texture = new CanvasTexture(canvas);
|
|
7320
|
+
texture.colorSpace = SRGBColorSpace;
|
|
7321
|
+
texture.needsUpdate = true;
|
|
7212
7322
|
const color = new UIColor(options.color);
|
|
7213
7323
|
super(layer, source$4, {
|
|
7214
7324
|
texture: texture,
|
|
@@ -7222,7 +7332,7 @@ class UIText extends UIElement {
|
|
|
7222
7332
|
this._private_textChunks = [];
|
|
7223
7333
|
this._private_textChunksDirty = false;
|
|
7224
7334
|
this.color = color;
|
|
7225
|
-
this.padding = new
|
|
7335
|
+
this.padding = new UIInsets(options.padding);
|
|
7226
7336
|
this.commonStyle = new UITextStyle(options.commonStyle);
|
|
7227
7337
|
this._private_maxLineWidthInternal =
|
|
7228
7338
|
options.maxLineWidth ?? TEXT_DEFAULT_MAX_LINE_WIDTH;
|
|
@@ -7397,6 +7507,7 @@ class UIText extends UIElement {
|
|
|
7397
7507
|
_private_rebuildTexture() {
|
|
7398
7508
|
this._private_texture.dispose();
|
|
7399
7509
|
this._private_texture = new CanvasTexture(this._private_canvas);
|
|
7510
|
+
this._private_texture.colorSpace = SRGBColorSpace;
|
|
7400
7511
|
this._private_texture.needsUpdate = true;
|
|
7401
7512
|
this.sceneWrapper.setProperties(this.planeHandler, {
|
|
7402
7513
|
texture: this._private_texture,
|
|
@@ -8011,5 +8122,5 @@ class UIResizePolicyFixedWidth extends UIResizePolicy {
|
|
|
8011
8122
|
}
|
|
8012
8123
|
}
|
|
8013
8124
|
|
|
8014
|
-
export { UIAnchor, UIAnimatedImage, UIAreaCircle, UIAreaPolygon, UIAreaRectangle, UIAreaRoundedRectangle, UIAspectConstraint, UIColor, UIConstraint2DBuilder, UICoverConstraintBuilder, UICustomConstraint,
|
|
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 };
|
|
8015
8126
|
//# sourceMappingURL=index.js.map
|