modern-canvas 0.10.3 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1131,6 +1131,9 @@ class Vector extends Observable {
1131
1131
  toArray() {
1132
1132
  return this._array.slice();
1133
1133
  }
1134
+ toFloat32Array() {
1135
+ return new Float32Array(this._array);
1136
+ }
1134
1137
  toJSON() {
1135
1138
  return this.toArray();
1136
1139
  }
@@ -1268,6 +1271,9 @@ class Matrix extends Observable {
1268
1271
  }
1269
1272
  return array.slice();
1270
1273
  }
1274
+ toFloat32Array(transpose) {
1275
+ return new Float32Array(this.toArray(transpose));
1276
+ }
1271
1277
  toName() {
1272
1278
  return `Matrix${this.rows}(${this.rows}x${this.cols})`;
1273
1279
  }
@@ -2091,13 +2097,13 @@ class Vector3 extends Vector {
2091
2097
  }
2092
2098
  }
2093
2099
 
2094
- var __defProp$T = Object.defineProperty;
2095
- var __decorateClass$$ = (decorators, target, key, kind) => {
2100
+ var __defProp$Q = Object.defineProperty;
2101
+ var __decorateClass$U = (decorators, target, key, kind) => {
2096
2102
  var result = void 0 ;
2097
2103
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
2098
2104
  if (decorator = decorators[i])
2099
2105
  result = (decorator(target, key, result) ) || result;
2100
- if (result) __defProp$T(target, key, result);
2106
+ if (result) __defProp$Q(target, key, result);
2101
2107
  return result;
2102
2108
  };
2103
2109
  class MainLoop extends CoreObject {
@@ -2145,20 +2151,20 @@ class MainLoop extends CoreObject {
2145
2151
  super.destroy();
2146
2152
  }
2147
2153
  }
2148
- __decorateClass$$([
2154
+ __decorateClass$U([
2149
2155
  property({ fallback: 60 })
2150
2156
  ], MainLoop.prototype, "fps");
2151
- __decorateClass$$([
2157
+ __decorateClass$U([
2152
2158
  property({ fallback: 1 })
2153
2159
  ], MainLoop.prototype, "speed");
2154
2160
 
2155
- var __defProp$S = Object.defineProperty;
2156
- var __decorateClass$_ = (decorators, target, key, kind) => {
2161
+ var __defProp$P = Object.defineProperty;
2162
+ var __decorateClass$T = (decorators, target, key, kind) => {
2157
2163
  var result = void 0 ;
2158
2164
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
2159
2165
  if (decorator = decorators[i])
2160
2166
  result = (decorator(target, key, result) ) || result;
2161
- if (result) __defProp$S(target, key, result);
2167
+ if (result) __defProp$P(target, key, result);
2162
2168
  return result;
2163
2169
  };
2164
2170
  class Renderer extends Reactivable {
@@ -2202,10 +2208,10 @@ class Renderer extends Reactivable {
2202
2208
  super.destroy();
2203
2209
  }
2204
2210
  }
2205
- __decorateClass$_([
2211
+ __decorateClass$T([
2206
2212
  property({ fallback: DEVICE_PIXEL_RATIO })
2207
2213
  ], Renderer.prototype, "pixelRatio");
2208
- __decorateClass$_([
2214
+ __decorateClass$T([
2209
2215
  property({ internal: true })
2210
2216
  ], Renderer.prototype, "view");
2211
2217
 
@@ -2437,6 +2443,8 @@ class WebGLBatch2DModule extends WebGLModule {
2437
2443
  // 1
2438
2444
  aPosition: { size: 2, normalized: false, type: "float" },
2439
2445
  // 2
2446
+ aDimension: { size: 2, normalized: false, type: "float" },
2447
+ // 2
2440
2448
  aUv: { size: 2, normalized: false, type: "float" },
2441
2449
  // 2
2442
2450
  aModulate: { size: 4, normalized: true, type: "unsigned_byte" },
@@ -2446,7 +2454,7 @@ class WebGLBatch2DModule extends WebGLModule {
2446
2454
  aDisableWrapMode: { size: 1, normalized: true, type: "float" }
2447
2455
  // 1
2448
2456
  };
2449
- _vertexSize = 1 + 2 + 2 + 1 + 1 + 1;
2457
+ _vertexSize = 1 + 2 + 2 + 2 + 1 + 1 + 1;
2450
2458
  _getShader(maxTextureUnits) {
2451
2459
  let shader = this._shaders.get(maxTextureUnits);
2452
2460
  if (!shader) {
@@ -2460,6 +2468,7 @@ class WebGLBatch2DModule extends WebGLModule {
2460
2468
  vert: `precision highp float;
2461
2469
  attribute float aTextureId;
2462
2470
  attribute vec2 aPosition;
2471
+ attribute vec2 aDimension;
2463
2472
  attribute vec2 aUv;
2464
2473
  attribute vec4 aModulate;
2465
2474
  attribute vec4 aBackgroundColor;
@@ -2468,30 +2477,20 @@ attribute float aDisableWrapMode;
2468
2477
  uniform mat3 projectionMatrix;
2469
2478
  uniform mat3 viewMatrix;
2470
2479
  uniform vec4 modulate;
2471
- uniform float canvasWidth;
2472
- uniform float canvasHeight;
2473
2480
 
2474
2481
  varying float vTextureId;
2482
+ varying vec2 vDimension;
2475
2483
  varying vec2 vUv;
2476
2484
  varying vec4 vModulate;
2477
2485
  varying vec4 vBackgroundColor;
2478
2486
  varying float vDisableWrapMode;
2479
2487
 
2480
- vec2 roundPixels(vec2 position, vec2 targetSize) {
2481
- return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
2482
- }
2483
-
2484
2488
  void main(void) {
2485
- mat3 modelMatrix = mat3(
2486
- 1.0, 0.0, 0.0,
2487
- 0.0, 1.0, 0.0,
2488
- 0.0, 0.0, 1.0
2489
- );
2490
- vTextureId = aTextureId;
2491
- vec3 pos = projectionMatrix * viewMatrix * modelMatrix * vec3(aPosition, 1.0);
2492
- gl_Position = vec4(roundPixels(pos.xy, vec2(canvasWidth, canvasHeight)), 0.0, 1.0);
2493
- // gl_Position = vec4(pos.xy, 0.0, 1.0);
2489
+ vec3 pos3 = projectionMatrix * viewMatrix * vec3(aPosition.xy, 1.0);
2490
+ gl_Position = vec4(pos3.xy, 0.0, 1.0);
2494
2491
 
2492
+ vTextureId = aTextureId;
2493
+ vDimension = aDimension;
2495
2494
  vUv = aUv;
2496
2495
  vModulate = aModulate * modulate;
2497
2496
  vBackgroundColor = aBackgroundColor;
@@ -2499,16 +2498,27 @@ void main(void) {
2499
2498
  }`,
2500
2499
  frag: `precision highp float;
2501
2500
  varying float vTextureId;
2501
+ varying vec2 vDimension;
2502
2502
  varying vec2 vUv;
2503
2503
  varying vec4 vModulate;
2504
2504
  varying vec4 vBackgroundColor;
2505
2505
  varying float vDisableWrapMode;
2506
2506
 
2507
+ uniform mat3 viewMatrix;
2507
2508
  uniform sampler2D samplers[${maxTextureUnits}];
2509
+ uniform vec2 zoom;
2510
+ uniform vec2 translate;
2508
2511
 
2509
2512
  void main(void) {
2513
+ vec2 uv = vUv;
2514
+
2515
+ if (vDimension.x > 0.0 && vDimension.y > 0.0) {
2516
+ uv = floor(uv * vDimension);
2517
+ uv = uv / vDimension;
2518
+ }
2519
+
2510
2520
  vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
2511
- if (vDisableWrapMode > 0.0 && (vUv.x < 0.0 || vUv.y < 0.0 || vUv.x > 1.0 || vUv.y > 1.0))
2521
+ if (vDisableWrapMode > 0.0 && (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0 || uv.y > 1.0))
2512
2522
  {
2513
2523
  //
2514
2524
  }
@@ -2527,7 +2537,7 @@ void main(void) {
2527
2537
  }
2528
2538
  return `${text}
2529
2539
  {
2530
- color = texture2D(samplers[${i}], vUv);
2540
+ color = texture2D(samplers[${i}], uv);
2531
2541
  }`;
2532
2542
  }).join("")}
2533
2543
 
@@ -2573,11 +2583,12 @@ void main(void) {
2573
2583
  draw: (options) => {
2574
2584
  const renderer2 = this._renderer;
2575
2585
  renderer2.program.bind(program);
2586
+ const viewMatrix = renderer2.program.uniforms.viewMatrix;
2576
2587
  renderer2.program.updateUniforms(program, {
2577
2588
  samplers,
2578
2589
  modulate: [1, 1, 1, 1],
2579
- canvasWidth: renderer2.gl.drawingBufferWidth,
2580
- canvasHeight: renderer2.gl.drawingBufferHeight,
2590
+ zoom: [viewMatrix[0], viewMatrix[4]],
2591
+ translate: [viewMatrix[6], viewMatrix[7]],
2581
2592
  ...renderer2.program.uniforms
2582
2593
  });
2583
2594
  renderer2.vertexArray.bind(vao ?? vertexArray);
@@ -2634,7 +2645,8 @@ void main(void) {
2634
2645
  const {
2635
2646
  indices,
2636
2647
  vertices,
2637
- uvs = [],
2648
+ uvs = new Float32Array(0),
2649
+ dimension = new Float32Array(0),
2638
2650
  texture: texture2,
2639
2651
  modulate = this._defaultModulate,
2640
2652
  backgroundColor = this._defaultBackgroundColor,
@@ -2656,6 +2668,8 @@ void main(void) {
2656
2668
  float32View[aIndex++] = textureLocation;
2657
2669
  float32View[aIndex++] = vertices[i2];
2658
2670
  float32View[aIndex++] = vertices[i2 + 1];
2671
+ float32View[aIndex++] = dimension[0];
2672
+ float32View[aIndex++] = dimension[1];
2659
2673
  float32View[aIndex++] = uvs[i2];
2660
2674
  float32View[aIndex++] = uvs[i2 + 1];
2661
2675
  if (modulate) {
@@ -2713,11 +2727,6 @@ void main(void) {
2713
2727
  });
2714
2728
  }
2715
2729
  }
2716
- /**
2717
- * Fetches an attribute buffer from `this._attributeBuffer` that can hold atleast `size` floats.
2718
- * @param size - minimum capacity required
2719
- * @returns - buffer than can hold atleast `size` floats
2720
- */
2721
2730
  _getAttributeBuffer(size) {
2722
2731
  const roundedP2 = nextPow2(Math.ceil(size / 8));
2723
2732
  const roundedSizeIndex = log2(roundedP2);
@@ -2731,12 +2740,6 @@ void main(void) {
2731
2740
  }
2732
2741
  return buffer;
2733
2742
  }
2734
- /**
2735
- * Fetches an index buffer from `this._indexBuffers` that can
2736
- * have at least `size` capacity.
2737
- * @param size - minimum required capacity
2738
- * @returns - buffer that can fit `size` indices.
2739
- */
2740
2743
  _getIndexBuffer(size) {
2741
2744
  const roundedP2 = nextPow2(Math.ceil(size / 12));
2742
2745
  const roundedSizeIndex = log2(roundedP2);
@@ -4405,13 +4408,13 @@ class Geometry extends Resource {
4405
4408
  }
4406
4409
  }
4407
4410
 
4408
- var __defProp$R = Object.defineProperty;
4409
- var __decorateClass$Z = (decorators, target, key, kind) => {
4411
+ var __defProp$O = Object.defineProperty;
4412
+ var __decorateClass$S = (decorators, target, key, kind) => {
4410
4413
  var result = void 0 ;
4411
4414
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4412
4415
  if (decorator = decorators[i])
4413
4416
  result = (decorator(target, key, result) ) || result;
4414
- if (result) __defProp$R(target, key, result);
4417
+ if (result) __defProp$O(target, key, result);
4415
4418
  return result;
4416
4419
  };
4417
4420
  class IndexBuffer extends Resource {
@@ -4455,20 +4458,20 @@ class IndexBuffer extends Resource {
4455
4458
  return result;
4456
4459
  }
4457
4460
  }
4458
- __decorateClass$Z([
4461
+ __decorateClass$S([
4459
4462
  property({ internal: true, fallback: null })
4460
4463
  ], IndexBuffer.prototype, "data");
4461
- __decorateClass$Z([
4464
+ __decorateClass$S([
4462
4465
  property({ internal: true, fallback: false })
4463
4466
  ], IndexBuffer.prototype, "dynamic");
4464
4467
 
4465
- var __defProp$Q = Object.defineProperty;
4466
- var __decorateClass$Y = (decorators, target, key, kind) => {
4468
+ var __defProp$N = Object.defineProperty;
4469
+ var __decorateClass$R = (decorators, target, key, kind) => {
4467
4470
  var result = void 0 ;
4468
4471
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4469
4472
  if (decorator = decorators[i])
4470
4473
  result = (decorator(target, key, result) ) || result;
4471
- if (result) __defProp$Q(target, key, result);
4474
+ if (result) __defProp$N(target, key, result);
4472
4475
  return result;
4473
4476
  };
4474
4477
  class VertexBuffer extends Resource {
@@ -4512,20 +4515,20 @@ class VertexBuffer extends Resource {
4512
4515
  return result;
4513
4516
  }
4514
4517
  }
4515
- __decorateClass$Y([
4518
+ __decorateClass$R([
4516
4519
  property({ internal: true, default: null })
4517
4520
  ], VertexBuffer.prototype, "data");
4518
- __decorateClass$Y([
4521
+ __decorateClass$R([
4519
4522
  property({ internal: true, fallback: false })
4520
4523
  ], VertexBuffer.prototype, "dynamic");
4521
4524
 
4522
- var __defProp$P = Object.defineProperty;
4523
- var __decorateClass$X = (decorators, target, key, kind) => {
4525
+ var __defProp$M = Object.defineProperty;
4526
+ var __decorateClass$Q = (decorators, target, key, kind) => {
4524
4527
  var result = void 0 ;
4525
4528
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4526
4529
  if (decorator = decorators[i])
4527
4530
  result = (decorator(target, key, result) ) || result;
4528
- if (result) __defProp$P(target, key, result);
4531
+ if (result) __defProp$M(target, key, result);
4529
4532
  return result;
4530
4533
  };
4531
4534
  class VertexAttribute extends Resource {
@@ -4559,25 +4562,25 @@ class VertexAttribute extends Resource {
4559
4562
  return result;
4560
4563
  }
4561
4564
  }
4562
- __decorateClass$X([
4565
+ __decorateClass$Q([
4563
4566
  property({ internal: true })
4564
4567
  ], VertexAttribute.prototype, "buffer");
4565
- __decorateClass$X([
4568
+ __decorateClass$Q([
4566
4569
  property({ fallback: 0 })
4567
4570
  ], VertexAttribute.prototype, "size");
4568
- __decorateClass$X([
4571
+ __decorateClass$Q([
4569
4572
  property({ fallback: false })
4570
4573
  ], VertexAttribute.prototype, "normalized");
4571
- __decorateClass$X([
4574
+ __decorateClass$Q([
4572
4575
  property({ fallback: "float" })
4573
4576
  ], VertexAttribute.prototype, "type");
4574
- __decorateClass$X([
4577
+ __decorateClass$Q([
4575
4578
  property()
4576
4579
  ], VertexAttribute.prototype, "stride");
4577
- __decorateClass$X([
4580
+ __decorateClass$Q([
4578
4581
  property()
4579
4582
  ], VertexAttribute.prototype, "offset");
4580
- __decorateClass$X([
4583
+ __decorateClass$Q([
4581
4584
  property()
4582
4585
  ], VertexAttribute.prototype, "divisor");
4583
4586
 
@@ -4821,13 +4824,13 @@ class UvGeometry extends Geometry {
4821
4824
  }
4822
4825
  }
4823
4826
 
4824
- var __defProp$O = Object.defineProperty;
4825
- var __decorateClass$W = (decorators, target, key, kind) => {
4827
+ var __defProp$L = Object.defineProperty;
4828
+ var __decorateClass$P = (decorators, target, key, kind) => {
4826
4829
  var result = void 0 ;
4827
4830
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4828
4831
  if (decorator = decorators[i])
4829
4832
  result = (decorator(target, key, result) ) || result;
4830
- if (result) __defProp$O(target, key, result);
4833
+ if (result) __defProp$L(target, key, result);
4831
4834
  return result;
4832
4835
  };
4833
4836
  class Texture2D extends Resource {
@@ -4851,9 +4854,6 @@ class Texture2D extends Resource {
4851
4854
  }
4852
4855
  _isPowerOfTwo = false;
4853
4856
  _needsUpload = false;
4854
- get valid() {
4855
- return Boolean(this.width && this.height);
4856
- }
4857
4857
  get realWidth() {
4858
4858
  return Math.round(this.width * this.pixelRatio);
4859
4859
  }
@@ -4865,6 +4865,9 @@ class Texture2D extends Resource {
4865
4865
  this.source = source;
4866
4866
  this._updateSize();
4867
4867
  }
4868
+ isValid() {
4869
+ return Boolean(this.width && this.height);
4870
+ }
4868
4871
  /** @internal */
4869
4872
  _glTextureOptions(renderer, options) {
4870
4873
  let wrapMode = this.wrapMode;
@@ -4924,7 +4927,7 @@ class Texture2D extends Resource {
4924
4927
  this._needsUpload = true;
4925
4928
  }
4926
4929
  upload(renderer, options) {
4927
- if (this._needsUpload && this.valid) {
4930
+ if (this._needsUpload && this.isValid()) {
4928
4931
  this._needsUpload = false;
4929
4932
  renderer.texture.update(
4930
4933
  this._glTexture(renderer, options),
@@ -4935,7 +4938,7 @@ class Texture2D extends Resource {
4935
4938
  return false;
4936
4939
  }
4937
4940
  activate(renderer, location = 0) {
4938
- if (this.valid) {
4941
+ if (this.isValid()) {
4939
4942
  renderer.texture.bind({
4940
4943
  target: "texture_2d",
4941
4944
  value: this._glTexture(renderer, { location }),
@@ -4955,22 +4958,22 @@ class Texture2D extends Resource {
4955
4958
  }
4956
4959
  }
4957
4960
  }
4958
- __decorateClass$W([
4961
+ __decorateClass$P([
4959
4962
  property({ internal: true })
4960
4963
  ], Texture2D.prototype, "source");
4961
- __decorateClass$W([
4964
+ __decorateClass$P([
4962
4965
  property({ fallback: 0 })
4963
4966
  ], Texture2D.prototype, "width");
4964
- __decorateClass$W([
4967
+ __decorateClass$P([
4965
4968
  property({ fallback: 0 })
4966
4969
  ], Texture2D.prototype, "height");
4967
- __decorateClass$W([
4970
+ __decorateClass$P([
4968
4971
  property({ fallback: "linear" })
4969
4972
  ], Texture2D.prototype, "filterMode");
4970
- __decorateClass$W([
4973
+ __decorateClass$P([
4971
4974
  property({ fallback: "clamp_to_edge" })
4972
4975
  ], Texture2D.prototype, "wrapMode");
4973
- __decorateClass$W([
4976
+ __decorateClass$P([
4974
4977
  property({ fallback: 1 })
4975
4978
  ], Texture2D.prototype, "pixelRatio");
4976
4979
 
@@ -5004,13 +5007,13 @@ class AnimatedTexture extends Resource {
5004
5007
  }
5005
5008
  }
5006
5009
 
5007
- var __defProp$N = Object.defineProperty;
5008
- var __decorateClass$V = (decorators, target, key, kind) => {
5010
+ var __defProp$K = Object.defineProperty;
5011
+ var __decorateClass$O = (decorators, target, key, kind) => {
5009
5012
  var result = void 0 ;
5010
5013
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5011
5014
  if (decorator = decorators[i])
5012
5015
  result = (decorator(target, key, result) ) || result;
5013
- if (result) __defProp$N(target, key, result);
5016
+ if (result) __defProp$K(target, key, result);
5014
5017
  return result;
5015
5018
  };
5016
5019
  class CanvasTexture extends Texture2D {
@@ -5029,7 +5032,7 @@ class CanvasTexture extends Texture2D {
5029
5032
  super._updateProperty(key, value, oldValue);
5030
5033
  }
5031
5034
  }
5032
- __decorateClass$V([
5035
+ __decorateClass$O([
5033
5036
  property({ fallback: 2 })
5034
5037
  ], CanvasTexture.prototype, "pixelRatio");
5035
5038
 
@@ -5251,13 +5254,13 @@ class PixelsTexture extends Texture2D {
5251
5254
  }
5252
5255
  }
5253
5256
 
5254
- var __defProp$M = Object.defineProperty;
5255
- var __decorateClass$U = (decorators, target, key, kind) => {
5257
+ var __defProp$J = Object.defineProperty;
5258
+ var __decorateClass$N = (decorators, target, key, kind) => {
5256
5259
  var result = void 0 ;
5257
5260
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5258
5261
  if (decorator = decorators[i])
5259
5262
  result = (decorator(target, key, result) ) || result;
5260
- if (result) __defProp$M(target, key, result);
5263
+ if (result) __defProp$J(target, key, result);
5261
5264
  return result;
5262
5265
  };
5263
5266
  function resolveOptions(options) {
@@ -5362,7 +5365,7 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5362
5365
  }
5363
5366
  }
5364
5367
  _onPlayStart = () => {
5365
- if (!this.valid) {
5368
+ if (!this.isValid()) {
5366
5369
  this._onCanPlay();
5367
5370
  }
5368
5371
  this._setupAutoUpdate();
@@ -5374,7 +5377,7 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5374
5377
  const source = this.source;
5375
5378
  source.removeEventListener("canplay", this._onCanPlay);
5376
5379
  source.removeEventListener("canplaythrough", this._onCanPlay);
5377
- const valid = this.valid;
5380
+ const valid = this.isValid();
5378
5381
  this._nextTime = 0;
5379
5382
  this._updateSize();
5380
5383
  this.requestUpload();
@@ -5473,7 +5476,7 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5473
5476
  this._onCanPlay();
5474
5477
  }
5475
5478
  this._sourceLoad = new Promise((resolve, reject) => {
5476
- if (this.valid) {
5479
+ if (this.isValid()) {
5477
5480
  this._sourceLoad = void 0;
5478
5481
  resolve(this);
5479
5482
  } else {
@@ -5501,10 +5504,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5501
5504
  }
5502
5505
  }
5503
5506
  };
5504
- __decorateClass$U([
5507
+ __decorateClass$N([
5505
5508
  property({ internal: true, fallback: true })
5506
5509
  ], _VideoTexture.prototype, "autoUpdate");
5507
- __decorateClass$U([
5510
+ __decorateClass$N([
5508
5511
  property({ internal: true, fallback: 0 })
5509
5512
  ], _VideoTexture.prototype, "fps");
5510
5513
  let VideoTexture = _VideoTexture;
@@ -5639,7 +5642,6 @@ class CanvasContext extends Path2D {
5639
5642
  }
5640
5643
  buildUvs(start, vertices, uvs, texture, uvTransform) {
5641
5644
  if (texture) {
5642
- const _uvTransform = uvTransform ? typeof uvTransform === "function" ? uvTransform : (x, y) => uvTransform.apply({ x, y }).toArray() : uvTransform;
5643
5645
  const w = texture.width;
5644
5646
  const h = texture.height;
5645
5647
  for (let len = vertices.length, i = start; i < len; i += 2) {
@@ -5647,8 +5649,8 @@ class CanvasContext extends Path2D {
5647
5649
  const y = vertices[i + 1];
5648
5650
  let uvX;
5649
5651
  let uvY;
5650
- if (_uvTransform) {
5651
- [uvX, uvY] = _uvTransform(x, y);
5652
+ if (uvTransform) {
5653
+ [uvX, uvY] = uvTransform.apply({ x, y }).toArray();
5652
5654
  } else {
5653
5655
  [uvX, uvY] = [x / w, y / h];
5654
5656
  }
@@ -5684,6 +5686,7 @@ class CanvasContext extends Path2D {
5684
5686
  if (current.texture) {
5685
5687
  this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
5686
5688
  }
5689
+ const box = current.path.getBoundingBox();
5687
5690
  batchables.push({
5688
5691
  vertices: new Float32Array(vertices),
5689
5692
  indices: new Float32Array(indices),
@@ -5692,7 +5695,9 @@ class CanvasContext extends Path2D {
5692
5695
  backgroundColor: current.backgroundColor,
5693
5696
  type: current.type,
5694
5697
  disableWrapMode: current.disableWrapMode,
5695
- vertTransform: current.vertTransform
5698
+ uvTransform: current.uvTransform,
5699
+ vertTransform: current.vertTransform,
5700
+ dimension: new Float32Array([box.width, box.height])
5696
5701
  });
5697
5702
  }
5698
5703
  return batchables;
@@ -5794,14 +5799,14 @@ class Meta extends CoreObject {
5794
5799
  }
5795
5800
  }
5796
5801
 
5797
- var __defProp$L = Object.defineProperty;
5798
- var __getOwnPropDesc$J = Object.getOwnPropertyDescriptor;
5799
- var __decorateClass$T = (decorators, target, key, kind) => {
5800
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$J(target, key) : target;
5802
+ var __defProp$I = Object.defineProperty;
5803
+ var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
5804
+ var __decorateClass$M = (decorators, target, key, kind) => {
5805
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
5801
5806
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5802
5807
  if (decorator = decorators[i])
5803
5808
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5804
- if (kind && result) __defProp$L(target, key, result);
5809
+ if (kind && result) __defProp$I(target, key, result);
5805
5810
  return result;
5806
5811
  };
5807
5812
  const iidMap = {};
@@ -5902,9 +5907,6 @@ let Node = class extends CoreObject {
5902
5907
  }
5903
5908
  return this;
5904
5909
  }
5905
- log(...args) {
5906
- this._tree?.log(...args);
5907
- }
5908
5910
  /** Parent */
5909
5911
  _parent;
5910
5912
  get parent() {
@@ -6240,24 +6242,35 @@ let Node = class extends CoreObject {
6240
6242
  remove() {
6241
6243
  this._parent?.removeChild(this);
6242
6244
  }
6243
- forEachChild(callbackfn) {
6244
- this.children.forEach(callbackfn);
6245
- return this;
6245
+ findOne(callbackfn) {
6246
+ for (const child of this._children.default) {
6247
+ const value = callbackfn(child) || child.findOne(callbackfn);
6248
+ if (value) {
6249
+ return value;
6250
+ }
6251
+ }
6252
+ return void 0;
6246
6253
  }
6247
- forEachDescendant(callbackfn) {
6248
- this.children.forEach((child) => {
6249
- callbackfn(child);
6250
- child.forEachDescendant(callbackfn);
6251
- });
6252
- return this;
6254
+ findAll(callbackfn) {
6255
+ const items = [];
6256
+ for (const child of this._children.default) {
6257
+ const value = callbackfn(child);
6258
+ if (value) {
6259
+ items.push(value);
6260
+ }
6261
+ items.push(...child.findAll(callbackfn));
6262
+ }
6263
+ return items;
6253
6264
  }
6254
- forEachAncestor(callbackfn) {
6255
- const parent = this.parent;
6265
+ findAncestor(callbackfn) {
6266
+ const parent = this._parent;
6256
6267
  if (parent) {
6257
- callbackfn(parent);
6258
- parent.forEachAncestor(callbackfn);
6268
+ const value = callbackfn(parent) ?? parent.findAncestor(callbackfn);
6269
+ if (value) {
6270
+ return value;
6271
+ }
6259
6272
  }
6260
- return this;
6273
+ return void 0;
6261
6274
  }
6262
6275
  /** override */
6263
6276
  _ready() {
@@ -6315,42 +6328,42 @@ let Node = class extends CoreObject {
6315
6328
  return node;
6316
6329
  }
6317
6330
  };
6318
- __decorateClass$T([
6331
+ __decorateClass$M([
6319
6332
  property({ fallback: idGenerator() })
6320
6333
  ], Node.prototype, "id", 2);
6321
- __decorateClass$T([
6334
+ __decorateClass$M([
6322
6335
  property({ fallback: idGenerator() })
6323
6336
  ], Node.prototype, "name", 2);
6324
- __decorateClass$T([
6337
+ __decorateClass$M([
6325
6338
  property({ internal: true, fallback: "inherit" })
6326
6339
  ], Node.prototype, "processMode", 2);
6327
- __decorateClass$T([
6340
+ __decorateClass$M([
6328
6341
  property({ internal: true, fallback: "default" })
6329
6342
  ], Node.prototype, "processSortMode", 2);
6330
- __decorateClass$T([
6343
+ __decorateClass$M([
6331
6344
  property({ internal: true, fallback: "inherit" })
6332
6345
  ], Node.prototype, "renderMode", 2);
6333
- __decorateClass$T([
6346
+ __decorateClass$M([
6334
6347
  property({ internal: true, fallback: "inherit" })
6335
6348
  ], Node.prototype, "inputMode", 2);
6336
- __decorateClass$T([
6349
+ __decorateClass$M([
6337
6350
  property({ internal: true, fallback: "default" })
6338
6351
  ], Node.prototype, "internalMode", 2);
6339
- __decorateClass$T([
6352
+ __decorateClass$M([
6340
6353
  property({ internal: true })
6341
6354
  ], Node.prototype, "mask", 2);
6342
- Node = __decorateClass$T([
6355
+ Node = __decorateClass$M([
6343
6356
  customNode("Node")
6344
6357
  ], Node);
6345
6358
 
6346
- var __defProp$K = Object.defineProperty;
6347
- var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
6348
- var __decorateClass$S = (decorators, target, key, kind) => {
6349
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$I(target, key) : target;
6359
+ var __defProp$H = Object.defineProperty;
6360
+ var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
6361
+ var __decorateClass$L = (decorators, target, key, kind) => {
6362
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
6350
6363
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6351
6364
  if (decorator = decorators[i])
6352
6365
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6353
- if (kind && result) __defProp$K(target, key, result);
6366
+ if (kind && result) __defProp$H(target, key, result);
6354
6367
  return result;
6355
6368
  };
6356
6369
  let TimelineNode = class extends Node {
@@ -6398,9 +6411,15 @@ let TimelineNode = class extends Node {
6398
6411
  _updateCurrentTime(force = false) {
6399
6412
  if (force || !this.paused) {
6400
6413
  const parent = this._parent;
6401
- this._startTime = this.delay + this.parentStartTime;
6402
- this.computedDuration = parent?.computedDuration ? Math.min(this._startTime + this.duration, parent.endTime) - this._startTime : this.duration;
6403
- this._currentTime = this.timelineCurrentTime - this._startTime;
6414
+ const startTime = this.delay + this.parentStartTime;
6415
+ const endTime = parent?.computedDuration ? Math.min(startTime + this.duration, parent.endTime) - startTime : this.duration;
6416
+ let currentTime = this.timelineCurrentTime - startTime;
6417
+ if (this.loop) {
6418
+ currentTime = currentTime % endTime;
6419
+ }
6420
+ this._startTime = startTime;
6421
+ this._currentTime = currentTime;
6422
+ this.computedDuration = endTime;
6404
6423
  this.emit("updateCurrentTime", this._currentTime);
6405
6424
  this.insideTimeRange = this.isInsideTimeRange();
6406
6425
  }
@@ -6410,30 +6429,33 @@ let TimelineNode = class extends Node {
6410
6429
  this._updateCurrentTime();
6411
6430
  }
6412
6431
  };
6413
- __decorateClass$S([
6432
+ __decorateClass$L([
6433
+ property({ fallback: false })
6434
+ ], TimelineNode.prototype, "loop", 2);
6435
+ __decorateClass$L([
6414
6436
  property({ fallback: 0 })
6415
6437
  ], TimelineNode.prototype, "delay", 2);
6416
- __decorateClass$S([
6438
+ __decorateClass$L([
6417
6439
  property({ fallback: 0 })
6418
6440
  ], TimelineNode.prototype, "duration", 2);
6419
- __decorateClass$S([
6441
+ __decorateClass$L([
6420
6442
  property({ fallback: false })
6421
6443
  ], TimelineNode.prototype, "paused", 2);
6422
- __decorateClass$S([
6444
+ __decorateClass$L([
6423
6445
  property({ internal: true, fallback: false })
6424
6446
  ], TimelineNode.prototype, "insideTimeRange", 2);
6425
- TimelineNode = __decorateClass$S([
6447
+ TimelineNode = __decorateClass$L([
6426
6448
  customNode("TimelineNode")
6427
6449
  ], TimelineNode);
6428
6450
 
6429
- var __defProp$J = Object.defineProperty;
6430
- var __getOwnPropDesc$H = Object.getOwnPropertyDescriptor;
6431
- var __decorateClass$R = (decorators, target, key, kind) => {
6432
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$H(target, key) : target;
6451
+ var __defProp$G = Object.defineProperty;
6452
+ var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
6453
+ var __decorateClass$K = (decorators, target, key, kind) => {
6454
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
6433
6455
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6434
6456
  if (decorator = decorators[i])
6435
6457
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6436
- if (kind && result) __defProp$J(target, key, result);
6458
+ if (kind && result) __defProp$G(target, key, result);
6437
6459
  return result;
6438
6460
  };
6439
6461
  let CanvasItem = class extends TimelineNode {
@@ -6517,16 +6539,16 @@ let CanvasItem = class extends TimelineNode {
6517
6539
  this.emit("draw");
6518
6540
  }
6519
6541
  _redraw() {
6520
- this.log(this.name, "drawing");
6542
+ this._tree?.log(this.name, "drawing");
6521
6543
  this._draw();
6522
6544
  return this.context.toBatchables();
6523
6545
  }
6524
6546
  _relayout(batchables) {
6525
- this.log(this.name, "layouting");
6547
+ this._tree?.log(this.name, "layouting");
6526
6548
  return batchables;
6527
6549
  }
6528
6550
  _repaint(batchables) {
6529
- this.log(this.name, "painting");
6551
+ this._tree?.log(this.name, "painting");
6530
6552
  const globalOpacity = this.globalOpacity;
6531
6553
  return batchables.map((batchable) => {
6532
6554
  return {
@@ -6586,30 +6608,30 @@ let CanvasItem = class extends TimelineNode {
6586
6608
  super._render(renderer);
6587
6609
  }
6588
6610
  };
6589
- __decorateClass$R([
6611
+ __decorateClass$K([
6590
6612
  property()
6591
6613
  ], CanvasItem.prototype, "modulate", 2);
6592
- __decorateClass$R([
6614
+ __decorateClass$K([
6593
6615
  property()
6594
6616
  ], CanvasItem.prototype, "blendMode", 2);
6595
- __decorateClass$R([
6617
+ __decorateClass$K([
6596
6618
  property({ internal: true, fallback: true })
6597
6619
  ], CanvasItem.prototype, "visible", 2);
6598
- __decorateClass$R([
6620
+ __decorateClass$K([
6599
6621
  property({ internal: true, fallback: 1 })
6600
6622
  ], CanvasItem.prototype, "opacity", 2);
6601
- CanvasItem = __decorateClass$R([
6623
+ CanvasItem = __decorateClass$K([
6602
6624
  customNode("CanvasItem")
6603
6625
  ], CanvasItem);
6604
6626
 
6605
- var __defProp$I = Object.defineProperty;
6606
- var __getOwnPropDesc$G = Object.getOwnPropertyDescriptor;
6607
- var __decorateClass$Q = (decorators, target, key, kind) => {
6608
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$G(target, key) : target;
6627
+ var __defProp$F = Object.defineProperty;
6628
+ var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
6629
+ var __decorateClass$J = (decorators, target, key, kind) => {
6630
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
6609
6631
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6610
6632
  if (decorator = decorators[i])
6611
6633
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6612
- if (kind && result) __defProp$I(target, key, result);
6634
+ if (kind && result) __defProp$F(target, key, result);
6613
6635
  return result;
6614
6636
  };
6615
6637
  let Viewport = class extends Node {
@@ -6760,33 +6782,33 @@ let Viewport = class extends Node {
6760
6782
  return this.canvasTransform.apply(globalPos, newPos);
6761
6783
  }
6762
6784
  };
6763
- __decorateClass$Q([
6785
+ __decorateClass$J([
6764
6786
  property({ fallback: 0 })
6765
6787
  ], Viewport.prototype, "x", 2);
6766
- __decorateClass$Q([
6788
+ __decorateClass$J([
6767
6789
  property({ fallback: 0 })
6768
6790
  ], Viewport.prototype, "y", 2);
6769
- __decorateClass$Q([
6791
+ __decorateClass$J([
6770
6792
  property({ fallback: 0 })
6771
6793
  ], Viewport.prototype, "width", 2);
6772
- __decorateClass$Q([
6794
+ __decorateClass$J([
6773
6795
  property({ fallback: 0 })
6774
6796
  ], Viewport.prototype, "height", 2);
6775
- __decorateClass$Q([
6797
+ __decorateClass$J([
6776
6798
  property({ internal: true, fallback: false })
6777
6799
  ], Viewport.prototype, "msaa", 2);
6778
- Viewport = __decorateClass$Q([
6800
+ Viewport = __decorateClass$J([
6779
6801
  customNode("Viewport")
6780
6802
  ], Viewport);
6781
6803
 
6782
- var __defProp$H = Object.defineProperty;
6783
- var __getOwnPropDesc$F = Object.getOwnPropertyDescriptor;
6784
- var __decorateClass$P = (decorators, target, key, kind) => {
6785
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$F(target, key) : target;
6804
+ var __defProp$E = Object.defineProperty;
6805
+ var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
6806
+ var __decorateClass$I = (decorators, target, key, kind) => {
6807
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
6786
6808
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6787
6809
  if (decorator = decorators[i])
6788
6810
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6789
- if (kind && result) __defProp$H(target, key, result);
6811
+ if (kind && result) __defProp$E(target, key, result);
6790
6812
  return result;
6791
6813
  };
6792
6814
  let Effect = class extends TimelineNode {
@@ -7028,19 +7050,19 @@ let Effect = class extends TimelineNode {
7028
7050
  }
7029
7051
  }
7030
7052
  };
7031
- __decorateClass$P([
7053
+ __decorateClass$I([
7032
7054
  property({ internal: true })
7033
7055
  ], Effect.prototype, "material", 2);
7034
- __decorateClass$P([
7056
+ __decorateClass$I([
7035
7057
  property()
7036
7058
  ], Effect.prototype, "effectMode", 2);
7037
- __decorateClass$P([
7038
- property({ fallback: "" })
7059
+ __decorateClass$I([
7060
+ property()
7039
7061
  ], Effect.prototype, "glsl", 2);
7040
- __decorateClass$P([
7041
- property({ fallback: "" })
7062
+ __decorateClass$I([
7063
+ property()
7042
7064
  ], Effect.prototype, "glslSrc", 2);
7043
- Effect = __decorateClass$P([
7065
+ Effect = __decorateClass$I([
7044
7066
  customNode("Effect")
7045
7067
  ], Effect);
7046
7068
 
@@ -7070,14 +7092,14 @@ class RenderStack {
7070
7092
  }
7071
7093
  }
7072
7094
 
7073
- var __defProp$G = Object.defineProperty;
7074
- var __getOwnPropDesc$E = Object.getOwnPropertyDescriptor;
7075
- var __decorateClass$O = (decorators, target, key, kind) => {
7076
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$E(target, key) : target;
7095
+ var __defProp$D = Object.defineProperty;
7096
+ var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
7097
+ var __decorateClass$H = (decorators, target, key, kind) => {
7098
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
7077
7099
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7078
7100
  if (decorator = decorators[i])
7079
7101
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7080
- if (kind && result) __defProp$G(target, key, result);
7102
+ if (kind && result) __defProp$D(target, key, result);
7081
7103
  return result;
7082
7104
  };
7083
7105
  let Timeline = class extends Node {
@@ -7122,48 +7144,48 @@ let Timeline = class extends Node {
7122
7144
  this.addTime(delta);
7123
7145
  }
7124
7146
  };
7125
- __decorateClass$O([
7147
+ __decorateClass$H([
7126
7148
  property({ fallback: 0 })
7127
7149
  ], Timeline.prototype, "startTime", 2);
7128
- __decorateClass$O([
7150
+ __decorateClass$H([
7129
7151
  property({ fallback: 0 })
7130
7152
  ], Timeline.prototype, "currentTime", 2);
7131
- __decorateClass$O([
7153
+ __decorateClass$H([
7132
7154
  property({ fallback: Number.MAX_SAFE_INTEGER })
7133
7155
  ], Timeline.prototype, "endTime", 2);
7134
- __decorateClass$O([
7156
+ __decorateClass$H([
7135
7157
  property({ fallback: false })
7136
7158
  ], Timeline.prototype, "loop", 2);
7137
- Timeline = __decorateClass$O([
7159
+ Timeline = __decorateClass$H([
7138
7160
  customNode("Timeline")
7139
7161
  ], Timeline);
7140
7162
 
7141
- var __defProp$F = Object.defineProperty;
7142
- var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
7143
- var __decorateClass$N = (decorators, target, key, kind) => {
7144
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
7163
+ var __defProp$C = Object.defineProperty;
7164
+ var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
7165
+ var __decorateClass$G = (decorators, target, key, kind) => {
7166
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
7145
7167
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7146
7168
  if (decorator = decorators[i])
7147
7169
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7148
- if (kind && result) __defProp$F(target, key, result);
7170
+ if (kind && result) __defProp$C(target, key, result);
7149
7171
  return result;
7150
7172
  };
7151
7173
  let Window = class extends Viewport {
7152
7174
  };
7153
- __decorateClass$N([
7175
+ __decorateClass$G([
7154
7176
  property({ fallback: false })
7155
7177
  ], Window.prototype, "msaa", 2);
7156
- Window = __decorateClass$N([
7178
+ Window = __decorateClass$G([
7157
7179
  customNode("Window")
7158
7180
  ], Window);
7159
7181
 
7160
- var __defProp$E = Object.defineProperty;
7161
- var __decorateClass$M = (decorators, target, key, kind) => {
7182
+ var __defProp$B = Object.defineProperty;
7183
+ var __decorateClass$F = (decorators, target, key, kind) => {
7162
7184
  var result = void 0 ;
7163
7185
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7164
7186
  if (decorator = decorators[i])
7165
7187
  result = (decorator(target, key, result) ) || result;
7166
- if (result) __defProp$E(target, key, result);
7188
+ if (result) __defProp$B(target, key, result);
7167
7189
  return result;
7168
7190
  };
7169
7191
  class SceneTree extends MainLoop {
@@ -7243,25 +7265,25 @@ class SceneTree extends MainLoop {
7243
7265
  super.destroy();
7244
7266
  }
7245
7267
  }
7246
- __decorateClass$M([
7268
+ __decorateClass$F([
7247
7269
  property()
7248
7270
  ], SceneTree.prototype, "backgroundColor");
7249
- __decorateClass$M([
7271
+ __decorateClass$F([
7250
7272
  property({ internal: true, fallback: false })
7251
7273
  ], SceneTree.prototype, "debug");
7252
- __decorateClass$M([
7274
+ __decorateClass$F([
7253
7275
  property({ internal: true, fallback: false })
7254
7276
  ], SceneTree.prototype, "processPaused");
7255
- __decorateClass$M([
7277
+ __decorateClass$F([
7256
7278
  property({ internal: true, default: () => fonts })
7257
7279
  ], SceneTree.prototype, "fonts");
7258
- __decorateClass$M([
7280
+ __decorateClass$F([
7259
7281
  property({ internal: true, default: () => new Timeline() })
7260
7282
  ], SceneTree.prototype, "timeline");
7261
7283
 
7262
- var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
7263
- var __decorateClass$L = (decorators, target, key, kind) => {
7264
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
7284
+ var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
7285
+ var __decorateClass$E = (decorators, target, key, kind) => {
7286
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
7265
7287
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7266
7288
  if (decorator = decorators[i])
7267
7289
  result = (decorator(result)) || result;
@@ -7273,7 +7295,7 @@ let Transition = class extends Effect {
7273
7295
  this.setProperties(properties).append(children);
7274
7296
  }
7275
7297
  };
7276
- Transition = __decorateClass$L([
7298
+ Transition = __decorateClass$E([
7277
7299
  customNode("Transition", {
7278
7300
  effectMode: "transition",
7279
7301
  processMode: "pausable",
@@ -7281,14 +7303,14 @@ Transition = __decorateClass$L([
7281
7303
  })
7282
7304
  ], Transition);
7283
7305
 
7284
- var __defProp$D = Object.defineProperty;
7285
- var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
7286
- var __decorateClass$K = (decorators, target, key, kind) => {
7287
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
7306
+ var __defProp$A = Object.defineProperty;
7307
+ var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
7308
+ var __decorateClass$D = (decorators, target, key, kind) => {
7309
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
7288
7310
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7289
7311
  if (decorator = decorators[i])
7290
7312
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7291
- if (kind && result) __defProp$D(target, key, result);
7313
+ if (kind && result) __defProp$A(target, key, result);
7292
7314
  return result;
7293
7315
  };
7294
7316
  let Node2D = class extends CanvasItem {
@@ -7352,9 +7374,7 @@ let Node2D = class extends CanvasItem {
7352
7374
  let a, c, tx, b, d, ty;
7353
7375
  if (vertTransform) {
7354
7376
  const globalTransform = this.globalTransform.clone();
7355
- globalTransform.multiply(
7356
- typeof vertTransform === "function" ? vertTransform?.() : vertTransform
7357
- );
7377
+ globalTransform.multiply(vertTransform);
7358
7378
  [a, c, tx, b, d, ty] = globalTransform.toArray();
7359
7379
  } else {
7360
7380
  [a, c, tx, b, d, ty] = this.globalTransform.toArray();
@@ -7392,46 +7412,81 @@ let Node2D = class extends CanvasItem {
7392
7412
  return this.globalTransform.apply(localPos, newPos);
7393
7413
  }
7394
7414
  };
7395
- __decorateClass$K([
7415
+ __decorateClass$D([
7396
7416
  property({ internal: true, fallback: 0 })
7397
7417
  ], Node2D.prototype, "rotation", 2);
7398
- __decorateClass$K([
7418
+ __decorateClass$D([
7399
7419
  property({ internal: true, fallback: 0 })
7400
7420
  ], Node2D.prototype, "globalRotation", 2);
7401
- Node2D = __decorateClass$K([
7421
+ Node2D = __decorateClass$D([
7402
7422
  customNode("Node2D")
7403
7423
  ], Node2D);
7404
7424
 
7405
- var __defProp$C = Object.defineProperty;
7406
- var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
7407
- var __decorateClass$J = (decorators, target, key, kind) => {
7408
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
7425
+ var __defProp$z = Object.defineProperty;
7426
+ var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
7427
+ var __decorateClass$C = (decorators, target, key, kind) => {
7428
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
7409
7429
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7410
7430
  if (decorator = decorators[i])
7411
7431
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7412
- if (kind && result) __defProp$C(target, key, result);
7432
+ if (kind && result) __defProp$z(target, key, result);
7413
7433
  return result;
7414
7434
  };
7415
7435
  let Camera2D = class extends Node2D {
7416
- zoom = new Vector2(1, 1).on("update", () => this.updateCanvasTransform());
7417
- maxZoom = new Vector2(6, 6);
7418
- minZoom = new Vector2(0.1, 0.1);
7419
7436
  _screenOffset = { x: 0, y: 0 };
7420
- constructor(properties, nodes = []) {
7421
- super();
7422
- this.setProperties(properties).append(nodes);
7437
+ _zoom = new Vector2(1, 1).on("update", () => this.updateCanvasTransform());
7438
+ get zoom() {
7439
+ return this._zoom;
7423
7440
  }
7424
- addZoom(x, y = x) {
7425
- this.zoom.set(
7426
- clamp(this.zoom.x + x, this.minZoom.x, this.maxZoom.x),
7427
- clamp(this.zoom.y + y, this.minZoom.y, this.maxZoom.y)
7428
- );
7441
+ set zoom(val) {
7442
+ this._zoom.set(val.x, val.y);
7443
+ }
7444
+ _minZoom = new Vector2(0.02, 0.02);
7445
+ get minZoom() {
7446
+ return this._minZoom;
7447
+ }
7448
+ set minZoom(val) {
7449
+ this._minZoom.set(val.x, val.y);
7450
+ }
7451
+ _maxZoom = new Vector2(256, 256);
7452
+ get maxZoom() {
7453
+ return this._maxZoom;
7454
+ }
7455
+ set maxZoom(val) {
7456
+ this._maxZoom.set(val.x, val.y);
7457
+ }
7458
+ constructor(properties, nodes = []) {
7459
+ super();
7460
+ this.setProperties(properties).append(nodes);
7461
+ }
7462
+ setProperties(properties) {
7463
+ if (properties) {
7464
+ const {
7465
+ zoom,
7466
+ minZoom,
7467
+ maxZoom,
7468
+ ...restProperties
7469
+ } = properties;
7470
+ if (zoom)
7471
+ this.zoom = zoom;
7472
+ if (minZoom)
7473
+ this.minZoom = minZoom;
7474
+ if (maxZoom)
7475
+ this.maxZoom = maxZoom;
7476
+ super.setProperties(restProperties);
7477
+ }
7429
7478
  return this;
7430
7479
  }
7480
+ addZoom(x, y = x) {
7481
+ return this.setZoom(
7482
+ this._zoom.x + x,
7483
+ this._zoom.y + y
7484
+ );
7485
+ }
7431
7486
  setZoom(x, y = x) {
7432
- this.zoom.set(
7433
- clamp(x, this.minZoom.x, this.maxZoom.x),
7434
- clamp(y, this.minZoom.y, this.maxZoom.y)
7487
+ this._zoom.set(
7488
+ clamp(x, this._minZoom.x, this._maxZoom.x),
7489
+ clamp(y, this._minZoom.y, this._maxZoom.y)
7435
7490
  );
7436
7491
  return this;
7437
7492
  }
@@ -7485,9 +7540,9 @@ let Camera2D = class extends Node2D {
7485
7540
  const isTouchPad = e.wheelDeltaY ? Math.abs(Math.abs(e.wheelDeltaY) - Math.abs(3 * e.deltaY)) < 3 : e.deltaMode === 0;
7486
7541
  if (!isTouchPad) {
7487
7542
  e.preventDefault();
7488
- const oldZoom = this.zoom.x;
7489
- this.addZoom(e.deltaY * -0.015);
7490
- const ratio = 1 - this.zoom.x / oldZoom;
7543
+ const oldZoom = this._zoom.x;
7544
+ this.zoomWithWheel(e.deltaY);
7545
+ const ratio = 1 - this._zoom.x / oldZoom;
7491
7546
  this.position.add(
7492
7547
  (e.screenX - this.position.x) * ratio,
7493
7548
  (e.screenY - this.position.y) * ratio
@@ -7498,6 +7553,12 @@ let Camera2D = class extends Node2D {
7498
7553
  this.position.add(-e.deltaX, -e.deltaY);
7499
7554
  }
7500
7555
  }
7556
+ zoomWithWheel(wheelDeltaY) {
7557
+ const logCur = Math.log(this._zoom.x);
7558
+ const logDelta = -wheelDeltaY * this.wheelSensitivity;
7559
+ const logNew = logCur + logDelta;
7560
+ this.setZoom(Math.exp(logNew));
7561
+ }
7501
7562
  updateTransform() {
7502
7563
  super.updateTransform();
7503
7564
  this.updateCanvasTransform();
@@ -7506,7 +7567,7 @@ let Camera2D = class extends Node2D {
7506
7567
  const viewport = this.getViewport();
7507
7568
  if (!viewport)
7508
7569
  return;
7509
- viewport.canvasTransform.identity().scale(this.zoom.x, this.zoom.y).translate(this.position.x, this.position.y);
7570
+ viewport.canvasTransform.identity().scale(this._zoom.x, this._zoom.y).translate(this.position.x, this.position.y);
7510
7571
  this.emit("updateCanvasTransform");
7511
7572
  }
7512
7573
  toGlobal(screenPos, newPos) {
@@ -7521,14 +7582,25 @@ let Camera2D = class extends Node2D {
7521
7582
  throw new Error("Failed to toScreen, viewport is empty");
7522
7583
  return viewport.toCanvasScreen(globalPos, newPos);
7523
7584
  }
7585
+ toJSON() {
7586
+ return {
7587
+ zoom: this._zoom.toJSON(),
7588
+ minZoom: this._minZoom.toJSON(),
7589
+ maxZoom: this._maxZoom.toJSON(),
7590
+ ...super.toJSON()
7591
+ };
7592
+ }
7524
7593
  };
7525
- __decorateClass$J([
7594
+ __decorateClass$C([
7595
+ property({ fallback: 0.02 })
7596
+ ], Camera2D.prototype, "wheelSensitivity", 2);
7597
+ __decorateClass$C([
7526
7598
  property({ internal: true, fallback: false })
7527
7599
  ], Camera2D.prototype, "spaceKey", 2);
7528
- __decorateClass$J([
7600
+ __decorateClass$C([
7529
7601
  property({ internal: true, fallback: false })
7530
7602
  ], Camera2D.prototype, "grabbing", 2);
7531
- Camera2D = __decorateClass$J([
7603
+ Camera2D = __decorateClass$C([
7532
7604
  customNode("Camera2D", {
7533
7605
  processMode: "disabled",
7534
7606
  renderMode: "disabled"
@@ -7681,18 +7753,18 @@ function parseCSSTransformOrigin(transformOrigin) {
7681
7753
  });
7682
7754
  }
7683
7755
 
7684
- var __defProp$B = Object.defineProperty;
7685
- var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
7686
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7687
- var __decorateClass$I = (decorators, target, key, kind) => {
7688
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
7756
+ var __defProp$y = Object.defineProperty;
7757
+ var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
7758
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7759
+ var __decorateClass$B = (decorators, target, key, kind) => {
7760
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
7689
7761
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7690
7762
  if (decorator = decorators[i])
7691
7763
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7692
- if (kind && result) __defProp$B(target, key, result);
7764
+ if (kind && result) __defProp$y(target, key, result);
7693
7765
  return result;
7694
7766
  };
7695
- var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, key + "" , value);
7767
+ var __publicField$j = (obj, key, value) => __defNormalProp$j(obj, key + "" , value);
7696
7768
  let ColorAdjustEffect = class extends Effect {
7697
7769
  constructor(properties, children = []) {
7698
7770
  super();
@@ -7714,7 +7786,7 @@ let ColorAdjustEffect = class extends Effect {
7714
7786
  });
7715
7787
  }
7716
7788
  };
7717
- __publicField$i(ColorAdjustEffect, "material", new Material({
7789
+ __publicField$j(ColorAdjustEffect, "material", new Material({
7718
7790
  vert: `precision mediump float;
7719
7791
  attribute vec2 position;
7720
7792
  attribute vec2 uv;
@@ -7749,46 +7821,46 @@ void main(void) {
7749
7821
  gl_FragColor = c * alpha;
7750
7822
  }`
7751
7823
  }));
7752
- __decorateClass$I([
7824
+ __decorateClass$B([
7753
7825
  property({ fallback: 1 })
7754
7826
  ], ColorAdjustEffect.prototype, "saturation", 2);
7755
- __decorateClass$I([
7827
+ __decorateClass$B([
7756
7828
  property({ fallback: 1 })
7757
7829
  ], ColorAdjustEffect.prototype, "contrast", 2);
7758
- __decorateClass$I([
7830
+ __decorateClass$B([
7759
7831
  property({ fallback: 1 })
7760
7832
  ], ColorAdjustEffect.prototype, "brightness", 2);
7761
- __decorateClass$I([
7833
+ __decorateClass$B([
7762
7834
  property({ fallback: 1 })
7763
7835
  ], ColorAdjustEffect.prototype, "red", 2);
7764
- __decorateClass$I([
7836
+ __decorateClass$B([
7765
7837
  property({ fallback: 1 })
7766
7838
  ], ColorAdjustEffect.prototype, "green", 2);
7767
- __decorateClass$I([
7839
+ __decorateClass$B([
7768
7840
  property({ fallback: 1 })
7769
7841
  ], ColorAdjustEffect.prototype, "blue", 2);
7770
- __decorateClass$I([
7842
+ __decorateClass$B([
7771
7843
  property({ fallback: 1 })
7772
7844
  ], ColorAdjustEffect.prototype, "alpha", 2);
7773
- __decorateClass$I([
7845
+ __decorateClass$B([
7774
7846
  property({ fallback: 1 })
7775
7847
  ], ColorAdjustEffect.prototype, "gamma", 2);
7776
- ColorAdjustEffect = __decorateClass$I([
7848
+ ColorAdjustEffect = __decorateClass$B([
7777
7849
  customNode("ColorAdjustEffect")
7778
7850
  ], ColorAdjustEffect);
7779
7851
 
7780
- var __defProp$A = Object.defineProperty;
7781
- var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
7782
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7783
- var __decorateClass$H = (decorators, target, key, kind) => {
7784
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
7852
+ var __defProp$x = Object.defineProperty;
7853
+ var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
7854
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7855
+ var __decorateClass$A = (decorators, target, key, kind) => {
7856
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
7785
7857
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7786
7858
  if (decorator = decorators[i])
7787
7859
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7788
- if (kind && result) __defProp$A(target, key, result);
7860
+ if (kind && result) __defProp$x(target, key, result);
7789
7861
  return result;
7790
7862
  };
7791
- var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
7863
+ var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, key + "" , value);
7792
7864
  let ColorFilterEffect = class extends Effect {
7793
7865
  _colorMatrix = new ColorMatrix();
7794
7866
  constructor(properties, children = []) {
@@ -7838,7 +7910,7 @@ let ColorFilterEffect = class extends Effect {
7838
7910
  });
7839
7911
  }
7840
7912
  };
7841
- __publicField$h(ColorFilterEffect, "material", new Material({
7913
+ __publicField$i(ColorFilterEffect, "material", new Material({
7842
7914
  vert: `precision mediump float;
7843
7915
  attribute vec2 position;
7844
7916
  attribute vec2 uv;
@@ -7865,25 +7937,25 @@ void main(void) {
7865
7937
  );
7866
7938
  }`
7867
7939
  }));
7868
- __decorateClass$H([
7940
+ __decorateClass$A([
7869
7941
  property()
7870
7942
  ], ColorFilterEffect.prototype, "filter", 2);
7871
- ColorFilterEffect = __decorateClass$H([
7943
+ ColorFilterEffect = __decorateClass$A([
7872
7944
  customNode("ColorFilterEffect")
7873
7945
  ], ColorFilterEffect);
7874
7946
 
7875
- var __defProp$z = Object.defineProperty;
7876
- var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
7877
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7878
- var __decorateClass$G = (decorators, target, key, kind) => {
7879
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
7947
+ var __defProp$w = Object.defineProperty;
7948
+ var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
7949
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7950
+ var __decorateClass$z = (decorators, target, key, kind) => {
7951
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
7880
7952
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7881
7953
  if (decorator = decorators[i])
7882
7954
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7883
- if (kind && result) __defProp$z(target, key, result);
7955
+ if (kind && result) __defProp$w(target, key, result);
7884
7956
  return result;
7885
7957
  };
7886
- var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
7958
+ var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
7887
7959
  const MAX_COLORS$1 = 50;
7888
7960
  let ColorOverlayEffect = class extends Effect {
7889
7961
  _color = new Color();
@@ -7909,7 +7981,7 @@ let ColorOverlayEffect = class extends Effect {
7909
7981
  });
7910
7982
  }
7911
7983
  };
7912
- __publicField$g(ColorOverlayEffect, "material", new Material({
7984
+ __publicField$h(ColorOverlayEffect, "material", new Material({
7913
7985
  vert: `precision mediump float;
7914
7986
  attribute vec2 position;
7915
7987
  attribute vec2 uv;
@@ -7956,28 +8028,28 @@ void main(void) {
7956
8028
  gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
7957
8029
  }`
7958
8030
  }));
7959
- __decorateClass$G([
8031
+ __decorateClass$z([
7960
8032
  property({ default: () => [] })
7961
8033
  ], ColorOverlayEffect.prototype, "colors", 2);
7962
- __decorateClass$G([
8034
+ __decorateClass$z([
7963
8035
  property({ fallback: 0.5 })
7964
8036
  ], ColorOverlayEffect.prototype, "alpha", 2);
7965
- ColorOverlayEffect = __decorateClass$G([
8037
+ ColorOverlayEffect = __decorateClass$z([
7966
8038
  customNode("ColorOverlayEffect")
7967
8039
  ], ColorOverlayEffect);
7968
8040
 
7969
- var __defProp$y = Object.defineProperty;
7970
- var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
7971
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7972
- var __decorateClass$F = (decorators, target, key, kind) => {
7973
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
8041
+ var __defProp$v = Object.defineProperty;
8042
+ var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
8043
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8044
+ var __decorateClass$y = (decorators, target, key, kind) => {
8045
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
7974
8046
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7975
8047
  if (decorator = decorators[i])
7976
8048
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7977
- if (kind && result) __defProp$y(target, key, result);
8049
+ if (kind && result) __defProp$v(target, key, result);
7978
8050
  return result;
7979
8051
  };
7980
- var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
8052
+ var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
7981
8053
  let ColorRemoveEffect = class extends Effect {
7982
8054
  _color = new Color();
7983
8055
  constructor(properties, children = []) {
@@ -8008,7 +8080,7 @@ let ColorRemoveEffect = class extends Effect {
8008
8080
  });
8009
8081
  }
8010
8082
  };
8011
- __publicField$f(ColorRemoveEffect, "material", new Material({
8083
+ __publicField$g(ColorRemoveEffect, "material", new Material({
8012
8084
  vert: `precision mediump float;
8013
8085
  attribute vec2 position;
8014
8086
  attribute vec2 uv;
@@ -8041,28 +8113,28 @@ void main(void) {
8041
8113
  gl_FragColor = color;
8042
8114
  }`
8043
8115
  }));
8044
- __decorateClass$F([
8116
+ __decorateClass$y([
8045
8117
  property({ default: () => [] })
8046
8118
  ], ColorRemoveEffect.prototype, "colors", 2);
8047
- __decorateClass$F([
8119
+ __decorateClass$y([
8048
8120
  property({ fallback: 0.5 })
8049
8121
  ], ColorRemoveEffect.prototype, "epsilon", 2);
8050
- ColorRemoveEffect = __decorateClass$F([
8122
+ ColorRemoveEffect = __decorateClass$y([
8051
8123
  customNode("ColorRemoveEffect")
8052
8124
  ], ColorRemoveEffect);
8053
8125
 
8054
- var __defProp$x = Object.defineProperty;
8055
- var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
8056
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8057
- var __decorateClass$E = (decorators, target, key, kind) => {
8058
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
8126
+ var __defProp$u = Object.defineProperty;
8127
+ var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
8128
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8129
+ var __decorateClass$x = (decorators, target, key, kind) => {
8130
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
8059
8131
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8060
8132
  if (decorator = decorators[i])
8061
8133
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8062
- if (kind && result) __defProp$x(target, key, result);
8134
+ if (kind && result) __defProp$u(target, key, result);
8063
8135
  return result;
8064
8136
  };
8065
- var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
8137
+ var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
8066
8138
  const MAX_COLORS = 50;
8067
8139
  let ColorReplaceEffect = class extends Effect {
8068
8140
  _color = new Color();
@@ -8108,7 +8180,7 @@ let ColorReplaceEffect = class extends Effect {
8108
8180
  });
8109
8181
  }
8110
8182
  };
8111
- __publicField$e(ColorReplaceEffect, "material", new Material({
8183
+ __publicField$f(ColorReplaceEffect, "material", new Material({
8112
8184
  vert: `precision mediump float;
8113
8185
  attribute vec2 position;
8114
8186
  attribute vec2 uv;
@@ -8148,25 +8220,139 @@ void main(void) {
8148
8220
  }
8149
8221
  }`
8150
8222
  }));
8151
- __decorateClass$E([
8223
+ __decorateClass$x([
8152
8224
  property({ default: () => [] })
8153
8225
  ], ColorReplaceEffect.prototype, "colors", 2);
8154
- __decorateClass$E([
8226
+ __decorateClass$x([
8155
8227
  property({ fallback: 0.05 })
8156
8228
  ], ColorReplaceEffect.prototype, "epsilon", 2);
8157
- ColorReplaceEffect = __decorateClass$E([
8229
+ ColorReplaceEffect = __decorateClass$x([
8158
8230
  customNode("ColorReplaceEffect")
8159
8231
  ], ColorReplaceEffect);
8160
8232
 
8161
- var __defProp$w = Object.defineProperty;
8162
- var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
8163
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8164
- var __decorateClass$D = (decorators, target, key, kind) => {
8165
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
8233
+ var __defProp$t = Object.defineProperty;
8234
+ var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
8235
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8236
+ var __decorateClass$w = (decorators, target, key, kind) => {
8237
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
8166
8238
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8167
8239
  if (decorator = decorators[i])
8168
8240
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8169
- if (kind && result) __defProp$w(target, key, result);
8241
+ if (kind && result) __defProp$t(target, key, result);
8242
+ return result;
8243
+ };
8244
+ var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
8245
+ let DrawboardEffect = class extends Effect {
8246
+ constructor(properties, children = []) {
8247
+ super();
8248
+ this.setProperties(properties).append(children);
8249
+ }
8250
+ apply(renderer, source) {
8251
+ source.redraw(renderer, () => {
8252
+ const viewMatrix = renderer.program.uniforms.viewMatrix;
8253
+ QuadUvGeometry.draw(renderer, DrawboardEffect.material, {
8254
+ sampler: 0,
8255
+ inputSize: [source.width, source.height],
8256
+ zoom: [viewMatrix[0], viewMatrix[4]],
8257
+ translate: [viewMatrix[6], viewMatrix[7]],
8258
+ checkerboard: this.checkerboard ? 1 : 0,
8259
+ checkerboardScale: this.checkerboardScale,
8260
+ pixelGrid: this.pixelGrid ? 1 : 0,
8261
+ pixelGridSize: [
8262
+ viewMatrix[0] > 4 ? Math.ceil(0.5 / viewMatrix[0] * 1e4) / 1e4 : 0,
8263
+ viewMatrix[4] > 4 ? Math.ceil(0.5 / viewMatrix[4] * 1e4) / 1e4 : 0
8264
+ ]
8265
+ });
8266
+ });
8267
+ }
8268
+ };
8269
+ __publicField$e(DrawboardEffect, "material", new Material({
8270
+ vert: `precision mediump float;
8271
+ attribute vec2 position;
8272
+ attribute vec2 uv;
8273
+ uniform mat3 projectionMatrix;
8274
+ uniform mat3 viewMatrix;
8275
+ varying vec2 vUv;
8276
+ void main() {
8277
+ gl_Position = vec4(position.xy, 0.0, 1.0);
8278
+ vUv = uv;
8279
+ }`,
8280
+ frag: `varying vec2 vUv;
8281
+ uniform sampler2D sampler;
8282
+ uniform int checkerboard;
8283
+ uniform float checkerboardScale;
8284
+ uniform int pixelGrid;
8285
+ uniform vec2 pixelGridSize;
8286
+ uniform vec2 inputSize;
8287
+ uniform vec2 zoom;
8288
+ uniform vec2 translate;
8289
+
8290
+ vec4 renderCheckerboard(vec2 coord, vec4 color, vec2 scale) {
8291
+ vec2 fractValue = fract(coord * scale) - 0.5;
8292
+ float value = fractValue.x * fractValue.y < 0.0 ? 1.0 : 0.95;
8293
+ return vec4(value * (1.0 - color.a) + color.rgb, 1);
8294
+ }
8295
+
8296
+ vec3 renderPixelGrid(vec2 coord, vec3 rgb, vec2 size) {
8297
+ vec2 corner = fract(coord);
8298
+ float gridWeight = max(float(corner.x < size.x), float(corner.y < size.y));
8299
+ vec3 gridColor;
8300
+ vec3 weights = vec3(0.299, 0.587, 0.114);
8301
+ float c2 = dot(rgb * rgb, weights);
8302
+ float luminance = sqrt(c2);
8303
+ if (luminance > 0.5) {
8304
+ float target = (luminance - 0.05) / luminance;
8305
+ gridColor = rgb * target;
8306
+ }
8307
+ else {
8308
+ float target = luminance * 0.8 + 0.15;
8309
+ float c1 = dot(rgb, weights);
8310
+ float a = 1.0 - 2.0 * c1 + c2;
8311
+ float b = c2 - c1;
8312
+ gridColor = mix(rgb, vec3(1), (b + sqrt(b * b - a * (c2 - target * target))) / a);
8313
+ }
8314
+ return mix(rgb, gridColor, gridWeight);
8315
+ }
8316
+
8317
+ void main(void) {
8318
+ vec4 color = texture2D(sampler, vUv);
8319
+ vec2 coord = vec2(vUv.x, 1.0 - vUv.y);
8320
+ coord = (coord * inputSize - translate) / zoom;
8321
+
8322
+ if (checkerboard > 0) {
8323
+ color = renderCheckerboard(coord, color, vec2(checkerboardScale) * zoom);
8324
+ }
8325
+ if (pixelGrid > 0) {
8326
+ color = vec4(
8327
+ renderPixelGrid(coord, color.rgb, pixelGridSize),
8328
+ color.a
8329
+ );
8330
+ }
8331
+ gl_FragColor = color;
8332
+ }`
8333
+ }));
8334
+ __decorateClass$w([
8335
+ property({ fallback: false })
8336
+ ], DrawboardEffect.prototype, "checkerboard", 2);
8337
+ __decorateClass$w([
8338
+ property({ fallback: 1 / 16 })
8339
+ ], DrawboardEffect.prototype, "checkerboardScale", 2);
8340
+ __decorateClass$w([
8341
+ property({ fallback: false })
8342
+ ], DrawboardEffect.prototype, "pixelGrid", 2);
8343
+ DrawboardEffect = __decorateClass$w([
8344
+ customNode("DrawboardEffect")
8345
+ ], DrawboardEffect);
8346
+
8347
+ var __defProp$s = Object.defineProperty;
8348
+ var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
8349
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8350
+ var __decorateClass$v = (decorators, target, key, kind) => {
8351
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
8352
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8353
+ if (decorator = decorators[i])
8354
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8355
+ if (kind && result) __defProp$s(target, key, result);
8170
8356
  return result;
8171
8357
  };
8172
8358
  var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -8272,25 +8458,25 @@ void main(void) {
8272
8458
  }`,
8273
8459
  frag: frag$2
8274
8460
  }));
8275
- __decorateClass$D([
8461
+ __decorateClass$v([
8276
8462
  property({ fallback: 4 })
8277
8463
  ], GaussianBlurEffect.prototype, "strength", 2);
8278
- __decorateClass$D([
8464
+ __decorateClass$v([
8279
8465
  property({ fallback: 3 })
8280
8466
  ], GaussianBlurEffect.prototype, "quality", 2);
8281
- GaussianBlurEffect = __decorateClass$D([
8467
+ GaussianBlurEffect = __decorateClass$v([
8282
8468
  customNode("GaussianBlurEffect")
8283
8469
  ], GaussianBlurEffect);
8284
8470
 
8285
- var __defProp$v = Object.defineProperty;
8286
- var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
8287
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8288
- var __decorateClass$C = (decorators, target, key, kind) => {
8289
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
8471
+ var __defProp$r = Object.defineProperty;
8472
+ var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
8473
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8474
+ var __decorateClass$u = (decorators, target, key, kind) => {
8475
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
8290
8476
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8291
8477
  if (decorator = decorators[i])
8292
8478
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8293
- if (kind && result) __defProp$v(target, key, result);
8479
+ if (kind && result) __defProp$r(target, key, result);
8294
8480
  return result;
8295
8481
  };
8296
8482
  var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, key + "" , value);
@@ -8354,34 +8540,34 @@ void main(void) {
8354
8540
  gl_FragColor = sample;
8355
8541
  }`
8356
8542
  }));
8357
- __decorateClass$C([
8543
+ __decorateClass$u([
8358
8544
  property({ fallback: "#000000FF" })
8359
8545
  ], DropShadowEffect.prototype, "color", 2);
8360
- __decorateClass$C([
8546
+ __decorateClass$u([
8361
8547
  property({ fallback: 4 })
8362
8548
  ], DropShadowEffect.prototype, "blur", 2);
8363
- __decorateClass$C([
8549
+ __decorateClass$u([
8364
8550
  property({ fallback: 4 })
8365
8551
  ], DropShadowEffect.prototype, "offsetX", 2);
8366
- __decorateClass$C([
8552
+ __decorateClass$u([
8367
8553
  property({ fallback: 4 })
8368
8554
  ], DropShadowEffect.prototype, "offsetY", 2);
8369
- __decorateClass$C([
8555
+ __decorateClass$u([
8370
8556
  property({ fallback: false })
8371
8557
  ], DropShadowEffect.prototype, "shadowOnly", 2);
8372
- DropShadowEffect = __decorateClass$C([
8558
+ DropShadowEffect = __decorateClass$u([
8373
8559
  customNode("DropShadowEffect")
8374
8560
  ], DropShadowEffect);
8375
8561
 
8376
- var __defProp$u = Object.defineProperty;
8377
- var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
8378
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8379
- var __decorateClass$B = (decorators, target, key, kind) => {
8380
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
8562
+ var __defProp$q = Object.defineProperty;
8563
+ var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
8564
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8565
+ var __decorateClass$t = (decorators, target, key, kind) => {
8566
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
8381
8567
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8382
8568
  if (decorator = decorators[i])
8383
8569
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8384
- if (kind && result) __defProp$u(target, key, result);
8570
+ if (kind && result) __defProp$q(target, key, result);
8385
8571
  return result;
8386
8572
  };
8387
8573
  var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, key + "" , value);
@@ -8426,22 +8612,22 @@ void main(void) {
8426
8612
  gl_FragColor = vec4(color.rgb * alpha, alpha);
8427
8613
  }`
8428
8614
  }));
8429
- __decorateClass$B([
8615
+ __decorateClass$t([
8430
8616
  property({ fallback: 5 })
8431
8617
  ], EmbossEffect.prototype, "strength", 2);
8432
- EmbossEffect = __decorateClass$B([
8618
+ EmbossEffect = __decorateClass$t([
8433
8619
  customNode("EmbossEffect")
8434
8620
  ], EmbossEffect);
8435
8621
 
8436
- var __defProp$t = Object.defineProperty;
8437
- var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
8438
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8439
- var __decorateClass$A = (decorators, target, key, kind) => {
8440
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
8622
+ var __defProp$p = Object.defineProperty;
8623
+ var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
8624
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8625
+ var __decorateClass$s = (decorators, target, key, kind) => {
8626
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
8441
8627
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8442
8628
  if (decorator = decorators[i])
8443
8629
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8444
- if (kind && result) __defProp$t(target, key, result);
8630
+ if (kind && result) __defProp$p(target, key, result);
8445
8631
  return result;
8446
8632
  };
8447
8633
  var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
@@ -8615,46 +8801,46 @@ void main(void) {
8615
8801
  gl_FragColor.a = texture2D(sampler, coord).a;
8616
8802
  }`
8617
8803
  }));
8618
- __decorateClass$A([
8804
+ __decorateClass$s([
8619
8805
  property({ fallback: 10 })
8620
8806
  ], GlitchEffect.prototype, "slices", 2);
8621
- __decorateClass$A([
8807
+ __decorateClass$s([
8622
8808
  property({ fallback: 512 })
8623
8809
  ], GlitchEffect.prototype, "sampleSize", 2);
8624
- __decorateClass$A([
8810
+ __decorateClass$s([
8625
8811
  property({ fallback: 100 })
8626
8812
  ], GlitchEffect.prototype, "offset", 2);
8627
- __decorateClass$A([
8813
+ __decorateClass$s([
8628
8814
  property({ fallback: 0 })
8629
8815
  ], GlitchEffect.prototype, "direction", 2);
8630
- __decorateClass$A([
8816
+ __decorateClass$s([
8631
8817
  property({ fallback: 2 })
8632
8818
  ], GlitchEffect.prototype, "fillMode", 2);
8633
- __decorateClass$A([
8819
+ __decorateClass$s([
8634
8820
  property({ fallback: 0 })
8635
8821
  ], GlitchEffect.prototype, "seed", 2);
8636
- __decorateClass$A([
8822
+ __decorateClass$s([
8637
8823
  property({ default: () => [2, 2] })
8638
8824
  ], GlitchEffect.prototype, "red", 2);
8639
- __decorateClass$A([
8825
+ __decorateClass$s([
8640
8826
  property({ default: () => [-10, 4] })
8641
8827
  ], GlitchEffect.prototype, "green", 2);
8642
- __decorateClass$A([
8828
+ __decorateClass$s([
8643
8829
  property({ default: () => [10, -4] })
8644
8830
  ], GlitchEffect.prototype, "blue", 2);
8645
- GlitchEffect = __decorateClass$A([
8831
+ GlitchEffect = __decorateClass$s([
8646
8832
  customNode("GlitchEffect")
8647
8833
  ], GlitchEffect);
8648
8834
 
8649
- var __defProp$s = Object.defineProperty;
8650
- var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
8651
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8652
- var __decorateClass$z = (decorators, target, key, kind) => {
8653
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
8835
+ var __defProp$o = Object.defineProperty;
8836
+ var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
8837
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8838
+ var __decorateClass$r = (decorators, target, key, kind) => {
8839
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
8654
8840
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8655
8841
  if (decorator = decorators[i])
8656
8842
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8657
- if (kind && result) __defProp$s(target, key, result);
8843
+ if (kind && result) __defProp$o(target, key, result);
8658
8844
  return result;
8659
8845
  };
8660
8846
  var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
@@ -8832,39 +9018,39 @@ void main(void) {
8832
9018
  gl_FragColor = vec4(color.rgb + mist.rgb, color.a);
8833
9019
  }`
8834
9020
  }));
8835
- __decorateClass$z([
9021
+ __decorateClass$r([
8836
9022
  property({ fallback: 0 })
8837
9023
  ], GodrayEffect.prototype, "time", 2);
8838
- __decorateClass$z([
9024
+ __decorateClass$r([
8839
9025
  property({ fallback: 30 })
8840
9026
  ], GodrayEffect.prototype, "angle", 2);
8841
- __decorateClass$z([
9027
+ __decorateClass$r([
8842
9028
  property({ fallback: 0.5 })
8843
9029
  ], GodrayEffect.prototype, "gain", 2);
8844
- __decorateClass$z([
9030
+ __decorateClass$r([
8845
9031
  property({ fallback: 2.5 })
8846
9032
  ], GodrayEffect.prototype, "lacunarity", 2);
8847
- __decorateClass$z([
9033
+ __decorateClass$r([
8848
9034
  property({ fallback: true })
8849
9035
  ], GodrayEffect.prototype, "parallel", 2);
8850
- __decorateClass$z([
9036
+ __decorateClass$r([
8851
9037
  property({ default: () => [0, 0] })
8852
9038
  ], GodrayEffect.prototype, "center", 2);
8853
- __decorateClass$z([
9039
+ __decorateClass$r([
8854
9040
  property({ fallback: 1 })
8855
9041
  ], GodrayEffect.prototype, "alpha", 2);
8856
- GodrayEffect = __decorateClass$z([
9042
+ GodrayEffect = __decorateClass$r([
8857
9043
  customNode("GodrayEffect")
8858
9044
  ], GodrayEffect);
8859
9045
 
8860
- var __defProp$r = Object.defineProperty;
8861
- var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
8862
- var __decorateClass$y = (decorators, target, key, kind) => {
8863
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
9046
+ var __defProp$n = Object.defineProperty;
9047
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
9048
+ var __decorateClass$q = (decorators, target, key, kind) => {
9049
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
8864
9050
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8865
9051
  if (decorator = decorators[i])
8866
9052
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8867
- if (kind && result) __defProp$r(target, key, result);
9053
+ if (kind && result) __defProp$n(target, key, result);
8868
9054
  return result;
8869
9055
  };
8870
9056
  const frag$1 = `varying vec2 vUv;
@@ -8954,28 +9140,28 @@ void main() {
8954
9140
  });
8955
9141
  }
8956
9142
  };
8957
- __decorateClass$y([
9143
+ __decorateClass$q([
8958
9144
  property({ fallback: 4 })
8959
9145
  ], KawaseBlurEffect.prototype, "strength", 2);
8960
- __decorateClass$y([
9146
+ __decorateClass$q([
8961
9147
  property({ fallback: 3 })
8962
9148
  ], KawaseBlurEffect.prototype, "quality", 2);
8963
- __decorateClass$y([
9149
+ __decorateClass$q([
8964
9150
  property({ default: () => [1, 1] })
8965
9151
  ], KawaseBlurEffect.prototype, "pixelSize", 2);
8966
- KawaseBlurEffect = __decorateClass$y([
9152
+ KawaseBlurEffect = __decorateClass$q([
8967
9153
  customNode("KawaseBlurEffect")
8968
9154
  ], KawaseBlurEffect);
8969
9155
 
8970
- var __defProp$q = Object.defineProperty;
8971
- var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
8972
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8973
- var __decorateClass$x = (decorators, target, key, kind) => {
8974
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
9156
+ var __defProp$m = Object.defineProperty;
9157
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
9158
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9159
+ var __decorateClass$p = (decorators, target, key, kind) => {
9160
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
8975
9161
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8976
9162
  if (decorator = decorators[i])
8977
9163
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8978
- if (kind && result) __defProp$q(target, key, result);
9164
+ if (kind && result) __defProp$m(target, key, result);
8979
9165
  return result;
8980
9166
  };
8981
9167
  var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
@@ -9063,25 +9249,25 @@ void main(void) {
9063
9249
  }
9064
9250
  }`
9065
9251
  }));
9066
- __decorateClass$x([
9252
+ __decorateClass$p([
9067
9253
  property({ internal: true })
9068
9254
  ], MaskEffect.prototype, "texture", 2);
9069
- __decorateClass$x([
9255
+ __decorateClass$p([
9070
9256
  property({ fallback: "" })
9071
9257
  ], MaskEffect.prototype, "src", 2);
9072
- MaskEffect = __decorateClass$x([
9258
+ MaskEffect = __decorateClass$p([
9073
9259
  customNode("MaskEffect")
9074
9260
  ], MaskEffect);
9075
9261
 
9076
- var __defProp$p = Object.defineProperty;
9077
- var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
9078
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9079
- var __decorateClass$w = (decorators, target, key, kind) => {
9080
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
9262
+ var __defProp$l = Object.defineProperty;
9263
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
9264
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9265
+ var __decorateClass$o = (decorators, target, key, kind) => {
9266
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
9081
9267
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9082
9268
  if (decorator = decorators[i])
9083
9269
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9084
- if (kind && result) __defProp$p(target, key, result);
9270
+ if (kind && result) __defProp$l(target, key, result);
9085
9271
  return result;
9086
9272
  };
9087
9273
  var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -9168,40 +9354,40 @@ void main() {
9168
9354
  };
9169
9355
  __publicField$7(OutlineEffect, "MIN_SAMPLES", 1);
9170
9356
  __publicField$7(OutlineEffect, "MAX_SAMPLES", 100);
9171
- __decorateClass$w([
9357
+ __decorateClass$o([
9172
9358
  property({ fallback: "#000000ff" })
9173
9359
  ], OutlineEffect.prototype, "color", 2);
9174
- __decorateClass$w([
9360
+ __decorateClass$o([
9175
9361
  property({ fallback: 1 })
9176
9362
  ], OutlineEffect.prototype, "width", 2);
9177
- __decorateClass$w([
9363
+ __decorateClass$o([
9178
9364
  property({ fallback: "solid" })
9179
9365
  ], OutlineEffect.prototype, "style", 2);
9180
- __decorateClass$w([
9366
+ __decorateClass$o([
9181
9367
  property()
9182
9368
  ], OutlineEffect.prototype, "image", 2);
9183
- __decorateClass$w([
9369
+ __decorateClass$o([
9184
9370
  property({ fallback: 1 })
9185
9371
  ], OutlineEffect.prototype, "opacity", 2);
9186
- __decorateClass$w([
9372
+ __decorateClass$o([
9187
9373
  property({ fallback: 0.1 })
9188
9374
  ], OutlineEffect.prototype, "quality", 2);
9189
- __decorateClass$w([
9375
+ __decorateClass$o([
9190
9376
  property({ fallback: false })
9191
9377
  ], OutlineEffect.prototype, "knockout", 2);
9192
- OutlineEffect = __decorateClass$w([
9378
+ OutlineEffect = __decorateClass$o([
9193
9379
  customNode("OutlineEffect")
9194
9380
  ], OutlineEffect);
9195
9381
 
9196
- var __defProp$o = Object.defineProperty;
9197
- var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
9198
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9199
- var __decorateClass$v = (decorators, target, key, kind) => {
9200
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
9382
+ var __defProp$k = Object.defineProperty;
9383
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
9384
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9385
+ var __decorateClass$n = (decorators, target, key, kind) => {
9386
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
9201
9387
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9202
9388
  if (decorator = decorators[i])
9203
9389
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9204
- if (kind && result) __defProp$o(target, key, result);
9390
+ if (kind && result) __defProp$k(target, key, result);
9205
9391
  return result;
9206
9392
  };
9207
9393
  var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
@@ -9257,22 +9443,22 @@ void main(void) {
9257
9443
  gl_FragColor = texture2D(sampler, coord);
9258
9444
  }`
9259
9445
  }));
9260
- __decorateClass$v([
9446
+ __decorateClass$n([
9261
9447
  property({ fallback: 10 })
9262
9448
  ], PixelateEffect.prototype, "strength", 2);
9263
- PixelateEffect = __decorateClass$v([
9449
+ PixelateEffect = __decorateClass$n([
9264
9450
  customNode("PixelateEffect")
9265
9451
  ], PixelateEffect);
9266
9452
 
9267
- var __defProp$n = Object.defineProperty;
9268
- var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
9269
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9270
- var __decorateClass$u = (decorators, target, key, kind) => {
9271
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
9453
+ var __defProp$j = Object.defineProperty;
9454
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
9455
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9456
+ var __decorateClass$m = (decorators, target, key, kind) => {
9457
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
9272
9458
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9273
9459
  if (decorator = decorators[i])
9274
9460
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9275
- if (kind && result) __defProp$n(target, key, result);
9461
+ if (kind && result) __defProp$j(target, key, result);
9276
9462
  return result;
9277
9463
  };
9278
9464
  var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
@@ -9385,19 +9571,19 @@ void main() {
9385
9571
  gl_FragColor = color;
9386
9572
  }`
9387
9573
  }));
9388
- __decorateClass$u([
9574
+ __decorateClass$m([
9389
9575
  property()
9390
9576
  ], ZoomBlurEffect.prototype, "center", 2);
9391
- __decorateClass$u([
9577
+ __decorateClass$m([
9392
9578
  property({ fallback: 20 })
9393
9579
  ], ZoomBlurEffect.prototype, "innerRadius", 2);
9394
- __decorateClass$u([
9580
+ __decorateClass$m([
9395
9581
  property({ fallback: -1 })
9396
9582
  ], ZoomBlurEffect.prototype, "radius", 2);
9397
- __decorateClass$u([
9583
+ __decorateClass$m([
9398
9584
  property({ fallback: 0.1 })
9399
9585
  ], ZoomBlurEffect.prototype, "strength", 2);
9400
- ZoomBlurEffect = __decorateClass$u([
9586
+ ZoomBlurEffect = __decorateClass$m([
9401
9587
  customNode("ZoomBlurEffect")
9402
9588
  ], ZoomBlurEffect);
9403
9589
 
@@ -9445,13 +9631,13 @@ function getDrawOptions(fill, box) {
9445
9631
  return { disableWrapMode, uvTransform };
9446
9632
  }
9447
9633
 
9448
- var __defProp$m = Object.defineProperty;
9449
- var __decorateClass$t = (decorators, target, key, kind) => {
9634
+ var __defProp$i = Object.defineProperty;
9635
+ var __decorateClass$l = (decorators, target, key, kind) => {
9450
9636
  var result = void 0 ;
9451
9637
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9452
9638
  if (decorator = decorators[i])
9453
9639
  result = (decorator(target, key, result) ) || result;
9454
- if (result) __defProp$m(target, key, result);
9640
+ if (result) __defProp$i(target, key, result);
9455
9641
  return result;
9456
9642
  };
9457
9643
  class BaseElement2DFill extends CoreObject {
@@ -9509,7 +9695,7 @@ class BaseElement2DFill extends CoreObject {
9509
9695
  await this.loadTexture();
9510
9696
  this.parent.requestRedraw();
9511
9697
  }
9512
- canDraw() {
9698
+ isValid() {
9513
9699
  return Boolean(
9514
9700
  this.enabled && (this._texture || this._animatedTexture || this.color)
9515
9701
  );
@@ -9561,47 +9747,47 @@ class BaseElement2DFill extends CoreObject {
9561
9747
  return this;
9562
9748
  }
9563
9749
  }
9564
- __decorateClass$t([
9750
+ __decorateClass$l([
9565
9751
  property({ fallback: true })
9566
9752
  ], BaseElement2DFill.prototype, "enabled");
9567
- __decorateClass$t([
9753
+ __decorateClass$l([
9568
9754
  property()
9569
9755
  ], BaseElement2DFill.prototype, "color");
9570
- __decorateClass$t([
9756
+ __decorateClass$l([
9571
9757
  property()
9572
9758
  ], BaseElement2DFill.prototype, "image");
9573
- __decorateClass$t([
9759
+ __decorateClass$l([
9574
9760
  property()
9575
9761
  ], BaseElement2DFill.prototype, "linearGradient");
9576
- __decorateClass$t([
9762
+ __decorateClass$l([
9577
9763
  property()
9578
9764
  ], BaseElement2DFill.prototype, "radialGradient");
9579
- __decorateClass$t([
9765
+ __decorateClass$l([
9580
9766
  property()
9581
9767
  ], BaseElement2DFill.prototype, "cropRect");
9582
- __decorateClass$t([
9768
+ __decorateClass$l([
9583
9769
  property()
9584
9770
  ], BaseElement2DFill.prototype, "stretchRect");
9585
- __decorateClass$t([
9771
+ __decorateClass$l([
9586
9772
  property()
9587
9773
  ], BaseElement2DFill.prototype, "dpi");
9588
- __decorateClass$t([
9774
+ __decorateClass$l([
9589
9775
  property()
9590
9776
  ], BaseElement2DFill.prototype, "rotateWithShape");
9591
- __decorateClass$t([
9777
+ __decorateClass$l([
9592
9778
  property()
9593
9779
  ], BaseElement2DFill.prototype, "tile");
9594
- __decorateClass$t([
9780
+ __decorateClass$l([
9595
9781
  property()
9596
9782
  ], BaseElement2DFill.prototype, "opacity");
9597
9783
 
9598
- var __defProp$l = Object.defineProperty;
9599
- var __decorateClass$s = (decorators, target, key, kind) => {
9784
+ var __defProp$h = Object.defineProperty;
9785
+ var __decorateClass$k = (decorators, target, key, kind) => {
9600
9786
  var result = void 0 ;
9601
9787
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9602
9788
  if (decorator = decorators[i])
9603
9789
  result = (decorator(target, key, result) ) || result;
9604
- if (result) __defProp$l(target, key, result);
9790
+ if (result) __defProp$h(target, key, result);
9605
9791
  return result;
9606
9792
  };
9607
9793
  class BaseElement2DBackground extends BaseElement2DFill {
@@ -9619,17 +9805,17 @@ class BaseElement2DBackground extends BaseElement2DFill {
9619
9805
  }
9620
9806
  }
9621
9807
  }
9622
- __decorateClass$s([
9808
+ __decorateClass$k([
9623
9809
  property()
9624
9810
  ], BaseElement2DBackground.prototype, "fillWithShape");
9625
9811
 
9626
- var __defProp$k = Object.defineProperty;
9627
- var __decorateClass$r = (decorators, target, key, kind) => {
9812
+ var __defProp$g = Object.defineProperty;
9813
+ var __decorateClass$j = (decorators, target, key, kind) => {
9628
9814
  var result = void 0 ;
9629
9815
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9630
9816
  if (decorator = decorators[i])
9631
9817
  result = (decorator(target, key, result) ) || result;
9632
- if (result) __defProp$k(target, key, result);
9818
+ if (result) __defProp$g(target, key, result);
9633
9819
  return result;
9634
9820
  };
9635
9821
  class BaseElement2DForeground extends BaseElement2DFill {
@@ -9647,17 +9833,17 @@ class BaseElement2DForeground extends BaseElement2DFill {
9647
9833
  }
9648
9834
  }
9649
9835
  }
9650
- __decorateClass$r([
9836
+ __decorateClass$j([
9651
9837
  property()
9652
9838
  ], BaseElement2DForeground.prototype, "fillWithShape");
9653
9839
 
9654
- var __defProp$j = Object.defineProperty;
9655
- var __decorateClass$q = (decorators, target, key, kind) => {
9840
+ var __defProp$f = Object.defineProperty;
9841
+ var __decorateClass$i = (decorators, target, key, kind) => {
9656
9842
  var result = void 0 ;
9657
9843
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9658
9844
  if (decorator = decorators[i])
9659
9845
  result = (decorator(target, key, result) ) || result;
9660
- if (result) __defProp$j(target, key, result);
9846
+ if (result) __defProp$f(target, key, result);
9661
9847
  return result;
9662
9848
  };
9663
9849
  class BaseElement2DOutline extends BaseElement2DFill {
@@ -9678,9 +9864,9 @@ class BaseElement2DOutline extends BaseElement2DFill {
9678
9864
  break;
9679
9865
  }
9680
9866
  }
9681
- canDraw() {
9867
+ isValid() {
9682
9868
  return Boolean(
9683
- this.enabled && (this.width || this.color || super.canDraw())
9869
+ this.enabled && (this.width || this.color || super.isValid())
9684
9870
  );
9685
9871
  }
9686
9872
  draw() {
@@ -9700,29 +9886,29 @@ class BaseElement2DOutline extends BaseElement2DFill {
9700
9886
  ctx.stroke({ disableWrapMode });
9701
9887
  }
9702
9888
  }
9703
- __decorateClass$q([
9889
+ __decorateClass$i([
9704
9890
  property({ fallback: "#00000000" })
9705
9891
  ], BaseElement2DOutline.prototype, "color");
9706
- __decorateClass$q([
9892
+ __decorateClass$i([
9707
9893
  property({ fallback: 0 })
9708
9894
  ], BaseElement2DOutline.prototype, "width");
9709
- __decorateClass$q([
9895
+ __decorateClass$i([
9710
9896
  property({ fallback: "solid" })
9711
9897
  ], BaseElement2DOutline.prototype, "style");
9712
- __decorateClass$q([
9898
+ __decorateClass$i([
9713
9899
  property({ fallback: "butt" })
9714
9900
  ], BaseElement2DOutline.prototype, "lineCap");
9715
- __decorateClass$q([
9901
+ __decorateClass$i([
9716
9902
  property({ fallback: "miter" })
9717
9903
  ], BaseElement2DOutline.prototype, "lineJoin");
9718
9904
 
9719
- var __defProp$i = Object.defineProperty;
9720
- var __decorateClass$p = (decorators, target, key, kind) => {
9905
+ var __defProp$e = Object.defineProperty;
9906
+ var __decorateClass$h = (decorators, target, key, kind) => {
9721
9907
  var result = void 0 ;
9722
9908
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9723
9909
  if (decorator = decorators[i])
9724
9910
  result = (decorator(target, key, result) ) || result;
9725
- if (result) __defProp$i(target, key, result);
9911
+ if (result) __defProp$e(target, key, result);
9726
9912
  return result;
9727
9913
  };
9728
9914
  class BaseElement2DShadow extends CoreObject {
@@ -9762,29 +9948,29 @@ class BaseElement2DShadow extends CoreObject {
9762
9948
  }
9763
9949
  }
9764
9950
  }
9765
- __decorateClass$p([
9951
+ __decorateClass$h([
9766
9952
  property({ fallback: true })
9767
9953
  ], BaseElement2DShadow.prototype, "enabled");
9768
- __decorateClass$p([
9954
+ __decorateClass$h([
9769
9955
  property({ fallback: "#000000FF" })
9770
9956
  ], BaseElement2DShadow.prototype, "color");
9771
- __decorateClass$p([
9957
+ __decorateClass$h([
9772
9958
  property({ fallback: 0 })
9773
9959
  ], BaseElement2DShadow.prototype, "blur");
9774
- __decorateClass$p([
9960
+ __decorateClass$h([
9775
9961
  property({ fallback: 0 })
9776
9962
  ], BaseElement2DShadow.prototype, "offsetY");
9777
- __decorateClass$p([
9963
+ __decorateClass$h([
9778
9964
  property({ fallback: 0 })
9779
9965
  ], BaseElement2DShadow.prototype, "offsetX");
9780
9966
 
9781
- var __defProp$h = Object.defineProperty;
9782
- var __decorateClass$o = (decorators, target, key, kind) => {
9967
+ var __defProp$d = Object.defineProperty;
9968
+ var __decorateClass$g = (decorators, target, key, kind) => {
9783
9969
  var result = void 0 ;
9784
9970
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9785
9971
  if (decorator = decorators[i])
9786
9972
  result = (decorator(target, key, result) ) || result;
9787
- if (result) __defProp$h(target, key, result);
9973
+ if (result) __defProp$d(target, key, result);
9788
9974
  return result;
9789
9975
  };
9790
9976
  class BaseElement2DShape extends CoreObject {
@@ -9835,18 +10021,18 @@ class BaseElement2DShape extends CoreObject {
9835
10021
  path.applyTransform(new Matrix3$1().translate(-x, -y).scale(1 / w, 1 / h));
9836
10022
  });
9837
10023
  }
9838
- draw() {
9839
- if (this.enabled && this._path2DSet.paths.length) {
10024
+ draw(rect = false) {
10025
+ if (!rect && this.enabled && this._path2DSet.paths.length) {
9840
10026
  const ctx = this.parent.context;
9841
10027
  const { width, height } = this.parent.size;
9842
10028
  this._path2DSet.paths.forEach((path) => {
9843
10029
  ctx.addPath(path.clone().applyTransform(new Matrix3$1().scale(width, height)));
9844
10030
  });
9845
10031
  } else {
9846
- this.drawRect();
10032
+ this._drawRect();
9847
10033
  }
9848
10034
  }
9849
- drawRect() {
10035
+ _drawRect() {
9850
10036
  const ctx = this.parent.context;
9851
10037
  const { width, height } = this.parent.size;
9852
10038
  const { borderRadius } = this.parent.style;
@@ -9859,19 +10045,19 @@ class BaseElement2DShape extends CoreObject {
9859
10045
  }
9860
10046
  }
9861
10047
  }
9862
- __decorateClass$o([
10048
+ __decorateClass$g([
9863
10049
  property({ fallback: true })
9864
10050
  ], BaseElement2DShape.prototype, "enabled");
9865
- __decorateClass$o([
10051
+ __decorateClass$g([
9866
10052
  property()
9867
10053
  ], BaseElement2DShape.prototype, "preset");
9868
- __decorateClass$o([
10054
+ __decorateClass$g([
9869
10055
  property()
9870
10056
  ], BaseElement2DShape.prototype, "svg");
9871
- __decorateClass$o([
10057
+ __decorateClass$g([
9872
10058
  property()
9873
10059
  ], BaseElement2DShape.prototype, "viewBox");
9874
- __decorateClass$o([
10060
+ __decorateClass$g([
9875
10061
  property()
9876
10062
  ], BaseElement2DShape.prototype, "paths");
9877
10063
 
@@ -9887,13 +10073,13 @@ for (const key in defaultStyles$1) {
9887
10073
  defineProperty(BaseElement2DStyle, key, { fallback });
9888
10074
  }
9889
10075
 
9890
- var __defProp$g = Object.defineProperty;
9891
- var __decorateClass$n = (decorators, target, key, kind) => {
10076
+ var __defProp$c = Object.defineProperty;
10077
+ var __decorateClass$f = (decorators, target, key, kind) => {
9892
10078
  var result = void 0 ;
9893
10079
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9894
10080
  if (decorator = decorators[i])
9895
10081
  result = (decorator(target, key, result) ) || result;
9896
- if (result) __defProp$g(target, key, result);
10082
+ if (result) __defProp$c(target, key, result);
9897
10083
  return result;
9898
10084
  };
9899
10085
  class BaseElement2DText extends CoreObject {
@@ -9905,6 +10091,7 @@ class BaseElement2DText extends CoreObject {
9905
10091
  }
9906
10092
  base;
9907
10093
  measureResult;
10094
+ _texture = new CanvasTexture();
9908
10095
  _textureMap = /* @__PURE__ */ new Map();
9909
10096
  setProperties(properties) {
9910
10097
  return super.setProperties(
@@ -9915,24 +10102,28 @@ class BaseElement2DText extends CoreObject {
9915
10102
  super._updateProperty(key, value, oldValue);
9916
10103
  switch (key) {
9917
10104
  case "enabled":
10105
+ this.parent.requestRedraw();
10106
+ break;
9918
10107
  case "effects":
9919
10108
  case "measureDom":
9920
10109
  case "fonts":
10110
+ this.update();
9921
10111
  this.parent.requestRedraw();
9922
10112
  break;
9923
10113
  case "fill":
9924
10114
  case "outline":
9925
10115
  case "content":
10116
+ this.update();
9926
10117
  this._updateTextureMap();
10118
+ this.parent.requestRedraw();
9927
10119
  break;
9928
10120
  }
9929
10121
  }
9930
- _updateBase() {
10122
+ update() {
9931
10123
  this.base.fonts = this.base.fonts ?? this.parent.tree?.fonts;
9932
10124
  this.base.update();
9933
10125
  }
9934
10126
  _updateTextureMap() {
9935
- this._updateBase();
9936
10127
  this._textureMap.clear();
9937
10128
  const pGlyphBoxs = [];
9938
10129
  this.base.paragraphs.forEach((p, pIndex) => {
@@ -9959,7 +10150,6 @@ class BaseElement2DText extends CoreObject {
9959
10150
  this._updateTexture("fill", this.fill, glyphBox);
9960
10151
  this._updateTexture("outline", this.outline, glyphBox);
9961
10152
  }
9962
- this.parent.requestRedraw();
9963
10153
  }
9964
10154
  async _updateTexture(key, fill, box) {
9965
10155
  if (fill && Object.keys(fill).length > 0) {
@@ -9988,19 +10178,19 @@ class BaseElement2DText extends CoreObject {
9988
10178
  this.content = normalizeTextContent(content);
9989
10179
  }
9990
10180
  measure() {
9991
- this._updateBase();
10181
+ this.update();
9992
10182
  return this.base.measure();
9993
10183
  }
9994
10184
  updateMeasure() {
9995
10185
  this.measureResult = this.measure();
9996
10186
  return this;
9997
10187
  }
9998
- canDraw() {
10188
+ isValid() {
9999
10189
  return Boolean(
10000
10190
  this.enabled && !/^\s*$/.test(this.base.toString())
10001
10191
  );
10002
10192
  }
10003
- _getVertTransform() {
10193
+ _createVertTransform() {
10004
10194
  const parent = this.parent;
10005
10195
  if (parent.scale.x > 0 && parent.scale.y > 0) {
10006
10196
  return void 0;
@@ -10009,9 +10199,12 @@ class BaseElement2DText extends CoreObject {
10009
10199
  const origin = parent.getTransformOrigin();
10010
10200
  return new Transform2D().translate(-origin.x, -origin.y).scale(scale > 0 ? 1 : -1, 1).translate(origin.x, origin.y);
10011
10201
  }
10012
- draw() {
10013
- const ctx = this.parent.context;
10014
- this._updateBase();
10202
+ _useDrawByTexture() {
10203
+ return !!this.effects?.length || this.content.some((p) => {
10204
+ return p.fragments.some((f) => !!f.highlightImage);
10205
+ });
10206
+ }
10207
+ _drawByVertices(ctx) {
10015
10208
  this.base.pathSets.forEach((pathSet) => {
10016
10209
  pathSet.paths.forEach((path) => {
10017
10210
  const meta = path.getMeta();
@@ -10034,13 +10227,13 @@ class BaseElement2DText extends CoreObject {
10034
10227
  ctx.style = { ...path.style };
10035
10228
  ctx.uvTransform = uvTransform;
10036
10229
  ctx.fillStyle = texture?.texture ?? fill.color;
10037
- ctx.vertTransform = this._getVertTransform();
10230
+ ctx.vertTransform = this._createVertTransform();
10038
10231
  ctx.fill({ disableWrapMode });
10039
10232
  }
10040
10233
  } else {
10041
10234
  ctx.addPath(path);
10042
10235
  ctx.style = { ...path.style };
10043
- ctx.vertTransform = this._getVertTransform();
10236
+ ctx.vertTransform = this._createVertTransform();
10044
10237
  ctx.fill();
10045
10238
  }
10046
10239
  }
@@ -10063,54 +10256,70 @@ class BaseElement2DText extends CoreObject {
10063
10256
  ctx.strokeStyle = texture?.texture ?? outline.color;
10064
10257
  ctx.lineCap = outline.lineCap;
10065
10258
  ctx.lineJoin = outline.lineJoin;
10066
- ctx.vertTransform = this._getVertTransform();
10259
+ ctx.vertTransform = this._createVertTransform();
10067
10260
  ctx.stroke({ disableWrapMode });
10068
10261
  }
10069
10262
  } else {
10070
10263
  ctx.addPath(path);
10071
10264
  ctx.style = { ...path.style };
10072
- ctx.vertTransform = this._getVertTransform();
10265
+ ctx.vertTransform = this._createVertTransform();
10073
10266
  ctx.stroke();
10074
10267
  }
10075
10268
  }
10076
10269
  } else {
10077
10270
  ctx.addPath(path);
10078
10271
  ctx.style = { ...path.style };
10079
- ctx.vertTransform = this._getVertTransform();
10272
+ ctx.vertTransform = this._createVertTransform();
10080
10273
  ctx.fill();
10081
10274
  }
10082
10275
  });
10083
10276
  });
10084
10277
  }
10278
+ _drawByTexture(ctx) {
10279
+ this._texture.width = Math.round(this.base.boundingBox.width);
10280
+ this._texture.height = Math.round(this.base.boundingBox.height);
10281
+ this.base.render({ view: this._texture.source });
10282
+ ctx.fillStyle = this._texture;
10283
+ ctx.vertTransform = this._createVertTransform();
10284
+ ctx.fill();
10285
+ }
10286
+ draw() {
10287
+ const ctx = this.parent.context;
10288
+ if (this._useDrawByTexture()) {
10289
+ this._drawByTexture(ctx);
10290
+ } else {
10291
+ this._drawByVertices(ctx);
10292
+ }
10293
+ }
10085
10294
  }
10086
- __decorateClass$n([
10295
+ __decorateClass$f([
10087
10296
  property({ fallback: true })
10088
10297
  ], BaseElement2DText.prototype, "enabled");
10089
- __decorateClass$n([
10298
+ __decorateClass$f([
10090
10299
  property({ fallback: () => [] })
10091
10300
  ], BaseElement2DText.prototype, "content");
10092
- __decorateClass$n([
10301
+ __decorateClass$f([
10093
10302
  property({ alias: "parent.style.json" })
10094
10303
  ], BaseElement2DText.prototype, "style");
10095
- __decorateClass$n([
10304
+ __decorateClass$f([
10096
10305
  property()
10097
10306
  ], BaseElement2DText.prototype, "effects");
10098
- __decorateClass$n([
10307
+ __decorateClass$f([
10099
10308
  property()
10100
10309
  ], BaseElement2DText.prototype, "fill");
10101
- __decorateClass$n([
10310
+ __decorateClass$f([
10102
10311
  property()
10103
10312
  ], BaseElement2DText.prototype, "outline");
10104
- __decorateClass$n([
10313
+ __decorateClass$f([
10105
10314
  property({ alias: "base.measureDom" })
10106
10315
  ], BaseElement2DText.prototype, "measureDom");
10107
- __decorateClass$n([
10316
+ __decorateClass$f([
10108
10317
  property({ alias: "base.fonts" })
10109
10318
  ], BaseElement2DText.prototype, "fonts");
10110
10319
 
10111
- var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
10112
- var __decorateClass$m = (decorators, target, key, kind) => {
10113
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
10320
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
10321
+ var __decorateClass$e = (decorators, target, key, kind) => {
10322
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
10114
10323
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
10115
10324
  if (decorator = decorators[i])
10116
10325
  result = (decorator(result)) || result;
@@ -10220,13 +10429,13 @@ let BaseElement2D = class extends Node2D {
10220
10429
  break;
10221
10430
  case "scaleX":
10222
10431
  this.scale.x = this.style.scaleX;
10223
- if (this.text.canDraw() && (value ^ oldValue) < 0) {
10432
+ if (this.text.isValid() && (value ^ oldValue) < 0) {
10224
10433
  this.requestRedraw();
10225
10434
  }
10226
10435
  break;
10227
10436
  case "scaleY":
10228
10437
  this.scale.y = this.style.scaleY;
10229
- if (this.text.canDraw() && (value ^ oldValue) < 0) {
10438
+ if (this.text.isValid() && (value ^ oldValue) < 0) {
10230
10439
  this.requestRedraw();
10231
10440
  }
10232
10441
  break;
@@ -10317,6 +10526,14 @@ let BaseElement2D = class extends Node2D {
10317
10526
  super.updateGlobalTransform();
10318
10527
  this._updateOverflow();
10319
10528
  }
10529
+ _relayout(batchables) {
10530
+ return super._relayout(batchables).map((batchable) => {
10531
+ return {
10532
+ ...batchable,
10533
+ dimension: this.size.toFloat32Array()
10534
+ };
10535
+ });
10536
+ }
10320
10537
  getRect() {
10321
10538
  return this.getGlobalAabb();
10322
10539
  }
@@ -10421,39 +10638,29 @@ let BaseElement2D = class extends Node2D {
10421
10638
  }
10422
10639
  _draw() {
10423
10640
  super._draw();
10424
- if (this._text.canDraw()) {
10425
- this._text.updateMeasure();
10426
- }
10427
- if (this._background.canDraw()) {
10641
+ if (this._background.isValid()) {
10428
10642
  this._tree?.log(this.name, "background drawing");
10429
- if (this._background.fillWithShape) {
10430
- this._shape.draw();
10431
- } else {
10432
- this._shape.drawRect();
10433
- }
10643
+ this._shape.draw(!this._background.fillWithShape);
10434
10644
  this._background.draw();
10435
10645
  }
10436
- if (this._fill.canDraw()) {
10646
+ if (this._fill.isValid()) {
10437
10647
  this._tree?.log(this.name, "fill drawing");
10438
10648
  this._shape.draw();
10439
10649
  this._fill.draw();
10440
10650
  }
10441
- if (this._outline.canDraw()) {
10651
+ if (this._outline.isValid()) {
10442
10652
  this._tree?.log(this.name, "outline drawing");
10443
10653
  this._shape.draw();
10444
10654
  this._outline.draw();
10445
10655
  }
10446
- if (this._foreground.canDraw()) {
10656
+ if (this._foreground.isValid()) {
10447
10657
  this._tree?.log(this.name, "foreground drawing");
10448
- if (this._foreground.fillWithShape) {
10449
- this._shape.draw();
10450
- } else {
10451
- this._shape.drawRect();
10452
- }
10658
+ this._shape.draw(!this._foreground.fillWithShape);
10453
10659
  this._foreground.draw();
10454
10660
  }
10455
- if (this._text.canDraw()) {
10661
+ if (this._text.isValid()) {
10456
10662
  this._tree?.log(this.name, "text drawing");
10663
+ this._shape.draw(true);
10457
10664
  this._text.draw();
10458
10665
  }
10459
10666
  this._drawContent();
@@ -10529,7 +10736,7 @@ let BaseElement2D = class extends Node2D {
10529
10736
  });
10530
10737
  }
10531
10738
  };
10532
- BaseElement2D = __decorateClass$m([
10739
+ BaseElement2D = __decorateClass$e([
10533
10740
  customNode("BaseElement2D")
10534
10741
  ], BaseElement2D);
10535
10742
 
@@ -10556,9 +10763,9 @@ class FlexElement2DStyle extends BaseElement2DStyle {
10556
10763
  }
10557
10764
  }
10558
10765
 
10559
- var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
10560
- var __decorateClass$l = (decorators, target, key, kind) => {
10561
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
10766
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
10767
+ var __decorateClass$d = (decorators, target, key, kind) => {
10768
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
10562
10769
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
10563
10770
  if (decorator = decorators[i])
10564
10771
  result = (decorator(result)) || result;
@@ -10609,7 +10816,7 @@ let Element2D = class extends BaseElement2D {
10609
10816
  }
10610
10817
  }
10611
10818
  };
10612
- Element2D = __decorateClass$l([
10819
+ Element2D = __decorateClass$d([
10613
10820
  customNode("Element2D")
10614
10821
  ], Element2D);
10615
10822
 
@@ -10919,9 +11126,9 @@ class FlexLayout {
10919
11126
  }
10920
11127
  }
10921
11128
 
10922
- var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
10923
- var __decorateClass$k = (decorators, target, key, kind) => {
10924
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
11129
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
11130
+ var __decorateClass$c = (decorators, target, key, kind) => {
11131
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
10925
11132
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
10926
11133
  if (decorator = decorators[i])
10927
11134
  result = (decorator(result)) || result;
@@ -10998,18 +11205,18 @@ let FlexElement2D = class extends BaseElement2D {
10998
11205
  }
10999
11206
  }
11000
11207
  };
11001
- FlexElement2D = __decorateClass$k([
11208
+ FlexElement2D = __decorateClass$c([
11002
11209
  customNode("FlexElement2D")
11003
11210
  ], FlexElement2D);
11004
11211
 
11005
- var __defProp$f = Object.defineProperty;
11006
- var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
11007
- var __decorateClass$j = (decorators, target, key, kind) => {
11008
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
11212
+ var __defProp$b = Object.defineProperty;
11213
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
11214
+ var __decorateClass$b = (decorators, target, key, kind) => {
11215
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
11009
11216
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11010
11217
  if (decorator = decorators[i])
11011
11218
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11012
- if (kind && result) __defProp$f(target, key, result);
11219
+ if (kind && result) __defProp$b(target, key, result);
11013
11220
  return result;
11014
11221
  };
11015
11222
  let Image2D = class extends Element2D {
@@ -11121,7 +11328,7 @@ let Image2D = class extends Element2D {
11121
11328
  }
11122
11329
  _drawContent() {
11123
11330
  const texture = this.currentFrameTexture;
11124
- if (texture?.valid) {
11331
+ if (texture?.isValid()) {
11125
11332
  const { left = 0, top = 0, right = 0, bottom = 0 } = this.srcRect ?? {};
11126
11333
  const { width, height } = this.size;
11127
11334
  this.context.fillStyle = texture;
@@ -11145,19 +11352,19 @@ let Image2D = class extends Element2D {
11145
11352
  });
11146
11353
  }
11147
11354
  };
11148
- __decorateClass$j([
11355
+ __decorateClass$b([
11149
11356
  property({ internal: true })
11150
11357
  ], Image2D.prototype, "texture", 2);
11151
- __decorateClass$j([
11358
+ __decorateClass$b([
11152
11359
  property({ fallback: "" })
11153
11360
  ], Image2D.prototype, "src", 2);
11154
- __decorateClass$j([
11361
+ __decorateClass$b([
11155
11362
  property()
11156
11363
  ], Image2D.prototype, "srcRect", 2);
11157
- __decorateClass$j([
11364
+ __decorateClass$b([
11158
11365
  property({ fallback: false })
11159
11366
  ], Image2D.prototype, "gif", 2);
11160
- Image2D = __decorateClass$j([
11367
+ Image2D = __decorateClass$b([
11161
11368
  customNode("Image2D")
11162
11369
  ], Image2D);
11163
11370
 
@@ -11168,27 +11375,22 @@ class TextureRect2D extends Element2D {
11168
11375
  this.setProperties(properties).append(children);
11169
11376
  }
11170
11377
  _drawContent() {
11171
- if (this.texture?.valid) {
11172
- const { width, height } = this.size;
11378
+ if (this.texture?.isValid()) {
11379
+ this.shape.draw(true);
11173
11380
  this.context.fillStyle = this.texture;
11174
- this.context.uvTransform = new Transform2D().scale(
11175
- 1 / width,
11176
- 1 / height
11177
- );
11178
- this.shape.drawRect();
11179
11381
  this.context.fill();
11180
11382
  }
11181
11383
  }
11182
11384
  }
11183
11385
 
11184
- var __defProp$e = Object.defineProperty;
11185
- var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
11186
- var __decorateClass$i = (decorators, target, key, kind) => {
11187
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
11386
+ var __defProp$a = Object.defineProperty;
11387
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
11388
+ var __decorateClass$a = (decorators, target, key, kind) => {
11389
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
11188
11390
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11189
11391
  if (decorator = decorators[i])
11190
11392
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11191
- if (kind && result) __defProp$e(target, key, result);
11393
+ if (kind && result) __defProp$a(target, key, result);
11192
11394
  return result;
11193
11395
  };
11194
11396
  let Lottie2D = class extends TextureRect2D {
@@ -11231,20 +11433,20 @@ let Lottie2D = class extends TextureRect2D {
11231
11433
  super._process(delta);
11232
11434
  }
11233
11435
  };
11234
- __decorateClass$i([
11436
+ __decorateClass$a([
11235
11437
  property({ fallback: "" })
11236
11438
  ], Lottie2D.prototype, "src", 2);
11237
- Lottie2D = __decorateClass$i([
11439
+ Lottie2D = __decorateClass$a([
11238
11440
  customNode("Lottie2D")
11239
11441
  ], Lottie2D);
11240
11442
 
11241
- var __defProp$d = Object.defineProperty;
11242
- var __decorateClass$h = (decorators, target, key, kind) => {
11443
+ var __defProp$9 = Object.defineProperty;
11444
+ var __decorateClass$9 = (decorators, target, key, kind) => {
11243
11445
  var result = void 0 ;
11244
11446
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11245
11447
  if (decorator = decorators[i])
11246
11448
  result = (decorator(target, key, result) ) || result;
11247
- if (result) __defProp$d(target, key, result);
11449
+ if (result) __defProp$9(target, key, result);
11248
11450
  return result;
11249
11451
  };
11250
11452
  class TransformRect2D extends Element2D {
@@ -11290,18 +11492,18 @@ class TransformRect2D extends Element2D {
11290
11492
  this._drawEllipse(width, height / 2);
11291
11493
  }
11292
11494
  }
11293
- __decorateClass$h([
11495
+ __decorateClass$9([
11294
11496
  property({ fallback: 6 })
11295
11497
  ], TransformRect2D.prototype, "handleSize");
11296
11498
 
11297
- var __defProp$c = Object.defineProperty;
11298
- var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
11299
- var __decorateClass$g = (decorators, target, key, kind) => {
11300
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
11499
+ var __defProp$8 = Object.defineProperty;
11500
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
11501
+ var __decorateClass$8 = (decorators, target, key, kind) => {
11502
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
11301
11503
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11302
11504
  if (decorator = decorators[i])
11303
11505
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11304
- if (kind && result) __defProp$c(target, key, result);
11506
+ if (kind && result) __defProp$8(target, key, result);
11305
11507
  return result;
11306
11508
  };
11307
11509
  let Video2D = class extends TextureRect2D {
@@ -11354,21 +11556,21 @@ let Video2D = class extends TextureRect2D {
11354
11556
  super._process(delta);
11355
11557
  }
11356
11558
  };
11357
- __decorateClass$g([
11559
+ __decorateClass$8([
11358
11560
  property({ fallback: "" })
11359
11561
  ], Video2D.prototype, "src", 2);
11360
- Video2D = __decorateClass$g([
11562
+ Video2D = __decorateClass$8([
11361
11563
  customNode("Video2D")
11362
11564
  ], Video2D);
11363
11565
 
11364
- var __defProp$b = Object.defineProperty;
11365
- var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
11366
- var __decorateClass$f = (decorators, target, key, kind) => {
11367
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
11566
+ var __defProp$7 = Object.defineProperty;
11567
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
11568
+ var __decorateClass$7 = (decorators, target, key, kind) => {
11569
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
11368
11570
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11369
11571
  if (decorator = decorators[i])
11370
11572
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11371
- if (kind && result) __defProp$b(target, key, result);
11573
+ if (kind && result) __defProp$7(target, key, result);
11372
11574
  return result;
11373
11575
  };
11374
11576
  const linear = (amount) => amount;
@@ -11687,19 +11889,16 @@ let Animation = class extends TimelineNode {
11687
11889
  });
11688
11890
  }
11689
11891
  };
11690
- __decorateClass$f([
11892
+ __decorateClass$7([
11691
11893
  property({ fallback: "parent" })
11692
11894
  ], Animation.prototype, "effectMode", 2);
11693
- __decorateClass$f([
11694
- property({ fallback: false })
11695
- ], Animation.prototype, "loop", 2);
11696
- __decorateClass$f([
11895
+ __decorateClass$7([
11697
11896
  property({ default: () => [] })
11698
11897
  ], Animation.prototype, "keyframes", 2);
11699
- __decorateClass$f([
11898
+ __decorateClass$7([
11700
11899
  property()
11701
11900
  ], Animation.prototype, "easing", 2);
11702
- Animation = __decorateClass$f([
11901
+ Animation = __decorateClass$7([
11703
11902
  customNode("Animation", {
11704
11903
  renderMode: "disabled",
11705
11904
  processMode: "pausable",
@@ -12580,11 +12779,11 @@ class WebAudio extends AudioPipeline {
12580
12779
  }
12581
12780
  }
12582
12781
 
12583
- var __defProp$a = Object.defineProperty;
12584
- var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
12585
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12586
- var __decorateClass$e = (decorators, target, key, kind) => {
12587
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
12782
+ var __defProp$6 = Object.defineProperty;
12783
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
12784
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12785
+ var __decorateClass$6 = (decorators, target, key, kind) => {
12786
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
12588
12787
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
12589
12788
  if (decorator = decorators[i])
12590
12789
  result = (decorator(result)) || result;
@@ -12795,7 +12994,7 @@ let Audio = class extends TimelineNode {
12795
12994
  }
12796
12995
  };
12797
12996
  __publicField$4(Audio, "_soundPool", []);
12798
- Audio = __decorateClass$e([
12997
+ Audio = __decorateClass$6([
12799
12998
  customNode("Audio")
12800
12999
  ], Audio);
12801
13000
 
@@ -12803,14 +13002,14 @@ class AudioSpectrum extends Node2D {
12803
13002
  //
12804
13003
  }
12805
13004
 
12806
- var __defProp$9 = Object.defineProperty;
12807
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
12808
- var __decorateClass$d = (decorators, target, key, kind) => {
12809
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
13005
+ var __defProp$5 = Object.defineProperty;
13006
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
13007
+ var __decorateClass$5 = (decorators, target, key, kind) => {
13008
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
12810
13009
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
12811
13010
  if (decorator = decorators[i])
12812
13011
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12813
- if (kind && result) __defProp$9(target, key, result);
13012
+ if (kind && result) __defProp$5(target, key, result);
12814
13013
  return result;
12815
13014
  };
12816
13015
  let AudioWaveform = class extends Element2D {
@@ -12892,7 +13091,7 @@ let AudioWaveform = class extends Element2D {
12892
13091
  }
12893
13092
  _drawSrc() {
12894
13093
  const src = this._src;
12895
- if (src?.valid) {
13094
+ if (src?.isValid()) {
12896
13095
  this.context.fillStyle = src;
12897
13096
  this.context.uvTransform = new Transform2D().scale(
12898
13097
  1 / this.style.width,
@@ -12901,521 +13100,24 @@ let AudioWaveform = class extends Element2D {
12901
13100
  }
12902
13101
  }
12903
13102
  };
12904
- __decorateClass$d([
13103
+ __decorateClass$5([
12905
13104
  property()
12906
13105
  ], AudioWaveform.prototype, "src", 2);
12907
- __decorateClass$d([
13106
+ __decorateClass$5([
12908
13107
  property({ fallback: 0 })
12909
13108
  ], AudioWaveform.prototype, "gap", 2);
12910
- __decorateClass$d([
13109
+ __decorateClass$5([
12911
13110
  property({ fallback: "#000000" })
12912
13111
  ], AudioWaveform.prototype, "color", 2);
12913
- AudioWaveform = __decorateClass$d([
13112
+ AudioWaveform = __decorateClass$5([
12914
13113
  customNode("AudioWaveform")
12915
13114
  ], AudioWaveform);
12916
13115
 
12917
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
12918
- var __decorateClass$c = (decorators, target, key, kind) => {
12919
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
12920
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
12921
- if (decorator = decorators[i])
12922
- result = (decorator(result)) || result;
12923
- return result;
12924
- };
12925
- let Control = class extends Element2D {
12926
- constructor(properties, children = []) {
12927
- super();
12928
- this._parentUpdateRect = this._parentUpdateRect.bind(this);
12929
- this.setProperties(properties);
12930
- this.append(children);
12931
- }
12932
- _parented(parent) {
12933
- super._parented(parent);
12934
- parent.on("updateRect", this._parentUpdateRect);
12935
- }
12936
- _unparented(oldParent) {
12937
- super._unparented(oldParent);
12938
- oldParent.off("updateRect", this._parentUpdateRect);
12939
- }
12940
- _parentUpdateRect() {
12941
- const rect = this._parent.getRect();
12942
- this.style.left = rect.left;
12943
- this.style.top = rect.top;
12944
- this.style.width = rect.width;
12945
- this.style.height = rect.height;
12946
- }
12947
- _input(event, key) {
12948
- super._input(event, key);
12949
- this._guiInput(event, key);
12950
- }
12951
- _updateStyleProperty(key, value, oldValue) {
12952
- super._updateStyleProperty(key, value, oldValue);
12953
- switch (key) {
12954
- case "width":
12955
- case "height":
12956
- case "left":
12957
- case "top":
12958
- this.emit("updateRect");
12959
- break;
12960
- }
12961
- }
12962
- // eslint-disable-next-line unused-imports/no-unused-vars
12963
- _guiInput(event, key) {
12964
- }
12965
- };
12966
- Control = __decorateClass$c([
12967
- customNode("Control")
12968
- ], Control);
12969
-
12970
- var __defProp$8 = Object.defineProperty;
12971
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
12972
- var __decorateClass$b = (decorators, target, key, kind) => {
12973
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
12974
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
12975
- if (decorator = decorators[i])
12976
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12977
- if (kind && result) __defProp$8(target, key, result);
12978
- return result;
12979
- };
12980
- let Range = class extends Control {
12981
- constructor(properties, children = []) {
12982
- super();
12983
- this.setProperties(properties).append(children);
12984
- }
12985
- _updateProperty(key, value, oldValue) {
12986
- super._updateProperty(key, value, oldValue);
12987
- switch (key) {
12988
- case "allowGreater":
12989
- case "allowLesser":
12990
- case "page":
12991
- case "minValue":
12992
- case "maxValue":
12993
- case "step":
12994
- case "value":
12995
- this.requestRedraw();
12996
- break;
12997
- }
12998
- }
12999
- };
13000
- __decorateClass$b([
13001
- property({ fallback: false })
13002
- ], Range.prototype, "allowGreater", 2);
13003
- __decorateClass$b([
13004
- property({ fallback: false })
13005
- ], Range.prototype, "allowLesser", 2);
13006
- __decorateClass$b([
13007
- property({ fallback: 1 })
13008
- ], Range.prototype, "page", 2);
13009
- __decorateClass$b([
13010
- property({ fallback: 0 })
13011
- ], Range.prototype, "minValue", 2);
13012
- __decorateClass$b([
13013
- property({ fallback: 100 })
13014
- ], Range.prototype, "maxValue", 2);
13015
- __decorateClass$b([
13016
- property({ fallback: 0.01 })
13017
- ], Range.prototype, "step", 2);
13018
- __decorateClass$b([
13019
- property({ fallback: 0 })
13020
- ], Range.prototype, "value", 2);
13021
- Range = __decorateClass$b([
13022
- customNode("Range")
13023
- ], Range);
13024
-
13025
- var __defProp$7 = Object.defineProperty;
13026
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
13027
- var __decorateClass$a = (decorators, target, key, kind) => {
13028
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
13029
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13030
- if (decorator = decorators[i])
13031
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13032
- if (kind && result) __defProp$7(target, key, result);
13033
- return result;
13034
- };
13035
- let Ruler = class extends Control {
13036
- texture = new CanvasTexture();
13037
- constructor(properties, children = []) {
13038
- super();
13039
- this.setProperties(properties);
13040
- this.append(children);
13041
- }
13042
- _updateProperty(key, value, oldValue) {
13043
- super._updateProperty(key, value, oldValue);
13044
- switch (key) {
13045
- case "offsetX":
13046
- case "offsetY":
13047
- case "thickness":
13048
- case "markHeight":
13049
- case "color":
13050
- case "markBackgroundColor":
13051
- case "markColor":
13052
- case "gap":
13053
- case "scale":
13054
- this.requestRedraw();
13055
- break;
13056
- }
13057
- }
13058
- _updateStyleProperty(key, value, oldValue) {
13059
- super._updateStyleProperty(key, value, oldValue);
13060
- switch (key) {
13061
- case "width":
13062
- case "height":
13063
- this.texture[key] = value;
13064
- this.requestRedraw();
13065
- break;
13066
- }
13067
- }
13068
- _drawTexture() {
13069
- const { width, height } = this.size;
13070
- const {
13071
- offsetX,
13072
- offsetY,
13073
- thickness,
13074
- markHeight,
13075
- markBackgroundColor,
13076
- markColor,
13077
- color,
13078
- gap: _gap,
13079
- gapScale: _scale
13080
- } = this;
13081
- const canvas = this.texture.source;
13082
- const ctx = canvas.getContext("2d");
13083
- ctx.reset();
13084
- ctx.scale(this.texture.pixelRatio, this.texture.pixelRatio);
13085
- const x = Math.round(offsetX);
13086
- const y = Math.round(offsetY);
13087
- ctx.beginPath();
13088
- ctx.fillStyle = markBackgroundColor || "#EEE";
13089
- ctx.fillRect(0, 0, width, thickness);
13090
- ctx.fillRect(0, 0, thickness, height);
13091
- ctx.fill();
13092
- ctx.strokeStyle = markColor || "#000";
13093
- ctx.moveTo(thickness, 0);
13094
- ctx.lineTo(thickness, height);
13095
- ctx.moveTo(0, thickness);
13096
- ctx.lineTo(width, thickness);
13097
- ctx.stroke();
13098
- const originGap = _gap;
13099
- const curGap = _gap * _scale;
13100
- let scale;
13101
- let gap;
13102
- let markSize;
13103
- let axis;
13104
- let i;
13105
- if (originGap >= curGap) {
13106
- scale = originGap / curGap;
13107
- gap = Math.floor(scale) * originGap / 20;
13108
- markSize = originGap / 20 * Math.floor(scale) / scale;
13109
- } else {
13110
- scale = curGap / originGap;
13111
- gap = Math.floor(originGap / 20 / scale);
13112
- if (gap >= 2) {
13113
- gap = Math.floor(gap / 2) * 2;
13114
- } else {
13115
- gap = 1;
13116
- }
13117
- markSize = gap * scale;
13118
- }
13119
- ctx.fillStyle = ctx.strokeStyle;
13120
- for (axis = x, i = 0; axis < width; i++, axis += markSize) {
13121
- ctx.moveTo(axis, thickness - (i % 5 ? markHeight : 2 * markHeight));
13122
- ctx.lineTo(axis, thickness);
13123
- }
13124
- for (axis = x, i = 0; axis > thickness; i++, axis -= markSize) {
13125
- ctx.moveTo(axis, thickness - (i % 5 ? markHeight : 2 * markHeight));
13126
- ctx.lineTo(axis, thickness);
13127
- }
13128
- let textOffset = 0;
13129
- for (axis = y, i = 0; axis > thickness; i++, axis -= markSize) {
13130
- ctx.moveTo(thickness - (i % 5 ? markHeight : 2 * markHeight), axis);
13131
- ctx.lineTo(thickness, axis);
13132
- }
13133
- for (axis = y, i = 0; axis < height; i++, axis += markSize) {
13134
- ctx.moveTo(thickness - (i % 5 ? markHeight : 2 * markHeight), axis);
13135
- ctx.lineTo(thickness, axis);
13136
- }
13137
- ctx.save();
13138
- ctx.fillStyle = color;
13139
- ctx.scale(0.8, 0.8);
13140
- textOffset = thickness - 8;
13141
- for (axis = x, i = 0; axis < width; i++, axis += markSize) {
13142
- if (i % 10 === 0) {
13143
- ctx.fillText(String(Math.ceil(gap * i)), axis * 1.25 - 3, textOffset * 1.25);
13144
- }
13145
- }
13146
- for (axis = x, i = 0; axis > thickness; i++, axis -= markSize) {
13147
- if (i % 10 === 0) {
13148
- ctx.fillText(String(Math.ceil(-gap * i)), axis * 1.25 - 3, textOffset * 1.25);
13149
- }
13150
- }
13151
- textOffset = 0;
13152
- for (axis = y, i = 0; axis > thickness; i++, axis -= markSize) {
13153
- if (i % 10 === 0) {
13154
- ctx.fillText(String(Math.ceil(gap * i)), textOffset * 1.25, axis * 1.25 + 3);
13155
- }
13156
- }
13157
- for (axis = y, i = 0; axis < height; i++, axis += markSize) {
13158
- if (i % 10 === 0) {
13159
- ctx.fillText(String(Math.ceil(-gap * i)), textOffset * 1.25, axis * 1.25 + 3);
13160
- }
13161
- }
13162
- ctx.restore();
13163
- ctx.stroke();
13164
- this.texture.requestUpload();
13165
- }
13166
- _draw() {
13167
- this._drawTexture();
13168
- const texture = this.texture;
13169
- if (texture?.valid) {
13170
- this.context.fillStyle = texture;
13171
- this.context.uvTransform = new Transform2D().scale(
13172
- 1 / this.size.width,
13173
- 1 / this.size.height
13174
- );
13175
- this.context.rect(0, 0, texture.width, texture.height);
13176
- this.context.fill();
13177
- }
13178
- }
13179
- };
13180
- __decorateClass$a([
13181
- property({ fallback: 0 })
13182
- ], Ruler.prototype, "offsetX", 2);
13183
- __decorateClass$a([
13184
- property({ fallback: 0 })
13185
- ], Ruler.prototype, "offsetY", 2);
13186
- __decorateClass$a([
13187
- property({ fallback: 20 })
13188
- ], Ruler.prototype, "thickness", 2);
13189
- __decorateClass$a([
13190
- property({ fallback: 3 })
13191
- ], Ruler.prototype, "markHeight", 2);
13192
- __decorateClass$a([
13193
- property({ fallback: "#b2b6bc" })
13194
- ], Ruler.prototype, "color", 2);
13195
- __decorateClass$a([
13196
- property({ fallback: "#f9f9fa" })
13197
- ], Ruler.prototype, "markBackgroundColor", 2);
13198
- __decorateClass$a([
13199
- property({ fallback: "#b2b6bc" })
13200
- ], Ruler.prototype, "markColor", 2);
13201
- __decorateClass$a([
13202
- property({ fallback: 300 })
13203
- ], Ruler.prototype, "gap", 2);
13204
- __decorateClass$a([
13205
- property({ fallback: 1 })
13206
- ], Ruler.prototype, "gapScale", 2);
13207
- Ruler = __decorateClass$a([
13208
- customNode("Ruler")
13209
- ], Ruler);
13210
-
13211
- var __defProp$6 = Object.defineProperty;
13212
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
13213
- var __decorateClass$9 = (decorators, target, key, kind) => {
13214
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
13215
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13216
- if (decorator = decorators[i])
13217
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13218
- if (kind && result) __defProp$6(target, key, result);
13219
- return result;
13220
- };
13221
- let ScrollBar = class extends Range {
13222
- constructor(properties, children = []) {
13223
- super();
13224
- this.setProperties(properties).append(children);
13225
- }
13226
- _updateStyleProperty(key, value, oldValue) {
13227
- super._updateStyleProperty(key, value, oldValue);
13228
- switch (key) {
13229
- case "width":
13230
- case "height":
13231
- case "left":
13232
- case "top":
13233
- this.requestRedraw();
13234
- break;
13235
- }
13236
- }
13237
- _rect() {
13238
- const { size, position } = this;
13239
- let left, top, width, height, radii;
13240
- if (this.direction === "vertical") {
13241
- width = 10;
13242
- height = size.height * (this.page / (this.maxValue - this.minValue));
13243
- left = position.left + size.width - width;
13244
- top = size.height * (this.value / (this.maxValue - this.minValue));
13245
- radii = width / 2;
13246
- } else {
13247
- width = size.width * (this.page / (this.maxValue - this.minValue));
13248
- height = 10;
13249
- left = size.width * (this.value / (this.maxValue - this.minValue));
13250
- top = position.top + size.height - height;
13251
- radii = height / 2;
13252
- }
13253
- return { left, top, width, height, radii };
13254
- }
13255
- _draw() {
13256
- const { left, top, width, height, radii } = this._rect();
13257
- this.context.roundRect(left, top, width, height, radii);
13258
- this.context.fillStyle = 34;
13259
- this.context.fill();
13260
- }
13261
- _pointerInput(point, key) {
13262
- const { left, top, width, height } = this._rect();
13263
- const flag = point.x >= left && point.x < left + width && point.y >= top && point.y < top + height;
13264
- switch (key) {
13265
- case "pointerdown":
13266
- case "pointermove":
13267
- if (flag) {
13268
- this._tree?.input.setCursor("pointer");
13269
- } else {
13270
- this._tree?.input.setCursor(void 0);
13271
- }
13272
- break;
13273
- }
13274
- return false;
13275
- }
13276
- };
13277
- __decorateClass$9([
13278
- property({ fallback: "vertical" })
13279
- ], ScrollBar.prototype, "direction", 2);
13280
- ScrollBar = __decorateClass$9([
13281
- customNode("ScrollBar")
13282
- ], ScrollBar);
13283
-
13284
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
13285
- var __decorateClass$8 = (decorators, target, key, kind) => {
13286
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
13287
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13288
- if (decorator = decorators[i])
13289
- result = (decorator(result)) || result;
13290
- return result;
13291
- };
13292
- let XScrollBar = class extends ScrollBar {
13293
- constructor(properties, children = []) {
13294
- super();
13295
- this.setProperties(properties).append(children);
13296
- }
13297
- };
13298
- XScrollBar = __decorateClass$8([
13299
- customNode("XScrollBar", {
13300
- direction: "horizontal"
13301
- })
13302
- ], XScrollBar);
13303
-
13304
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
13305
- var __decorateClass$7 = (decorators, target, key, kind) => {
13306
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
13307
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13308
- if (decorator = decorators[i])
13309
- result = (decorator(result)) || result;
13310
- return result;
13311
- };
13312
- let YScrollBar = class extends ScrollBar {
13313
- constructor(properties, children = []) {
13314
- super();
13315
- this.setProperties(properties).append(children);
13316
- }
13317
- };
13318
- YScrollBar = __decorateClass$7([
13319
- customNode("YScrollBar", {
13320
- direction: "vertical"
13321
- })
13322
- ], YScrollBar);
13323
-
13324
- var __defProp$5 = Object.defineProperty;
13325
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
13326
- var __decorateClass$6 = (decorators, target, key, kind) => {
13327
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
13328
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13329
- if (decorator = decorators[i])
13330
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13331
- if (kind && result) __defProp$5(target, key, result);
13332
- return result;
13333
- };
13334
- let Scaler = class extends Node {
13335
- get target() {
13336
- if (this.parent?.style) {
13337
- return this.parent;
13338
- }
13339
- return void 0;
13340
- }
13341
- constructor(properties, children = []) {
13342
- super();
13343
- this.setProperties(properties);
13344
- this.append(children);
13345
- }
13346
- _updateProperty(key, value, oldValue) {
13347
- super._updateProperty(key, value, oldValue);
13348
- switch (key) {
13349
- case "translateY":
13350
- case "translateX":
13351
- case "scale":
13352
- case "min":
13353
- case "max": {
13354
- this.scale = clamp(this.scale, this.minScale, this.maxScale);
13355
- this._updateTarget();
13356
- break;
13357
- }
13358
- }
13359
- }
13360
- _updateTarget() {
13361
- const target = this.target;
13362
- if (target) {
13363
- target.style.transform = `translate(${this.translateX}px, ${this.translateY}px) scale(${this.scale})`;
13364
- this.emit("updateScale", this.scale);
13365
- }
13366
- }
13367
- _onWheel(e) {
13368
- const target = this.target;
13369
- if (!target)
13370
- return;
13371
- e.preventDefault();
13372
- if (e.ctrlKey) {
13373
- const isTouchPad = e.wheelDeltaY ? Math.abs(Math.abs(e.wheelDeltaY) - Math.abs(3 * e.deltaY)) < 3 : e.deltaMode === 0;
13374
- if (!isTouchPad) {
13375
- e.preventDefault();
13376
- this.scale += e.deltaY * -0.015;
13377
- }
13378
- } else {
13379
- this.translateX -= e.deltaX;
13380
- this.translateY -= e.deltaY;
13381
- }
13382
- }
13383
- _input(event, key) {
13384
- super._input(event, key);
13385
- switch (key) {
13386
- case "wheel":
13387
- this._onWheel(event);
13388
- break;
13389
- }
13390
- }
13391
- };
13392
- __decorateClass$6([
13393
- property({ default: 1 })
13394
- ], Scaler.prototype, "translateX", 2);
13395
- __decorateClass$6([
13396
- property({ default: 1 })
13397
- ], Scaler.prototype, "translateY", 2);
13398
- __decorateClass$6([
13399
- property({ default: 1 })
13400
- ], Scaler.prototype, "scale", 2);
13401
- __decorateClass$6([
13402
- property({ default: 0.05 })
13403
- ], Scaler.prototype, "minScale", 2);
13404
- __decorateClass$6([
13405
- property({ default: 10 })
13406
- ], Scaler.prototype, "maxScale", 2);
13407
- Scaler = __decorateClass$6([
13408
- customNode("Scaler", {
13409
- processMode: "disabled",
13410
- renderMode: "disabled"
13411
- })
13412
- ], Scaler);
13413
-
13414
13116
  var __defProp$4 = Object.defineProperty;
13415
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
13117
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
13416
13118
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13417
- var __decorateClass$5 = (decorators, target, key, kind) => {
13418
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
13119
+ var __decorateClass$4 = (decorators, target, key, kind) => {
13120
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
13419
13121
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13420
13122
  if (decorator = decorators[i])
13421
13123
  result = (decorator(result)) || result;
@@ -13503,15 +13205,15 @@ void main(void) {
13503
13205
  gl_FragColor = color;
13504
13206
  }`
13505
13207
  }));
13506
- KawaseTransition = __decorateClass$5([
13208
+ KawaseTransition = __decorateClass$4([
13507
13209
  customNode("KawaseTransition")
13508
13210
  ], KawaseTransition);
13509
13211
 
13510
13212
  var __defProp$3 = Object.defineProperty;
13511
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
13213
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
13512
13214
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13513
- var __decorateClass$4 = (decorators, target, key, kind) => {
13514
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
13215
+ var __decorateClass$3 = (decorators, target, key, kind) => {
13216
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
13515
13217
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13516
13218
  if (decorator = decorators[i])
13517
13219
  result = (decorator(result)) || result;
@@ -13556,15 +13258,15 @@ void main() {
13556
13258
  gl_FragColor = mix(src2Color, src1Color, mixPercent);
13557
13259
  }`
13558
13260
  }));
13559
- LeftEraseTransition = __decorateClass$4([
13261
+ LeftEraseTransition = __decorateClass$3([
13560
13262
  customNode("LeftEraseTransition")
13561
13263
  ], LeftEraseTransition);
13562
13264
 
13563
13265
  var __defProp$2 = Object.defineProperty;
13564
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
13266
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
13565
13267
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13566
- var __decorateClass$3 = (decorators, target, key, kind) => {
13567
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
13268
+ var __decorateClass$2 = (decorators, target, key, kind) => {
13269
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
13568
13270
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13569
13271
  if (decorator = decorators[i])
13570
13272
  result = (decorator(result)) || result;
@@ -13663,15 +13365,15 @@ void main(void) {
13663
13365
  gl_FragColor = color;
13664
13366
  }`
13665
13367
  }));
13666
- TiltShiftTransition = __decorateClass$3([
13368
+ TiltShiftTransition = __decorateClass$2([
13667
13369
  customNode("TiltShiftTransition")
13668
13370
  ], TiltShiftTransition);
13669
13371
 
13670
13372
  var __defProp$1 = Object.defineProperty;
13671
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
13373
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13672
13374
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13673
- var __decorateClass$2 = (decorators, target, key, kind) => {
13674
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
13375
+ var __decorateClass$1 = (decorators, target, key, kind) => {
13376
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
13675
13377
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13676
13378
  if (decorator = decorators[i])
13677
13379
  result = (decorator(result)) || result;
@@ -13757,7 +13459,7 @@ void main(void) {
13757
13459
  gl_FragColor = texture2D(sampler, coord);
13758
13460
  }`
13759
13461
  }));
13760
- TwistTransition = __decorateClass$2([
13462
+ TwistTransition = __decorateClass$1([
13761
13463
  customNode("TwistTransition")
13762
13464
  ], TwistTransition);
13763
13465
 
@@ -14121,220 +13823,6 @@ class Assets {
14121
13823
  }
14122
13824
  const assets = new Assets().use(new FontLoader()).use(new GifLoader()).use(new JsonLoader()).use(new LottieLoader()).use(new TextLoader()).use(new TextureLoader()).use(new VideoLoader());
14123
13825
 
14124
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14125
- var __decorateClass$1 = (decorators, target, key, kind) => {
14126
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14127
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
14128
- if (decorator = decorators[i])
14129
- result = (decorator(result)) || result;
14130
- return result;
14131
- };
14132
- let CanvasItemEditor = class extends Control {
14133
- _pointerStart;
14134
- _pointerOffset;
14135
- selected;
14136
- dragging;
14137
- hovered;
14138
- hover = new Element2D({
14139
- name: "hover",
14140
- internalMode: "back",
14141
- style: {
14142
- visibility: "hidden",
14143
- outlineStyle: "solid",
14144
- outlineColor: "#00FF00FF",
14145
- outlineWidth: 2,
14146
- pointerEvents: "none"
14147
- }
14148
- });
14149
- transformRect = new TransformRect2D({
14150
- name: "transformRect",
14151
- internalMode: "back",
14152
- style: {
14153
- visibility: "hidden",
14154
- pointerEvents: "none"
14155
- }
14156
- });
14157
- scaler = new Scaler({
14158
- name: "Scaler",
14159
- internalMode: "back"
14160
- }).on("updateScale", (scale) => {
14161
- this.ruler.gapScale = scale;
14162
- this._updateScrollbars();
14163
- this._updateSelectionRect();
14164
- });
14165
- xScrollBar = new XScrollBar({
14166
- name: "XScrollBar",
14167
- internalMode: "back",
14168
- style: {
14169
- visibility: "hidden"
14170
- }
14171
- });
14172
- yScrollBar = new YScrollBar({
14173
- name: "yScrollBar",
14174
- internalMode: "back",
14175
- style: {
14176
- visibility: "hidden"
14177
- }
14178
- });
14179
- drawboard = new Element2D({
14180
- name: "drawboard",
14181
- style: {
14182
- width: 500,
14183
- height: 500,
14184
- backgroundColor: "#00FFFFFF",
14185
- // overflow: 'hidden',
14186
- pointerEvents: "none"
14187
- // boxShadow: '2px 2px 2px 1px rgba(0, 0, 0, 0.2)',
14188
- }
14189
- }, [
14190
- this.scaler
14191
- ]);
14192
- ruler = new Ruler({
14193
- name: "ruler",
14194
- offsetX: 100,
14195
- offsetY: 100,
14196
- style: {
14197
- pointerEvents: "none"
14198
- }
14199
- }, [
14200
- this.drawboard,
14201
- this.hover,
14202
- this.transformRect,
14203
- this.xScrollBar,
14204
- this.yScrollBar
14205
- ]);
14206
- constructor() {
14207
- super();
14208
- this._onPointerdown = this._onPointerdown.bind(this);
14209
- this._onPointermove = this._onPointermove.bind(this);
14210
- this._onPointerup = this._onPointerup.bind(this);
14211
- this.append(this.ruler);
14212
- }
14213
- _updateStyleProperty(key, value, oldValue) {
14214
- super._updateStyleProperty(key, value, oldValue);
14215
- switch (key) {
14216
- case "width":
14217
- this.drawboard.style.left = (this.size.width - this.drawboard.size.width) / 2;
14218
- this.ruler.offsetX = this.drawboard.style.left;
14219
- break;
14220
- case "height":
14221
- this.drawboard.style.top = (this.size.height - this.drawboard.size.height) / 2;
14222
- this.ruler.offsetY = this.drawboard.style.top;
14223
- break;
14224
- }
14225
- }
14226
- _guiInput(event, key) {
14227
- super._guiInput(event, key);
14228
- switch (key) {
14229
- case "pointerdown":
14230
- this._onPointerdown(event);
14231
- break;
14232
- case "pointermove":
14233
- this._onPointermove(event);
14234
- break;
14235
- case "pointerup":
14236
- this._onPointerup();
14237
- break;
14238
- }
14239
- }
14240
- _onPointerdown(e) {
14241
- let target = e.target;
14242
- if (target?.equal(this)) {
14243
- target = void 0;
14244
- }
14245
- if (target?.equal(this.transformRect)) {
14246
- target = this.selected;
14247
- }
14248
- this._pointerOffset = { x: e.offsetX, y: e.offsetY };
14249
- this.selected = target;
14250
- this.dragging = target;
14251
- if (target instanceof Element2D) {
14252
- this._pointerStart = target.style.clone();
14253
- } else {
14254
- this._pointerStart = void 0;
14255
- }
14256
- this._updateHover();
14257
- this._updateSelectionRect();
14258
- }
14259
- _onPointermove(e) {
14260
- let target = e.target;
14261
- if (target?.equal(this)) {
14262
- target = void 0;
14263
- }
14264
- if (target?.equal(this.transformRect)) {
14265
- target = this.selected;
14266
- }
14267
- const { selected, dragging, _pointerStart, _pointerOffset } = this;
14268
- if (selected && target?.equal(selected)) {
14269
- this.hovered = void 0;
14270
- } else {
14271
- this.hovered = target;
14272
- }
14273
- const offset = _pointerOffset ? { x: e.offsetX - _pointerOffset.x, y: e.offsetY - _pointerOffset.y } : { x: 0, y: 0 };
14274
- if (dragging && _pointerStart) {
14275
- dragging.style.left = _pointerStart.left + offset.x / this.scaler.scale;
14276
- dragging.style.top = _pointerStart.top + offset.y / this.scaler.scale;
14277
- dragging.update();
14278
- }
14279
- this._updateHover();
14280
- this._updateSelectionRect();
14281
- }
14282
- _onPointerup() {
14283
- this.dragging = void 0;
14284
- this._updateHover();
14285
- this._updateSelectionRect();
14286
- }
14287
- _copyGlobalTransform(a, b) {
14288
- a.style.visibility = "visible";
14289
- a.style.width = b.globalScale.x * b.size.x;
14290
- a.style.height = b.globalScale.y * b.size.y;
14291
- a.style.left = b.globalPosition.x;
14292
- a.style.top = b.globalPosition.y;
14293
- a.style.rotate = b.globalRotation;
14294
- a.update();
14295
- }
14296
- _updateHover() {
14297
- const hovered = this.hovered;
14298
- if (hovered instanceof Element2D) {
14299
- this.hover.style.visibility = "visible";
14300
- this._copyGlobalTransform(this.hover, hovered);
14301
- this.hover.requestRedraw();
14302
- } else {
14303
- this.hover.style.visibility = "hidden";
14304
- }
14305
- }
14306
- _updateSelectionRect() {
14307
- if (this.selected) {
14308
- this.transformRect.style.visibility = "visible";
14309
- this._copyGlobalTransform(this.transformRect, this.selected);
14310
- } else {
14311
- this.transformRect.style.visibility = "hidden";
14312
- }
14313
- }
14314
- _updateScrollbars() {
14315
- const scale = this.ruler.gapScale;
14316
- const scrollHeight = this.drawboard.size.height * scale;
14317
- const scrollWidth = this.drawboard.size.width * scale;
14318
- if (scrollHeight > this.size.height) {
14319
- this.yScrollBar.style.visibility = "visible";
14320
- this.yScrollBar.maxValue = scrollHeight;
14321
- this.yScrollBar.page = this.size.height;
14322
- } else {
14323
- this.yScrollBar.style.visibility = "hidden";
14324
- }
14325
- if (scrollWidth > this.size.width) {
14326
- this.xScrollBar.style.visibility = "visible";
14327
- this.xScrollBar.maxValue = scrollWidth;
14328
- this.xScrollBar.page = this.size.width;
14329
- } else {
14330
- this.xScrollBar.style.visibility = "hidden";
14331
- }
14332
- }
14333
- };
14334
- CanvasItemEditor = __decorateClass$1([
14335
- customNode("CanvasItemEditor")
14336
- ], CanvasItemEditor);
14337
-
14338
13826
  var __defProp = Object.defineProperty;
14339
13827
  var __decorateClass = (decorators, target, key, kind) => {
14340
13828
  var result = void 0 ;
@@ -14600,4 +14088,4 @@ async function render(options) {
14600
14088
  });
14601
14089
  }
14602
14090
 
14603
- export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, Camera2D, CanvasContext, CanvasItem, CanvasItemEditor, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, Control, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, DropShadowEffect, Effect, EffectMaterial, Element2D, Element2DStyle, EmbossEffect, Engine, FlexElement2D, FlexElement2DStyle, FlexLayout, FontLoader, GaussianBlurEffect, Geometry, GifLoader, GlitchEffect, GodrayEffect, GradientTexture, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, ImageTexture, IndexBuffer, Input, InputEvent, JsonLoader, KawaseBlurEffect, KawaseTransition, KeyboardInputEvent, LeftEraseTransition, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, Meta, MouseInputEvent, Node, Node2D, OutlineEffect, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, Range, RawWeakMap, Rect2, RefCounted, Renderer, Resource, Ruler, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, Scaler, SceneTree, ScrollBar, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftTransition, Timeline, TimelineNode, Transform2D, TransformRect2D, Transition, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, Window, XScrollBar, YScrollBar, ZoomBlurEffect, alignMap, assets, boxSizingMap, clamp, clampFrag, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, determineCrossOrigin, directionMap, displayMap, ease, easeIn, easeInOut, easeOut, edgeMap, flexDirectionMap, flexWrapMap, frag$1 as frag, getDefaultCssPropertyValue, gutterMap, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, justifyMap, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, overflowMap, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, positionTypeMap, render, timingFunctions, uid };
14091
+ export { AnimatedTexture, Animation, Assets, Audio, AudioPipeline, AudioProcessor, AudioSpectrum, AudioWaveform, BaseElement2D, BaseElement2DBackground, BaseElement2DFill, BaseElement2DForeground, BaseElement2DOutline, BaseElement2DShadow, BaseElement2DShape, BaseElement2DStyle, BaseElement2DText, Camera2D, CanvasContext, CanvasItem, CanvasTexture, Color, ColorAdjustEffect, ColorFilterEffect, ColorMatrix, ColorOverlayEffect, ColorRemoveEffect, ColorReplaceEffect, ColorTexture, CoreObject, DEG_TO_RAD, DEVICE_PIXEL_RATIO, DrawboardEffect, DropShadowEffect, Effect, EffectMaterial, Element2D, Element2DStyle, EmbossEffect, Engine, FlexElement2D, FlexElement2DStyle, FlexLayout, FontLoader, GaussianBlurEffect, Geometry, GifLoader, GlitchEffect, GodrayEffect, GradientTexture, HTMLAudio, HTMLAudioContext, HTMLSound, IN_BROWSER, Image2D, ImageTexture, IndexBuffer, Input, InputEvent, JsonLoader, KawaseBlurEffect, KawaseTransition, KeyboardInputEvent, LeftEraseTransition, Loader, Lottie2D, LottieLoader, MainLoop, MaskEffect, Material, Matrix, Matrix2, Matrix3, Matrix4, Meta, MouseInputEvent, Node, Node2D, OutlineEffect, PI, PI_2, PixelateEffect, PixelsTexture, PointerInputEvent, Projection2D, QuadGeometry, QuadUvGeometry, RAD_TO_DEG, RawWeakMap, Rect2, RefCounted, Renderer, Resource, SUPPORTS_AUDIO_CONTEXT, SUPPORTS_CLICK_EVENTS, SUPPORTS_CREATE_IMAGE_BITMAP, SUPPORTS_IMAGE_BITMAP, SUPPORTS_MOUSE_EVENTS, SUPPORTS_OFFLINE_AUDIO_CONTEXT, SUPPORTS_POINTER_EVENTS, SUPPORTS_RESIZE_OBSERVER, SUPPORTS_TOUCH_EVENTS, SUPPORTS_WEBGL2, SUPPORTS_WEBKIT_AUDIO_CONTEXT, SUPPORTS_WEBKIT_OFFLINE_AUDIO_CONTEXT, SUPPORTS_WEB_AUDIO, SUPPORTS_WHEEL_EVENTS, SceneTree, TextLoader, Texture2D, TextureLoader, TextureRect2D, Ticker, TiltShiftTransition, Timeline, TimelineNode, Transform2D, TransformRect2D, Transition, TwistTransition, UvGeometry, UvMaterial, Vector, Vector2, Vector3, Vector4, VertexAttribute, VertexBuffer, Video2D, VideoLoader, VideoTexture, Viewport, ViewportTexture, WebAudio, WebAudioContext, WebGLBatch2DModule, WebGLBlendMode, WebGLBufferModule, WebGLFramebufferModule, WebGLMaskModule, WebGLModule, WebGLProgramModule, WebGLRenderer, WebGLScissorModule, WebGLState, WebGLStateModule, WebGLStencilModule, WebGLTextureModule, WebGLVertexArrayModule, WebGLViewportModule, WebSound, WheelInputEvent, Window, ZoomBlurEffect, alignMap, assets, boxSizingMap, clamp, clampFrag, createHTMLCanvas, createNode, crossOrigin, cubicBezier, curves, customNode, customNodes, defaultOptions, determineCrossOrigin, directionMap, displayMap, ease, easeIn, easeInOut, easeOut, edgeMap, flexDirectionMap, flexWrapMap, frag$1 as frag, getDefaultCssPropertyValue, gutterMap, isCanvasElement, isElementNode, isImageElement, isPow2, isVideoElement, isWebgl2, justifyMap, lerp, linear, log2, mapWebGLBlendModes, nextPow2, nextTick, overflowMap, parseCSSFilter, parseCSSTransform, parseCSSTransformOrigin, parseCssFunctions, parseCssProperty, positionTypeMap, render, timingFunctions, uid };