modern-canvas 0.10.2 → 0.11.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.cjs CHANGED
@@ -1137,6 +1137,9 @@ class Vector extends modernIdoc.Observable {
1137
1137
  toArray() {
1138
1138
  return this._array.slice();
1139
1139
  }
1140
+ toFloat32Array() {
1141
+ return new Float32Array(this._array);
1142
+ }
1140
1143
  toJSON() {
1141
1144
  return this.toArray();
1142
1145
  }
@@ -1274,6 +1277,9 @@ class Matrix extends modernIdoc.Observable {
1274
1277
  }
1275
1278
  return array.slice();
1276
1279
  }
1280
+ toFloat32Array(transpose) {
1281
+ return new Float32Array(this.toArray(transpose));
1282
+ }
1277
1283
  toName() {
1278
1284
  return `Matrix${this.rows}(${this.rows}x${this.cols})`;
1279
1285
  }
@@ -2097,13 +2103,13 @@ class Vector3 extends Vector {
2097
2103
  }
2098
2104
  }
2099
2105
 
2100
- var __defProp$T = Object.defineProperty;
2101
- var __decorateClass$$ = (decorators, target, key, kind) => {
2106
+ var __defProp$R = Object.defineProperty;
2107
+ var __decorateClass$V = (decorators, target, key, kind) => {
2102
2108
  var result = void 0 ;
2103
2109
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
2104
2110
  if (decorator = decorators[i])
2105
2111
  result = (decorator(target, key, result) ) || result;
2106
- if (result) __defProp$T(target, key, result);
2112
+ if (result) __defProp$R(target, key, result);
2107
2113
  return result;
2108
2114
  };
2109
2115
  class MainLoop extends CoreObject {
@@ -2151,20 +2157,20 @@ class MainLoop extends CoreObject {
2151
2157
  super.destroy();
2152
2158
  }
2153
2159
  }
2154
- __decorateClass$$([
2160
+ __decorateClass$V([
2155
2161
  modernIdoc.property({ fallback: 60 })
2156
2162
  ], MainLoop.prototype, "fps");
2157
- __decorateClass$$([
2163
+ __decorateClass$V([
2158
2164
  modernIdoc.property({ fallback: 1 })
2159
2165
  ], MainLoop.prototype, "speed");
2160
2166
 
2161
- var __defProp$S = Object.defineProperty;
2162
- var __decorateClass$_ = (decorators, target, key, kind) => {
2167
+ var __defProp$Q = Object.defineProperty;
2168
+ var __decorateClass$U = (decorators, target, key, kind) => {
2163
2169
  var result = void 0 ;
2164
2170
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
2165
2171
  if (decorator = decorators[i])
2166
2172
  result = (decorator(target, key, result) ) || result;
2167
- if (result) __defProp$S(target, key, result);
2173
+ if (result) __defProp$Q(target, key, result);
2168
2174
  return result;
2169
2175
  };
2170
2176
  class Renderer extends modernIdoc.Reactivable {
@@ -2208,10 +2214,10 @@ class Renderer extends modernIdoc.Reactivable {
2208
2214
  super.destroy();
2209
2215
  }
2210
2216
  }
2211
- __decorateClass$_([
2217
+ __decorateClass$U([
2212
2218
  modernIdoc.property({ fallback: DEVICE_PIXEL_RATIO })
2213
2219
  ], Renderer.prototype, "pixelRatio");
2214
- __decorateClass$_([
2220
+ __decorateClass$U([
2215
2221
  modernIdoc.property({ internal: true })
2216
2222
  ], Renderer.prototype, "view");
2217
2223
 
@@ -2443,6 +2449,8 @@ class WebGLBatch2DModule extends WebGLModule {
2443
2449
  // 1
2444
2450
  aPosition: { size: 2, normalized: false, type: "float" },
2445
2451
  // 2
2452
+ aDimension: { size: 2, normalized: false, type: "float" },
2453
+ // 2
2446
2454
  aUv: { size: 2, normalized: false, type: "float" },
2447
2455
  // 2
2448
2456
  aModulate: { size: 4, normalized: true, type: "unsigned_byte" },
@@ -2452,7 +2460,7 @@ class WebGLBatch2DModule extends WebGLModule {
2452
2460
  aDisableWrapMode: { size: 1, normalized: true, type: "float" }
2453
2461
  // 1
2454
2462
  };
2455
- _vertexSize = 1 + 2 + 2 + 1 + 1 + 1;
2463
+ _vertexSize = 1 + 2 + 2 + 2 + 1 + 1 + 1;
2456
2464
  _getShader(maxTextureUnits) {
2457
2465
  let shader = this._shaders.get(maxTextureUnits);
2458
2466
  if (!shader) {
@@ -2466,6 +2474,7 @@ class WebGLBatch2DModule extends WebGLModule {
2466
2474
  vert: `precision highp float;
2467
2475
  attribute float aTextureId;
2468
2476
  attribute vec2 aPosition;
2477
+ attribute vec2 aDimension;
2469
2478
  attribute vec2 aUv;
2470
2479
  attribute vec4 aModulate;
2471
2480
  attribute vec4 aBackgroundColor;
@@ -2474,30 +2483,20 @@ attribute float aDisableWrapMode;
2474
2483
  uniform mat3 projectionMatrix;
2475
2484
  uniform mat3 viewMatrix;
2476
2485
  uniform vec4 modulate;
2477
- uniform float canvasWidth;
2478
- uniform float canvasHeight;
2479
2486
 
2480
2487
  varying float vTextureId;
2488
+ varying vec2 vDimension;
2481
2489
  varying vec2 vUv;
2482
2490
  varying vec4 vModulate;
2483
2491
  varying vec4 vBackgroundColor;
2484
2492
  varying float vDisableWrapMode;
2485
2493
 
2486
- vec2 roundPixels(vec2 position, vec2 targetSize) {
2487
- return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
2488
- }
2489
-
2490
2494
  void main(void) {
2491
- mat3 modelMatrix = mat3(
2492
- 1.0, 0.0, 0.0,
2493
- 0.0, 1.0, 0.0,
2494
- 0.0, 0.0, 1.0
2495
- );
2496
- vTextureId = aTextureId;
2497
- vec3 pos = projectionMatrix * viewMatrix * modelMatrix * vec3(aPosition, 1.0);
2498
- gl_Position = vec4(roundPixels(pos.xy, vec2(canvasWidth, canvasHeight)), 0.0, 1.0);
2499
- // gl_Position = vec4(pos.xy, 0.0, 1.0);
2495
+ vec3 pos3 = projectionMatrix * viewMatrix * vec3(aPosition.xy, 1.0);
2496
+ gl_Position = vec4(pos3.xy, 0.0, 1.0);
2500
2497
 
2498
+ vTextureId = aTextureId;
2499
+ vDimension = aDimension;
2501
2500
  vUv = aUv;
2502
2501
  vModulate = aModulate * modulate;
2503
2502
  vBackgroundColor = aBackgroundColor;
@@ -2505,16 +2504,27 @@ void main(void) {
2505
2504
  }`,
2506
2505
  frag: `precision highp float;
2507
2506
  varying float vTextureId;
2507
+ varying vec2 vDimension;
2508
2508
  varying vec2 vUv;
2509
2509
  varying vec4 vModulate;
2510
2510
  varying vec4 vBackgroundColor;
2511
2511
  varying float vDisableWrapMode;
2512
2512
 
2513
+ uniform mat3 viewMatrix;
2513
2514
  uniform sampler2D samplers[${maxTextureUnits}];
2515
+ uniform vec2 zoom;
2516
+ uniform vec2 translate;
2514
2517
 
2515
2518
  void main(void) {
2519
+ vec2 uv = vUv;
2520
+
2521
+ if (vDimension.x > 0.0 && vDimension.y > 0.0) {
2522
+ uv = floor(uv * vDimension);
2523
+ uv = uv / vDimension;
2524
+ }
2525
+
2516
2526
  vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
2517
- if (vDisableWrapMode > 0.0 && (vUv.x < 0.0 || vUv.y < 0.0 || vUv.x > 1.0 || vUv.y > 1.0))
2527
+ if (vDisableWrapMode > 0.0 && (uv.x < 0.0 || uv.y < 0.0 || uv.x > 1.0 || uv.y > 1.0))
2518
2528
  {
2519
2529
  //
2520
2530
  }
@@ -2533,7 +2543,7 @@ void main(void) {
2533
2543
  }
2534
2544
  return `${text}
2535
2545
  {
2536
- color = texture2D(samplers[${i}], vUv);
2546
+ color = texture2D(samplers[${i}], uv);
2537
2547
  }`;
2538
2548
  }).join("")}
2539
2549
 
@@ -2579,11 +2589,12 @@ void main(void) {
2579
2589
  draw: (options) => {
2580
2590
  const renderer2 = this._renderer;
2581
2591
  renderer2.program.bind(program);
2592
+ const viewMatrix = renderer2.program.uniforms.viewMatrix;
2582
2593
  renderer2.program.updateUniforms(program, {
2583
2594
  samplers,
2584
2595
  modulate: [1, 1, 1, 1],
2585
- canvasWidth: renderer2.gl.drawingBufferWidth,
2586
- canvasHeight: renderer2.gl.drawingBufferHeight,
2596
+ zoom: [viewMatrix[0], viewMatrix[4]],
2597
+ translate: [viewMatrix[6], viewMatrix[7]],
2587
2598
  ...renderer2.program.uniforms
2588
2599
  });
2589
2600
  renderer2.vertexArray.bind(vao ?? vertexArray);
@@ -2640,7 +2651,8 @@ void main(void) {
2640
2651
  const {
2641
2652
  indices,
2642
2653
  vertices,
2643
- uvs = [],
2654
+ uvs = new Float32Array(0),
2655
+ dimension = new Float32Array(0),
2644
2656
  texture: texture2,
2645
2657
  modulate = this._defaultModulate,
2646
2658
  backgroundColor = this._defaultBackgroundColor,
@@ -2662,6 +2674,8 @@ void main(void) {
2662
2674
  float32View[aIndex++] = textureLocation;
2663
2675
  float32View[aIndex++] = vertices[i2];
2664
2676
  float32View[aIndex++] = vertices[i2 + 1];
2677
+ float32View[aIndex++] = dimension[0];
2678
+ float32View[aIndex++] = dimension[1];
2665
2679
  float32View[aIndex++] = uvs[i2];
2666
2680
  float32View[aIndex++] = uvs[i2 + 1];
2667
2681
  if (modulate) {
@@ -2719,11 +2733,6 @@ void main(void) {
2719
2733
  });
2720
2734
  }
2721
2735
  }
2722
- /**
2723
- * Fetches an attribute buffer from `this._attributeBuffer` that can hold atleast `size` floats.
2724
- * @param size - minimum capacity required
2725
- * @returns - buffer than can hold atleast `size` floats
2726
- */
2727
2736
  _getAttributeBuffer(size) {
2728
2737
  const roundedP2 = nextPow2(Math.ceil(size / 8));
2729
2738
  const roundedSizeIndex = log2(roundedP2);
@@ -2737,12 +2746,6 @@ void main(void) {
2737
2746
  }
2738
2747
  return buffer;
2739
2748
  }
2740
- /**
2741
- * Fetches an index buffer from `this._indexBuffers` that can
2742
- * have at least `size` capacity.
2743
- * @param size - minimum required capacity
2744
- * @returns - buffer that can fit `size` indices.
2745
- */
2746
2749
  _getIndexBuffer(size) {
2747
2750
  const roundedP2 = nextPow2(Math.ceil(size / 12));
2748
2751
  const roundedSizeIndex = log2(roundedP2);
@@ -4411,13 +4414,13 @@ class Geometry extends Resource {
4411
4414
  }
4412
4415
  }
4413
4416
 
4414
- var __defProp$R = Object.defineProperty;
4415
- var __decorateClass$Z = (decorators, target, key, kind) => {
4417
+ var __defProp$P = Object.defineProperty;
4418
+ var __decorateClass$T = (decorators, target, key, kind) => {
4416
4419
  var result = void 0 ;
4417
4420
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4418
4421
  if (decorator = decorators[i])
4419
4422
  result = (decorator(target, key, result) ) || result;
4420
- if (result) __defProp$R(target, key, result);
4423
+ if (result) __defProp$P(target, key, result);
4421
4424
  return result;
4422
4425
  };
4423
4426
  class IndexBuffer extends Resource {
@@ -4461,20 +4464,20 @@ class IndexBuffer extends Resource {
4461
4464
  return result;
4462
4465
  }
4463
4466
  }
4464
- __decorateClass$Z([
4467
+ __decorateClass$T([
4465
4468
  modernIdoc.property({ internal: true, fallback: null })
4466
4469
  ], IndexBuffer.prototype, "data");
4467
- __decorateClass$Z([
4470
+ __decorateClass$T([
4468
4471
  modernIdoc.property({ internal: true, fallback: false })
4469
4472
  ], IndexBuffer.prototype, "dynamic");
4470
4473
 
4471
- var __defProp$Q = Object.defineProperty;
4472
- var __decorateClass$Y = (decorators, target, key, kind) => {
4474
+ var __defProp$O = Object.defineProperty;
4475
+ var __decorateClass$S = (decorators, target, key, kind) => {
4473
4476
  var result = void 0 ;
4474
4477
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4475
4478
  if (decorator = decorators[i])
4476
4479
  result = (decorator(target, key, result) ) || result;
4477
- if (result) __defProp$Q(target, key, result);
4480
+ if (result) __defProp$O(target, key, result);
4478
4481
  return result;
4479
4482
  };
4480
4483
  class VertexBuffer extends Resource {
@@ -4518,20 +4521,20 @@ class VertexBuffer extends Resource {
4518
4521
  return result;
4519
4522
  }
4520
4523
  }
4521
- __decorateClass$Y([
4524
+ __decorateClass$S([
4522
4525
  modernIdoc.property({ internal: true, default: null })
4523
4526
  ], VertexBuffer.prototype, "data");
4524
- __decorateClass$Y([
4527
+ __decorateClass$S([
4525
4528
  modernIdoc.property({ internal: true, fallback: false })
4526
4529
  ], VertexBuffer.prototype, "dynamic");
4527
4530
 
4528
- var __defProp$P = Object.defineProperty;
4529
- var __decorateClass$X = (decorators, target, key, kind) => {
4531
+ var __defProp$N = Object.defineProperty;
4532
+ var __decorateClass$R = (decorators, target, key, kind) => {
4530
4533
  var result = void 0 ;
4531
4534
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4532
4535
  if (decorator = decorators[i])
4533
4536
  result = (decorator(target, key, result) ) || result;
4534
- if (result) __defProp$P(target, key, result);
4537
+ if (result) __defProp$N(target, key, result);
4535
4538
  return result;
4536
4539
  };
4537
4540
  class VertexAttribute extends Resource {
@@ -4565,25 +4568,25 @@ class VertexAttribute extends Resource {
4565
4568
  return result;
4566
4569
  }
4567
4570
  }
4568
- __decorateClass$X([
4571
+ __decorateClass$R([
4569
4572
  modernIdoc.property({ internal: true })
4570
4573
  ], VertexAttribute.prototype, "buffer");
4571
- __decorateClass$X([
4574
+ __decorateClass$R([
4572
4575
  modernIdoc.property({ fallback: 0 })
4573
4576
  ], VertexAttribute.prototype, "size");
4574
- __decorateClass$X([
4577
+ __decorateClass$R([
4575
4578
  modernIdoc.property({ fallback: false })
4576
4579
  ], VertexAttribute.prototype, "normalized");
4577
- __decorateClass$X([
4580
+ __decorateClass$R([
4578
4581
  modernIdoc.property({ fallback: "float" })
4579
4582
  ], VertexAttribute.prototype, "type");
4580
- __decorateClass$X([
4583
+ __decorateClass$R([
4581
4584
  modernIdoc.property()
4582
4585
  ], VertexAttribute.prototype, "stride");
4583
- __decorateClass$X([
4586
+ __decorateClass$R([
4584
4587
  modernIdoc.property()
4585
4588
  ], VertexAttribute.prototype, "offset");
4586
- __decorateClass$X([
4589
+ __decorateClass$R([
4587
4590
  modernIdoc.property()
4588
4591
  ], VertexAttribute.prototype, "divisor");
4589
4592
 
@@ -4827,13 +4830,13 @@ class UvGeometry extends Geometry {
4827
4830
  }
4828
4831
  }
4829
4832
 
4830
- var __defProp$O = Object.defineProperty;
4831
- var __decorateClass$W = (decorators, target, key, kind) => {
4833
+ var __defProp$M = Object.defineProperty;
4834
+ var __decorateClass$Q = (decorators, target, key, kind) => {
4832
4835
  var result = void 0 ;
4833
4836
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4834
4837
  if (decorator = decorators[i])
4835
4838
  result = (decorator(target, key, result) ) || result;
4836
- if (result) __defProp$O(target, key, result);
4839
+ if (result) __defProp$M(target, key, result);
4837
4840
  return result;
4838
4841
  };
4839
4842
  class Texture2D extends Resource {
@@ -4961,22 +4964,22 @@ class Texture2D extends Resource {
4961
4964
  }
4962
4965
  }
4963
4966
  }
4964
- __decorateClass$W([
4967
+ __decorateClass$Q([
4965
4968
  modernIdoc.property({ internal: true })
4966
4969
  ], Texture2D.prototype, "source");
4967
- __decorateClass$W([
4970
+ __decorateClass$Q([
4968
4971
  modernIdoc.property({ fallback: 0 })
4969
4972
  ], Texture2D.prototype, "width");
4970
- __decorateClass$W([
4973
+ __decorateClass$Q([
4971
4974
  modernIdoc.property({ fallback: 0 })
4972
4975
  ], Texture2D.prototype, "height");
4973
- __decorateClass$W([
4976
+ __decorateClass$Q([
4974
4977
  modernIdoc.property({ fallback: "linear" })
4975
4978
  ], Texture2D.prototype, "filterMode");
4976
- __decorateClass$W([
4979
+ __decorateClass$Q([
4977
4980
  modernIdoc.property({ fallback: "clamp_to_edge" })
4978
4981
  ], Texture2D.prototype, "wrapMode");
4979
- __decorateClass$W([
4982
+ __decorateClass$Q([
4980
4983
  modernIdoc.property({ fallback: 1 })
4981
4984
  ], Texture2D.prototype, "pixelRatio");
4982
4985
 
@@ -5010,13 +5013,13 @@ class AnimatedTexture extends Resource {
5010
5013
  }
5011
5014
  }
5012
5015
 
5013
- var __defProp$N = Object.defineProperty;
5014
- var __decorateClass$V = (decorators, target, key, kind) => {
5016
+ var __defProp$L = Object.defineProperty;
5017
+ var __decorateClass$P = (decorators, target, key, kind) => {
5015
5018
  var result = void 0 ;
5016
5019
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5017
5020
  if (decorator = decorators[i])
5018
5021
  result = (decorator(target, key, result) ) || result;
5019
- if (result) __defProp$N(target, key, result);
5022
+ if (result) __defProp$L(target, key, result);
5020
5023
  return result;
5021
5024
  };
5022
5025
  class CanvasTexture extends Texture2D {
@@ -5035,7 +5038,7 @@ class CanvasTexture extends Texture2D {
5035
5038
  super._updateProperty(key, value, oldValue);
5036
5039
  }
5037
5040
  }
5038
- __decorateClass$V([
5041
+ __decorateClass$P([
5039
5042
  modernIdoc.property({ fallback: 2 })
5040
5043
  ], CanvasTexture.prototype, "pixelRatio");
5041
5044
 
@@ -5257,13 +5260,13 @@ class PixelsTexture extends Texture2D {
5257
5260
  }
5258
5261
  }
5259
5262
 
5260
- var __defProp$M = Object.defineProperty;
5261
- var __decorateClass$U = (decorators, target, key, kind) => {
5263
+ var __defProp$K = Object.defineProperty;
5264
+ var __decorateClass$O = (decorators, target, key, kind) => {
5262
5265
  var result = void 0 ;
5263
5266
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5264
5267
  if (decorator = decorators[i])
5265
5268
  result = (decorator(target, key, result) ) || result;
5266
- if (result) __defProp$M(target, key, result);
5269
+ if (result) __defProp$K(target, key, result);
5267
5270
  return result;
5268
5271
  };
5269
5272
  function resolveOptions(options) {
@@ -5507,10 +5510,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5507
5510
  }
5508
5511
  }
5509
5512
  };
5510
- __decorateClass$U([
5513
+ __decorateClass$O([
5511
5514
  modernIdoc.property({ internal: true, fallback: true })
5512
5515
  ], _VideoTexture.prototype, "autoUpdate");
5513
- __decorateClass$U([
5516
+ __decorateClass$O([
5514
5517
  modernIdoc.property({ internal: true, fallback: 0 })
5515
5518
  ], _VideoTexture.prototype, "fps");
5516
5519
  let VideoTexture = _VideoTexture;
@@ -5645,7 +5648,6 @@ class CanvasContext extends modernPath2d.Path2D {
5645
5648
  }
5646
5649
  buildUvs(start, vertices, uvs, texture, uvTransform) {
5647
5650
  if (texture) {
5648
- const _uvTransform = uvTransform ? typeof uvTransform === "function" ? uvTransform : (x, y) => uvTransform.apply({ x, y }).toArray() : uvTransform;
5649
5651
  const w = texture.width;
5650
5652
  const h = texture.height;
5651
5653
  for (let len = vertices.length, i = start; i < len; i += 2) {
@@ -5653,8 +5655,8 @@ class CanvasContext extends modernPath2d.Path2D {
5653
5655
  const y = vertices[i + 1];
5654
5656
  let uvX;
5655
5657
  let uvY;
5656
- if (_uvTransform) {
5657
- [uvX, uvY] = _uvTransform(x, y);
5658
+ if (uvTransform) {
5659
+ [uvX, uvY] = uvTransform.apply({ x, y }).toArray();
5658
5660
  } else {
5659
5661
  [uvX, uvY] = [x / w, y / h];
5660
5662
  }
@@ -5690,6 +5692,7 @@ class CanvasContext extends modernPath2d.Path2D {
5690
5692
  if (current.texture) {
5691
5693
  this.buildUvs(0, vertices, uvs, current.texture, current.uvTransform);
5692
5694
  }
5695
+ const box = current.path.getBoundingBox();
5693
5696
  batchables.push({
5694
5697
  vertices: new Float32Array(vertices),
5695
5698
  indices: new Float32Array(indices),
@@ -5698,7 +5701,9 @@ class CanvasContext extends modernPath2d.Path2D {
5698
5701
  backgroundColor: current.backgroundColor,
5699
5702
  type: current.type,
5700
5703
  disableWrapMode: current.disableWrapMode,
5701
- vertTransform: current.vertTransform
5704
+ uvTransform: current.uvTransform,
5705
+ vertTransform: current.vertTransform,
5706
+ dimension: new Float32Array([box.width, box.height])
5702
5707
  });
5703
5708
  }
5704
5709
  return batchables;
@@ -5800,14 +5805,14 @@ class Meta extends CoreObject {
5800
5805
  }
5801
5806
  }
5802
5807
 
5803
- var __defProp$L = Object.defineProperty;
5804
- var __getOwnPropDesc$J = Object.getOwnPropertyDescriptor;
5805
- var __decorateClass$T = (decorators, target, key, kind) => {
5806
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$J(target, key) : target;
5808
+ var __defProp$J = Object.defineProperty;
5809
+ var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
5810
+ var __decorateClass$N = (decorators, target, key, kind) => {
5811
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
5807
5812
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5808
5813
  if (decorator = decorators[i])
5809
5814
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5810
- if (kind && result) __defProp$L(target, key, result);
5815
+ if (kind && result) __defProp$J(target, key, result);
5811
5816
  return result;
5812
5817
  };
5813
5818
  const iidMap = {};
@@ -6321,42 +6326,42 @@ exports.Node = class Node extends CoreObject {
6321
6326
  return node;
6322
6327
  }
6323
6328
  };
6324
- __decorateClass$T([
6329
+ __decorateClass$N([
6325
6330
  modernIdoc.property({ fallback: modernIdoc.idGenerator() })
6326
6331
  ], exports.Node.prototype, "id", 2);
6327
- __decorateClass$T([
6332
+ __decorateClass$N([
6328
6333
  modernIdoc.property({ fallback: modernIdoc.idGenerator() })
6329
6334
  ], exports.Node.prototype, "name", 2);
6330
- __decorateClass$T([
6335
+ __decorateClass$N([
6331
6336
  modernIdoc.property({ internal: true, fallback: "inherit" })
6332
6337
  ], exports.Node.prototype, "processMode", 2);
6333
- __decorateClass$T([
6338
+ __decorateClass$N([
6334
6339
  modernIdoc.property({ internal: true, fallback: "default" })
6335
6340
  ], exports.Node.prototype, "processSortMode", 2);
6336
- __decorateClass$T([
6341
+ __decorateClass$N([
6337
6342
  modernIdoc.property({ internal: true, fallback: "inherit" })
6338
6343
  ], exports.Node.prototype, "renderMode", 2);
6339
- __decorateClass$T([
6344
+ __decorateClass$N([
6340
6345
  modernIdoc.property({ internal: true, fallback: "inherit" })
6341
6346
  ], exports.Node.prototype, "inputMode", 2);
6342
- __decorateClass$T([
6347
+ __decorateClass$N([
6343
6348
  modernIdoc.property({ internal: true, fallback: "default" })
6344
6349
  ], exports.Node.prototype, "internalMode", 2);
6345
- __decorateClass$T([
6350
+ __decorateClass$N([
6346
6351
  modernIdoc.property({ internal: true })
6347
6352
  ], exports.Node.prototype, "mask", 2);
6348
- exports.Node = __decorateClass$T([
6353
+ exports.Node = __decorateClass$N([
6349
6354
  customNode("Node")
6350
6355
  ], exports.Node);
6351
6356
 
6352
- var __defProp$K = Object.defineProperty;
6353
- var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
6354
- var __decorateClass$S = (decorators, target, key, kind) => {
6355
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$I(target, key) : target;
6357
+ var __defProp$I = Object.defineProperty;
6358
+ var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
6359
+ var __decorateClass$M = (decorators, target, key, kind) => {
6360
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
6356
6361
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6357
6362
  if (decorator = decorators[i])
6358
6363
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6359
- if (kind && result) __defProp$K(target, key, result);
6364
+ if (kind && result) __defProp$I(target, key, result);
6360
6365
  return result;
6361
6366
  };
6362
6367
  exports.TimelineNode = class TimelineNode extends exports.Node {
@@ -6416,30 +6421,30 @@ exports.TimelineNode = class TimelineNode extends exports.Node {
6416
6421
  this._updateCurrentTime();
6417
6422
  }
6418
6423
  };
6419
- __decorateClass$S([
6424
+ __decorateClass$M([
6420
6425
  modernIdoc.property({ fallback: 0 })
6421
6426
  ], exports.TimelineNode.prototype, "delay", 2);
6422
- __decorateClass$S([
6427
+ __decorateClass$M([
6423
6428
  modernIdoc.property({ fallback: 0 })
6424
6429
  ], exports.TimelineNode.prototype, "duration", 2);
6425
- __decorateClass$S([
6430
+ __decorateClass$M([
6426
6431
  modernIdoc.property({ fallback: false })
6427
6432
  ], exports.TimelineNode.prototype, "paused", 2);
6428
- __decorateClass$S([
6433
+ __decorateClass$M([
6429
6434
  modernIdoc.property({ internal: true, fallback: false })
6430
6435
  ], exports.TimelineNode.prototype, "insideTimeRange", 2);
6431
- exports.TimelineNode = __decorateClass$S([
6436
+ exports.TimelineNode = __decorateClass$M([
6432
6437
  customNode("TimelineNode")
6433
6438
  ], exports.TimelineNode);
6434
6439
 
6435
- var __defProp$J = Object.defineProperty;
6436
- var __getOwnPropDesc$H = Object.getOwnPropertyDescriptor;
6437
- var __decorateClass$R = (decorators, target, key, kind) => {
6438
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$H(target, key) : target;
6440
+ var __defProp$H = Object.defineProperty;
6441
+ var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
6442
+ var __decorateClass$L = (decorators, target, key, kind) => {
6443
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
6439
6444
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6440
6445
  if (decorator = decorators[i])
6441
6446
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6442
- if (kind && result) __defProp$J(target, key, result);
6447
+ if (kind && result) __defProp$H(target, key, result);
6443
6448
  return result;
6444
6449
  };
6445
6450
  exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
@@ -6592,30 +6597,30 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
6592
6597
  super._render(renderer);
6593
6598
  }
6594
6599
  };
6595
- __decorateClass$R([
6600
+ __decorateClass$L([
6596
6601
  modernIdoc.property()
6597
6602
  ], exports.CanvasItem.prototype, "modulate", 2);
6598
- __decorateClass$R([
6603
+ __decorateClass$L([
6599
6604
  modernIdoc.property()
6600
6605
  ], exports.CanvasItem.prototype, "blendMode", 2);
6601
- __decorateClass$R([
6606
+ __decorateClass$L([
6602
6607
  modernIdoc.property({ internal: true, fallback: true })
6603
6608
  ], exports.CanvasItem.prototype, "visible", 2);
6604
- __decorateClass$R([
6609
+ __decorateClass$L([
6605
6610
  modernIdoc.property({ internal: true, fallback: 1 })
6606
6611
  ], exports.CanvasItem.prototype, "opacity", 2);
6607
- exports.CanvasItem = __decorateClass$R([
6612
+ exports.CanvasItem = __decorateClass$L([
6608
6613
  customNode("CanvasItem")
6609
6614
  ], exports.CanvasItem);
6610
6615
 
6611
- var __defProp$I = Object.defineProperty;
6612
- var __getOwnPropDesc$G = Object.getOwnPropertyDescriptor;
6613
- var __decorateClass$Q = (decorators, target, key, kind) => {
6614
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$G(target, key) : target;
6616
+ var __defProp$G = Object.defineProperty;
6617
+ var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
6618
+ var __decorateClass$K = (decorators, target, key, kind) => {
6619
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
6615
6620
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6616
6621
  if (decorator = decorators[i])
6617
6622
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6618
- if (kind && result) __defProp$I(target, key, result);
6623
+ if (kind && result) __defProp$G(target, key, result);
6619
6624
  return result;
6620
6625
  };
6621
6626
  exports.Viewport = class Viewport extends exports.Node {
@@ -6766,33 +6771,33 @@ exports.Viewport = class Viewport extends exports.Node {
6766
6771
  return this.canvasTransform.apply(globalPos, newPos);
6767
6772
  }
6768
6773
  };
6769
- __decorateClass$Q([
6774
+ __decorateClass$K([
6770
6775
  modernIdoc.property({ fallback: 0 })
6771
6776
  ], exports.Viewport.prototype, "x", 2);
6772
- __decorateClass$Q([
6777
+ __decorateClass$K([
6773
6778
  modernIdoc.property({ fallback: 0 })
6774
6779
  ], exports.Viewport.prototype, "y", 2);
6775
- __decorateClass$Q([
6780
+ __decorateClass$K([
6776
6781
  modernIdoc.property({ fallback: 0 })
6777
6782
  ], exports.Viewport.prototype, "width", 2);
6778
- __decorateClass$Q([
6783
+ __decorateClass$K([
6779
6784
  modernIdoc.property({ fallback: 0 })
6780
6785
  ], exports.Viewport.prototype, "height", 2);
6781
- __decorateClass$Q([
6786
+ __decorateClass$K([
6782
6787
  modernIdoc.property({ internal: true, fallback: false })
6783
6788
  ], exports.Viewport.prototype, "msaa", 2);
6784
- exports.Viewport = __decorateClass$Q([
6789
+ exports.Viewport = __decorateClass$K([
6785
6790
  customNode("Viewport")
6786
6791
  ], exports.Viewport);
6787
6792
 
6788
- var __defProp$H = Object.defineProperty;
6789
- var __getOwnPropDesc$F = Object.getOwnPropertyDescriptor;
6790
- var __decorateClass$P = (decorators, target, key, kind) => {
6791
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$F(target, key) : target;
6793
+ var __defProp$F = Object.defineProperty;
6794
+ var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
6795
+ var __decorateClass$J = (decorators, target, key, kind) => {
6796
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
6792
6797
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6793
6798
  if (decorator = decorators[i])
6794
6799
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6795
- if (kind && result) __defProp$H(target, key, result);
6800
+ if (kind && result) __defProp$F(target, key, result);
6796
6801
  return result;
6797
6802
  };
6798
6803
  exports.Effect = class Effect extends exports.TimelineNode {
@@ -7034,19 +7039,19 @@ exports.Effect = class Effect extends exports.TimelineNode {
7034
7039
  }
7035
7040
  }
7036
7041
  };
7037
- __decorateClass$P([
7042
+ __decorateClass$J([
7038
7043
  modernIdoc.property({ internal: true })
7039
7044
  ], exports.Effect.prototype, "material", 2);
7040
- __decorateClass$P([
7045
+ __decorateClass$J([
7041
7046
  modernIdoc.property()
7042
7047
  ], exports.Effect.prototype, "effectMode", 2);
7043
- __decorateClass$P([
7044
- modernIdoc.property({ fallback: "" })
7048
+ __decorateClass$J([
7049
+ modernIdoc.property()
7045
7050
  ], exports.Effect.prototype, "glsl", 2);
7046
- __decorateClass$P([
7047
- modernIdoc.property({ fallback: "" })
7051
+ __decorateClass$J([
7052
+ modernIdoc.property()
7048
7053
  ], exports.Effect.prototype, "glslSrc", 2);
7049
- exports.Effect = __decorateClass$P([
7054
+ exports.Effect = __decorateClass$J([
7050
7055
  customNode("Effect")
7051
7056
  ], exports.Effect);
7052
7057
 
@@ -7076,14 +7081,14 @@ class RenderStack {
7076
7081
  }
7077
7082
  }
7078
7083
 
7079
- var __defProp$G = Object.defineProperty;
7080
- var __getOwnPropDesc$E = Object.getOwnPropertyDescriptor;
7081
- var __decorateClass$O = (decorators, target, key, kind) => {
7082
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$E(target, key) : target;
7084
+ var __defProp$E = Object.defineProperty;
7085
+ var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
7086
+ var __decorateClass$I = (decorators, target, key, kind) => {
7087
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
7083
7088
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7084
7089
  if (decorator = decorators[i])
7085
7090
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7086
- if (kind && result) __defProp$G(target, key, result);
7091
+ if (kind && result) __defProp$E(target, key, result);
7087
7092
  return result;
7088
7093
  };
7089
7094
  exports.Timeline = class Timeline extends exports.Node {
@@ -7128,48 +7133,48 @@ exports.Timeline = class Timeline extends exports.Node {
7128
7133
  this.addTime(delta);
7129
7134
  }
7130
7135
  };
7131
- __decorateClass$O([
7136
+ __decorateClass$I([
7132
7137
  modernIdoc.property({ fallback: 0 })
7133
7138
  ], exports.Timeline.prototype, "startTime", 2);
7134
- __decorateClass$O([
7139
+ __decorateClass$I([
7135
7140
  modernIdoc.property({ fallback: 0 })
7136
7141
  ], exports.Timeline.prototype, "currentTime", 2);
7137
- __decorateClass$O([
7142
+ __decorateClass$I([
7138
7143
  modernIdoc.property({ fallback: Number.MAX_SAFE_INTEGER })
7139
7144
  ], exports.Timeline.prototype, "endTime", 2);
7140
- __decorateClass$O([
7145
+ __decorateClass$I([
7141
7146
  modernIdoc.property({ fallback: false })
7142
7147
  ], exports.Timeline.prototype, "loop", 2);
7143
- exports.Timeline = __decorateClass$O([
7148
+ exports.Timeline = __decorateClass$I([
7144
7149
  customNode("Timeline")
7145
7150
  ], exports.Timeline);
7146
7151
 
7147
- var __defProp$F = Object.defineProperty;
7148
- var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
7149
- var __decorateClass$N = (decorators, target, key, kind) => {
7150
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
7152
+ var __defProp$D = Object.defineProperty;
7153
+ var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
7154
+ var __decorateClass$H = (decorators, target, key, kind) => {
7155
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
7151
7156
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7152
7157
  if (decorator = decorators[i])
7153
7158
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7154
- if (kind && result) __defProp$F(target, key, result);
7159
+ if (kind && result) __defProp$D(target, key, result);
7155
7160
  return result;
7156
7161
  };
7157
7162
  exports.Window = class Window extends exports.Viewport {
7158
7163
  };
7159
- __decorateClass$N([
7164
+ __decorateClass$H([
7160
7165
  modernIdoc.property({ fallback: false })
7161
7166
  ], exports.Window.prototype, "msaa", 2);
7162
- exports.Window = __decorateClass$N([
7167
+ exports.Window = __decorateClass$H([
7163
7168
  customNode("Window")
7164
7169
  ], exports.Window);
7165
7170
 
7166
- var __defProp$E = Object.defineProperty;
7167
- var __decorateClass$M = (decorators, target, key, kind) => {
7171
+ var __defProp$C = Object.defineProperty;
7172
+ var __decorateClass$G = (decorators, target, key, kind) => {
7168
7173
  var result = void 0 ;
7169
7174
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7170
7175
  if (decorator = decorators[i])
7171
7176
  result = (decorator(target, key, result) ) || result;
7172
- if (result) __defProp$E(target, key, result);
7177
+ if (result) __defProp$C(target, key, result);
7173
7178
  return result;
7174
7179
  };
7175
7180
  class SceneTree extends MainLoop {
@@ -7249,25 +7254,25 @@ class SceneTree extends MainLoop {
7249
7254
  super.destroy();
7250
7255
  }
7251
7256
  }
7252
- __decorateClass$M([
7257
+ __decorateClass$G([
7253
7258
  modernIdoc.property()
7254
7259
  ], SceneTree.prototype, "backgroundColor");
7255
- __decorateClass$M([
7260
+ __decorateClass$G([
7256
7261
  modernIdoc.property({ internal: true, fallback: false })
7257
7262
  ], SceneTree.prototype, "debug");
7258
- __decorateClass$M([
7263
+ __decorateClass$G([
7259
7264
  modernIdoc.property({ internal: true, fallback: false })
7260
7265
  ], SceneTree.prototype, "processPaused");
7261
- __decorateClass$M([
7266
+ __decorateClass$G([
7262
7267
  modernIdoc.property({ internal: true, default: () => modernFont.fonts })
7263
7268
  ], SceneTree.prototype, "fonts");
7264
- __decorateClass$M([
7269
+ __decorateClass$G([
7265
7270
  modernIdoc.property({ internal: true, default: () => new exports.Timeline() })
7266
7271
  ], SceneTree.prototype, "timeline");
7267
7272
 
7268
- var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
7269
- var __decorateClass$L = (decorators, target, key, kind) => {
7270
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
7273
+ var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
7274
+ var __decorateClass$F = (decorators, target, key, kind) => {
7275
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
7271
7276
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7272
7277
  if (decorator = decorators[i])
7273
7278
  result = (decorator(result)) || result;
@@ -7279,7 +7284,7 @@ exports.Transition = class Transition extends exports.Effect {
7279
7284
  this.setProperties(properties).append(children);
7280
7285
  }
7281
7286
  };
7282
- exports.Transition = __decorateClass$L([
7287
+ exports.Transition = __decorateClass$F([
7283
7288
  customNode("Transition", {
7284
7289
  effectMode: "transition",
7285
7290
  processMode: "pausable",
@@ -7287,14 +7292,14 @@ exports.Transition = __decorateClass$L([
7287
7292
  })
7288
7293
  ], exports.Transition);
7289
7294
 
7290
- var __defProp$D = Object.defineProperty;
7291
- var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
7292
- var __decorateClass$K = (decorators, target, key, kind) => {
7293
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
7295
+ var __defProp$B = Object.defineProperty;
7296
+ var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
7297
+ var __decorateClass$E = (decorators, target, key, kind) => {
7298
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
7294
7299
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7295
7300
  if (decorator = decorators[i])
7296
7301
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7297
- if (kind && result) __defProp$D(target, key, result);
7302
+ if (kind && result) __defProp$B(target, key, result);
7298
7303
  return result;
7299
7304
  };
7300
7305
  exports.Node2D = class Node2D extends exports.CanvasItem {
@@ -7358,9 +7363,7 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
7358
7363
  let a, c, tx, b, d, ty;
7359
7364
  if (vertTransform) {
7360
7365
  const globalTransform = this.globalTransform.clone();
7361
- globalTransform.multiply(
7362
- typeof vertTransform === "function" ? vertTransform?.() : vertTransform
7363
- );
7366
+ globalTransform.multiply(vertTransform);
7364
7367
  [a, c, tx, b, d, ty] = globalTransform.toArray();
7365
7368
  } else {
7366
7369
  [a, c, tx, b, d, ty] = this.globalTransform.toArray();
@@ -7398,46 +7401,81 @@ exports.Node2D = class Node2D extends exports.CanvasItem {
7398
7401
  return this.globalTransform.apply(localPos, newPos);
7399
7402
  }
7400
7403
  };
7401
- __decorateClass$K([
7404
+ __decorateClass$E([
7402
7405
  modernIdoc.property({ internal: true, fallback: 0 })
7403
7406
  ], exports.Node2D.prototype, "rotation", 2);
7404
- __decorateClass$K([
7407
+ __decorateClass$E([
7405
7408
  modernIdoc.property({ internal: true, fallback: 0 })
7406
7409
  ], exports.Node2D.prototype, "globalRotation", 2);
7407
- exports.Node2D = __decorateClass$K([
7410
+ exports.Node2D = __decorateClass$E([
7408
7411
  customNode("Node2D")
7409
7412
  ], exports.Node2D);
7410
7413
 
7411
- var __defProp$C = Object.defineProperty;
7412
- var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
7413
- var __decorateClass$J = (decorators, target, key, kind) => {
7414
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
7414
+ var __defProp$A = Object.defineProperty;
7415
+ var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
7416
+ var __decorateClass$D = (decorators, target, key, kind) => {
7417
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
7415
7418
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7416
7419
  if (decorator = decorators[i])
7417
7420
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7418
- if (kind && result) __defProp$C(target, key, result);
7421
+ if (kind && result) __defProp$A(target, key, result);
7419
7422
  return result;
7420
7423
  };
7421
7424
  exports.Camera2D = class Camera2D extends exports.Node2D {
7422
- zoom = new Vector2(1, 1).on("update", () => this.updateCanvasTransform());
7423
- maxZoom = new Vector2(6, 6);
7424
- minZoom = new Vector2(0.1, 0.1);
7425
7425
  _screenOffset = { x: 0, y: 0 };
7426
+ _zoom = new Vector2(1, 1).on("update", () => this.updateCanvasTransform());
7427
+ get zoom() {
7428
+ return this._zoom;
7429
+ }
7430
+ set zoom(val) {
7431
+ this._zoom.set(val.x, val.y);
7432
+ }
7433
+ _minZoom = new Vector2(0.02, 0.02);
7434
+ get minZoom() {
7435
+ return this._minZoom;
7436
+ }
7437
+ set minZoom(val) {
7438
+ this._minZoom.set(val.x, val.y);
7439
+ }
7440
+ _maxZoom = new Vector2(256, 256);
7441
+ get maxZoom() {
7442
+ return this._maxZoom;
7443
+ }
7444
+ set maxZoom(val) {
7445
+ this._maxZoom.set(val.x, val.y);
7446
+ }
7426
7447
  constructor(properties, nodes = []) {
7427
7448
  super();
7428
7449
  this.setProperties(properties).append(nodes);
7429
7450
  }
7451
+ setProperties(properties) {
7452
+ if (properties) {
7453
+ const {
7454
+ zoom,
7455
+ minZoom,
7456
+ maxZoom,
7457
+ ...restProperties
7458
+ } = properties;
7459
+ if (zoom)
7460
+ this.zoom = zoom;
7461
+ if (minZoom)
7462
+ this.minZoom = minZoom;
7463
+ if (maxZoom)
7464
+ this.maxZoom = maxZoom;
7465
+ super.setProperties(restProperties);
7466
+ }
7467
+ return this;
7468
+ }
7430
7469
  addZoom(x, y = x) {
7431
- this.zoom.set(
7432
- clamp(this.zoom.x + x, this.minZoom.x, this.maxZoom.x),
7433
- clamp(this.zoom.y + y, this.minZoom.y, this.maxZoom.y)
7470
+ return this.setZoom(
7471
+ this._zoom.x + x,
7472
+ this._zoom.y + y
7434
7473
  );
7435
- return this;
7436
7474
  }
7437
7475
  setZoom(x, y = x) {
7438
- this.zoom.set(
7439
- clamp(x, this.minZoom.x, this.maxZoom.x),
7440
- clamp(y, this.minZoom.y, this.maxZoom.y)
7476
+ this._zoom.set(
7477
+ clamp(x, this._minZoom.x, this._maxZoom.x),
7478
+ clamp(y, this._minZoom.y, this._maxZoom.y)
7441
7479
  );
7442
7480
  return this;
7443
7481
  }
@@ -7491,9 +7529,9 @@ exports.Camera2D = class Camera2D extends exports.Node2D {
7491
7529
  const isTouchPad = e.wheelDeltaY ? Math.abs(Math.abs(e.wheelDeltaY) - Math.abs(3 * e.deltaY)) < 3 : e.deltaMode === 0;
7492
7530
  if (!isTouchPad) {
7493
7531
  e.preventDefault();
7494
- const oldZoom = this.zoom.x;
7495
- this.addZoom(e.deltaY * -0.015);
7496
- const ratio = 1 - this.zoom.x / oldZoom;
7532
+ const oldZoom = this._zoom.x;
7533
+ this.zoomWithWheel(e.deltaY);
7534
+ const ratio = 1 - this._zoom.x / oldZoom;
7497
7535
  this.position.add(
7498
7536
  (e.screenX - this.position.x) * ratio,
7499
7537
  (e.screenY - this.position.y) * ratio
@@ -7504,6 +7542,12 @@ exports.Camera2D = class Camera2D extends exports.Node2D {
7504
7542
  this.position.add(-e.deltaX, -e.deltaY);
7505
7543
  }
7506
7544
  }
7545
+ zoomWithWheel(wheelDeltaY) {
7546
+ const logCur = Math.log(this._zoom.x);
7547
+ const logDelta = -wheelDeltaY * this.wheelSensitivity;
7548
+ const logNew = logCur + logDelta;
7549
+ this.setZoom(Math.exp(logNew));
7550
+ }
7507
7551
  updateTransform() {
7508
7552
  super.updateTransform();
7509
7553
  this.updateCanvasTransform();
@@ -7512,7 +7556,7 @@ exports.Camera2D = class Camera2D extends exports.Node2D {
7512
7556
  const viewport = this.getViewport();
7513
7557
  if (!viewport)
7514
7558
  return;
7515
- viewport.canvasTransform.identity().scale(this.zoom.x, this.zoom.y).translate(this.position.x, this.position.y);
7559
+ viewport.canvasTransform.identity().scale(this._zoom.x, this._zoom.y).translate(this.position.x, this.position.y);
7516
7560
  this.emit("updateCanvasTransform");
7517
7561
  }
7518
7562
  toGlobal(screenPos, newPos) {
@@ -7527,14 +7571,25 @@ exports.Camera2D = class Camera2D extends exports.Node2D {
7527
7571
  throw new Error("Failed to toScreen, viewport is empty");
7528
7572
  return viewport.toCanvasScreen(globalPos, newPos);
7529
7573
  }
7530
- };
7531
- __decorateClass$J([
7574
+ toJSON() {
7575
+ return {
7576
+ zoom: this._zoom.toJSON(),
7577
+ minZoom: this._minZoom.toJSON(),
7578
+ maxZoom: this._maxZoom.toJSON(),
7579
+ ...super.toJSON()
7580
+ };
7581
+ }
7582
+ };
7583
+ __decorateClass$D([
7584
+ modernIdoc.property({ fallback: 0.02 })
7585
+ ], exports.Camera2D.prototype, "wheelSensitivity", 2);
7586
+ __decorateClass$D([
7532
7587
  modernIdoc.property({ internal: true, fallback: false })
7533
7588
  ], exports.Camera2D.prototype, "spaceKey", 2);
7534
- __decorateClass$J([
7589
+ __decorateClass$D([
7535
7590
  modernIdoc.property({ internal: true, fallback: false })
7536
7591
  ], exports.Camera2D.prototype, "grabbing", 2);
7537
- exports.Camera2D = __decorateClass$J([
7592
+ exports.Camera2D = __decorateClass$D([
7538
7593
  customNode("Camera2D", {
7539
7594
  processMode: "disabled",
7540
7595
  renderMode: "disabled"
@@ -7687,18 +7742,18 @@ function parseCSSTransformOrigin(transformOrigin) {
7687
7742
  });
7688
7743
  }
7689
7744
 
7690
- var __defProp$B = Object.defineProperty;
7691
- var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
7692
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7693
- var __decorateClass$I = (decorators, target, key, kind) => {
7694
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
7745
+ var __defProp$z = Object.defineProperty;
7746
+ var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
7747
+ var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7748
+ var __decorateClass$C = (decorators, target, key, kind) => {
7749
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
7695
7750
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7696
7751
  if (decorator = decorators[i])
7697
7752
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7698
- if (kind && result) __defProp$B(target, key, result);
7753
+ if (kind && result) __defProp$z(target, key, result);
7699
7754
  return result;
7700
7755
  };
7701
- var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, key + "" , value);
7756
+ var __publicField$j = (obj, key, value) => __defNormalProp$j(obj, key + "" , value);
7702
7757
  exports.ColorAdjustEffect = class ColorAdjustEffect extends exports.Effect {
7703
7758
  constructor(properties, children = []) {
7704
7759
  super();
@@ -7720,7 +7775,7 @@ exports.ColorAdjustEffect = class ColorAdjustEffect extends exports.Effect {
7720
7775
  });
7721
7776
  }
7722
7777
  };
7723
- __publicField$i(exports.ColorAdjustEffect, "material", new Material({
7778
+ __publicField$j(exports.ColorAdjustEffect, "material", new Material({
7724
7779
  vert: `precision mediump float;
7725
7780
  attribute vec2 position;
7726
7781
  attribute vec2 uv;
@@ -7755,46 +7810,46 @@ void main(void) {
7755
7810
  gl_FragColor = c * alpha;
7756
7811
  }`
7757
7812
  }));
7758
- __decorateClass$I([
7813
+ __decorateClass$C([
7759
7814
  modernIdoc.property({ fallback: 1 })
7760
7815
  ], exports.ColorAdjustEffect.prototype, "saturation", 2);
7761
- __decorateClass$I([
7816
+ __decorateClass$C([
7762
7817
  modernIdoc.property({ fallback: 1 })
7763
7818
  ], exports.ColorAdjustEffect.prototype, "contrast", 2);
7764
- __decorateClass$I([
7819
+ __decorateClass$C([
7765
7820
  modernIdoc.property({ fallback: 1 })
7766
7821
  ], exports.ColorAdjustEffect.prototype, "brightness", 2);
7767
- __decorateClass$I([
7822
+ __decorateClass$C([
7768
7823
  modernIdoc.property({ fallback: 1 })
7769
7824
  ], exports.ColorAdjustEffect.prototype, "red", 2);
7770
- __decorateClass$I([
7825
+ __decorateClass$C([
7771
7826
  modernIdoc.property({ fallback: 1 })
7772
7827
  ], exports.ColorAdjustEffect.prototype, "green", 2);
7773
- __decorateClass$I([
7828
+ __decorateClass$C([
7774
7829
  modernIdoc.property({ fallback: 1 })
7775
7830
  ], exports.ColorAdjustEffect.prototype, "blue", 2);
7776
- __decorateClass$I([
7831
+ __decorateClass$C([
7777
7832
  modernIdoc.property({ fallback: 1 })
7778
7833
  ], exports.ColorAdjustEffect.prototype, "alpha", 2);
7779
- __decorateClass$I([
7834
+ __decorateClass$C([
7780
7835
  modernIdoc.property({ fallback: 1 })
7781
7836
  ], exports.ColorAdjustEffect.prototype, "gamma", 2);
7782
- exports.ColorAdjustEffect = __decorateClass$I([
7837
+ exports.ColorAdjustEffect = __decorateClass$C([
7783
7838
  customNode("ColorAdjustEffect")
7784
7839
  ], exports.ColorAdjustEffect);
7785
7840
 
7786
- var __defProp$A = Object.defineProperty;
7787
- var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
7788
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7789
- var __decorateClass$H = (decorators, target, key, kind) => {
7790
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
7841
+ var __defProp$y = Object.defineProperty;
7842
+ var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
7843
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7844
+ var __decorateClass$B = (decorators, target, key, kind) => {
7845
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
7791
7846
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7792
7847
  if (decorator = decorators[i])
7793
7848
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7794
- if (kind && result) __defProp$A(target, key, result);
7849
+ if (kind && result) __defProp$y(target, key, result);
7795
7850
  return result;
7796
7851
  };
7797
- var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
7852
+ var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, key + "" , value);
7798
7853
  exports.ColorFilterEffect = class ColorFilterEffect extends exports.Effect {
7799
7854
  _colorMatrix = new ColorMatrix();
7800
7855
  constructor(properties, children = []) {
@@ -7844,7 +7899,7 @@ exports.ColorFilterEffect = class ColorFilterEffect extends exports.Effect {
7844
7899
  });
7845
7900
  }
7846
7901
  };
7847
- __publicField$h(exports.ColorFilterEffect, "material", new Material({
7902
+ __publicField$i(exports.ColorFilterEffect, "material", new Material({
7848
7903
  vert: `precision mediump float;
7849
7904
  attribute vec2 position;
7850
7905
  attribute vec2 uv;
@@ -7871,25 +7926,25 @@ void main(void) {
7871
7926
  );
7872
7927
  }`
7873
7928
  }));
7874
- __decorateClass$H([
7929
+ __decorateClass$B([
7875
7930
  modernIdoc.property()
7876
7931
  ], exports.ColorFilterEffect.prototype, "filter", 2);
7877
- exports.ColorFilterEffect = __decorateClass$H([
7932
+ exports.ColorFilterEffect = __decorateClass$B([
7878
7933
  customNode("ColorFilterEffect")
7879
7934
  ], exports.ColorFilterEffect);
7880
7935
 
7881
- var __defProp$z = Object.defineProperty;
7882
- var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
7883
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7884
- var __decorateClass$G = (decorators, target, key, kind) => {
7885
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
7936
+ var __defProp$x = Object.defineProperty;
7937
+ var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
7938
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7939
+ var __decorateClass$A = (decorators, target, key, kind) => {
7940
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
7886
7941
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7887
7942
  if (decorator = decorators[i])
7888
7943
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7889
- if (kind && result) __defProp$z(target, key, result);
7944
+ if (kind && result) __defProp$x(target, key, result);
7890
7945
  return result;
7891
7946
  };
7892
- var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
7947
+ var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
7893
7948
  const MAX_COLORS$1 = 50;
7894
7949
  exports.ColorOverlayEffect = class ColorOverlayEffect extends exports.Effect {
7895
7950
  _color = new Color();
@@ -7915,7 +7970,7 @@ exports.ColorOverlayEffect = class ColorOverlayEffect extends exports.Effect {
7915
7970
  });
7916
7971
  }
7917
7972
  };
7918
- __publicField$g(exports.ColorOverlayEffect, "material", new Material({
7973
+ __publicField$h(exports.ColorOverlayEffect, "material", new Material({
7919
7974
  vert: `precision mediump float;
7920
7975
  attribute vec2 position;
7921
7976
  attribute vec2 uv;
@@ -7962,28 +8017,28 @@ void main(void) {
7962
8017
  gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
7963
8018
  }`
7964
8019
  }));
7965
- __decorateClass$G([
8020
+ __decorateClass$A([
7966
8021
  modernIdoc.property({ default: () => [] })
7967
8022
  ], exports.ColorOverlayEffect.prototype, "colors", 2);
7968
- __decorateClass$G([
8023
+ __decorateClass$A([
7969
8024
  modernIdoc.property({ fallback: 0.5 })
7970
8025
  ], exports.ColorOverlayEffect.prototype, "alpha", 2);
7971
- exports.ColorOverlayEffect = __decorateClass$G([
8026
+ exports.ColorOverlayEffect = __decorateClass$A([
7972
8027
  customNode("ColorOverlayEffect")
7973
8028
  ], exports.ColorOverlayEffect);
7974
8029
 
7975
- var __defProp$y = Object.defineProperty;
7976
- var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
7977
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7978
- var __decorateClass$F = (decorators, target, key, kind) => {
7979
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
8030
+ var __defProp$w = Object.defineProperty;
8031
+ var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
8032
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8033
+ var __decorateClass$z = (decorators, target, key, kind) => {
8034
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
7980
8035
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7981
8036
  if (decorator = decorators[i])
7982
8037
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7983
- if (kind && result) __defProp$y(target, key, result);
8038
+ if (kind && result) __defProp$w(target, key, result);
7984
8039
  return result;
7985
8040
  };
7986
- var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
8041
+ var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
7987
8042
  exports.ColorRemoveEffect = class ColorRemoveEffect extends exports.Effect {
7988
8043
  _color = new Color();
7989
8044
  constructor(properties, children = []) {
@@ -8014,7 +8069,7 @@ exports.ColorRemoveEffect = class ColorRemoveEffect extends exports.Effect {
8014
8069
  });
8015
8070
  }
8016
8071
  };
8017
- __publicField$f(exports.ColorRemoveEffect, "material", new Material({
8072
+ __publicField$g(exports.ColorRemoveEffect, "material", new Material({
8018
8073
  vert: `precision mediump float;
8019
8074
  attribute vec2 position;
8020
8075
  attribute vec2 uv;
@@ -8047,28 +8102,28 @@ void main(void) {
8047
8102
  gl_FragColor = color;
8048
8103
  }`
8049
8104
  }));
8050
- __decorateClass$F([
8105
+ __decorateClass$z([
8051
8106
  modernIdoc.property({ default: () => [] })
8052
8107
  ], exports.ColorRemoveEffect.prototype, "colors", 2);
8053
- __decorateClass$F([
8108
+ __decorateClass$z([
8054
8109
  modernIdoc.property({ fallback: 0.5 })
8055
8110
  ], exports.ColorRemoveEffect.prototype, "epsilon", 2);
8056
- exports.ColorRemoveEffect = __decorateClass$F([
8111
+ exports.ColorRemoveEffect = __decorateClass$z([
8057
8112
  customNode("ColorRemoveEffect")
8058
8113
  ], exports.ColorRemoveEffect);
8059
8114
 
8060
- var __defProp$x = Object.defineProperty;
8061
- var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
8062
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8063
- var __decorateClass$E = (decorators, target, key, kind) => {
8064
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
8115
+ var __defProp$v = Object.defineProperty;
8116
+ var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
8117
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8118
+ var __decorateClass$y = (decorators, target, key, kind) => {
8119
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
8065
8120
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8066
8121
  if (decorator = decorators[i])
8067
8122
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8068
- if (kind && result) __defProp$x(target, key, result);
8123
+ if (kind && result) __defProp$v(target, key, result);
8069
8124
  return result;
8070
8125
  };
8071
- var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
8126
+ var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
8072
8127
  const MAX_COLORS = 50;
8073
8128
  exports.ColorReplaceEffect = class ColorReplaceEffect extends exports.Effect {
8074
8129
  _color = new Color();
@@ -8114,7 +8169,7 @@ exports.ColorReplaceEffect = class ColorReplaceEffect extends exports.Effect {
8114
8169
  });
8115
8170
  }
8116
8171
  };
8117
- __publicField$e(exports.ColorReplaceEffect, "material", new Material({
8172
+ __publicField$f(exports.ColorReplaceEffect, "material", new Material({
8118
8173
  vert: `precision mediump float;
8119
8174
  attribute vec2 position;
8120
8175
  attribute vec2 uv;
@@ -8154,25 +8209,139 @@ void main(void) {
8154
8209
  }
8155
8210
  }`
8156
8211
  }));
8157
- __decorateClass$E([
8212
+ __decorateClass$y([
8158
8213
  modernIdoc.property({ default: () => [] })
8159
8214
  ], exports.ColorReplaceEffect.prototype, "colors", 2);
8160
- __decorateClass$E([
8215
+ __decorateClass$y([
8161
8216
  modernIdoc.property({ fallback: 0.05 })
8162
8217
  ], exports.ColorReplaceEffect.prototype, "epsilon", 2);
8163
- exports.ColorReplaceEffect = __decorateClass$E([
8218
+ exports.ColorReplaceEffect = __decorateClass$y([
8164
8219
  customNode("ColorReplaceEffect")
8165
8220
  ], exports.ColorReplaceEffect);
8166
8221
 
8167
- var __defProp$w = Object.defineProperty;
8168
- var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
8169
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8170
- var __decorateClass$D = (decorators, target, key, kind) => {
8171
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
8222
+ var __defProp$u = Object.defineProperty;
8223
+ var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
8224
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8225
+ var __decorateClass$x = (decorators, target, key, kind) => {
8226
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
8172
8227
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8173
8228
  if (decorator = decorators[i])
8174
8229
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8175
- if (kind && result) __defProp$w(target, key, result);
8230
+ if (kind && result) __defProp$u(target, key, result);
8231
+ return result;
8232
+ };
8233
+ var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
8234
+ exports.DrawboardEffect = class DrawboardEffect extends exports.Effect {
8235
+ constructor(properties, children = []) {
8236
+ super();
8237
+ this.setProperties(properties).append(children);
8238
+ }
8239
+ apply(renderer, source) {
8240
+ source.redraw(renderer, () => {
8241
+ const viewMatrix = renderer.program.uniforms.viewMatrix;
8242
+ QuadUvGeometry.draw(renderer, exports.DrawboardEffect.material, {
8243
+ sampler: 0,
8244
+ inputSize: [source.width, source.height],
8245
+ zoom: [viewMatrix[0], viewMatrix[4]],
8246
+ translate: [viewMatrix[6], viewMatrix[7]],
8247
+ checkerboard: this.checkerboard ? 1 : 0,
8248
+ checkerboardScale: this.checkerboardScale,
8249
+ pixelGrid: this.pixelGrid ? 1 : 0,
8250
+ pixelGridSize: [
8251
+ viewMatrix[0] > 4 ? Math.ceil(0.5 / viewMatrix[0] * 1e4) / 1e4 : 0,
8252
+ viewMatrix[4] > 4 ? Math.ceil(0.5 / viewMatrix[4] * 1e4) / 1e4 : 0
8253
+ ]
8254
+ });
8255
+ });
8256
+ }
8257
+ };
8258
+ __publicField$e(exports.DrawboardEffect, "material", new Material({
8259
+ vert: `precision mediump float;
8260
+ attribute vec2 position;
8261
+ attribute vec2 uv;
8262
+ uniform mat3 projectionMatrix;
8263
+ uniform mat3 viewMatrix;
8264
+ varying vec2 vUv;
8265
+ void main() {
8266
+ gl_Position = vec4(position.xy, 0.0, 1.0);
8267
+ vUv = uv;
8268
+ }`,
8269
+ frag: `varying vec2 vUv;
8270
+ uniform sampler2D sampler;
8271
+ uniform int checkerboard;
8272
+ uniform float checkerboardScale;
8273
+ uniform int pixelGrid;
8274
+ uniform vec2 pixelGridSize;
8275
+ uniform vec2 inputSize;
8276
+ uniform vec2 zoom;
8277
+ uniform vec2 translate;
8278
+
8279
+ vec4 renderCheckerboard(vec2 coord, vec4 color, vec2 scale) {
8280
+ vec2 fractValue = fract(coord * scale) - 0.5;
8281
+ float value = fractValue.x * fractValue.y < 0.0 ? 1.0 : 0.95;
8282
+ return vec4(value * (1.0 - color.a) + color.rgb, 1);
8283
+ }
8284
+
8285
+ vec3 renderPixelGrid(vec2 coord, vec3 rgb, vec2 size) {
8286
+ vec2 corner = fract(coord);
8287
+ float gridWeight = max(float(corner.x < size.x), float(corner.y < size.y));
8288
+ vec3 gridColor;
8289
+ vec3 weights = vec3(0.299, 0.587, 0.114);
8290
+ float c2 = dot(rgb * rgb, weights);
8291
+ float luminance = sqrt(c2);
8292
+ if (luminance > 0.5) {
8293
+ float target = (luminance - 0.05) / luminance;
8294
+ gridColor = rgb * target;
8295
+ }
8296
+ else {
8297
+ float target = luminance * 0.8 + 0.15;
8298
+ float c1 = dot(rgb, weights);
8299
+ float a = 1.0 - 2.0 * c1 + c2;
8300
+ float b = c2 - c1;
8301
+ gridColor = mix(rgb, vec3(1), (b + sqrt(b * b - a * (c2 - target * target))) / a);
8302
+ }
8303
+ return mix(rgb, gridColor, gridWeight);
8304
+ }
8305
+
8306
+ void main(void) {
8307
+ vec4 color = texture2D(sampler, vUv);
8308
+ vec2 coord = vec2(vUv.x, 1.0 - vUv.y);
8309
+ coord = (coord * inputSize - translate) / zoom;
8310
+
8311
+ if (checkerboard > 0) {
8312
+ color = renderCheckerboard(coord, color, vec2(checkerboardScale) * zoom);
8313
+ }
8314
+ if (pixelGrid > 0) {
8315
+ color = vec4(
8316
+ renderPixelGrid(coord, color.rgb, pixelGridSize),
8317
+ color.a
8318
+ );
8319
+ }
8320
+ gl_FragColor = color;
8321
+ }`
8322
+ }));
8323
+ __decorateClass$x([
8324
+ modernIdoc.property({ fallback: false })
8325
+ ], exports.DrawboardEffect.prototype, "checkerboard", 2);
8326
+ __decorateClass$x([
8327
+ modernIdoc.property({ fallback: 1 / 16 })
8328
+ ], exports.DrawboardEffect.prototype, "checkerboardScale", 2);
8329
+ __decorateClass$x([
8330
+ modernIdoc.property({ fallback: false })
8331
+ ], exports.DrawboardEffect.prototype, "pixelGrid", 2);
8332
+ exports.DrawboardEffect = __decorateClass$x([
8333
+ customNode("DrawboardEffect")
8334
+ ], exports.DrawboardEffect);
8335
+
8336
+ var __defProp$t = Object.defineProperty;
8337
+ var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
8338
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8339
+ var __decorateClass$w = (decorators, target, key, kind) => {
8340
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
8341
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8342
+ if (decorator = decorators[i])
8343
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8344
+ if (kind && result) __defProp$t(target, key, result);
8176
8345
  return result;
8177
8346
  };
8178
8347
  var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -8278,25 +8447,25 @@ void main(void) {
8278
8447
  }`,
8279
8448
  frag: frag$2
8280
8449
  }));
8281
- __decorateClass$D([
8450
+ __decorateClass$w([
8282
8451
  modernIdoc.property({ fallback: 4 })
8283
8452
  ], exports.GaussianBlurEffect.prototype, "strength", 2);
8284
- __decorateClass$D([
8453
+ __decorateClass$w([
8285
8454
  modernIdoc.property({ fallback: 3 })
8286
8455
  ], exports.GaussianBlurEffect.prototype, "quality", 2);
8287
- exports.GaussianBlurEffect = __decorateClass$D([
8456
+ exports.GaussianBlurEffect = __decorateClass$w([
8288
8457
  customNode("GaussianBlurEffect")
8289
8458
  ], exports.GaussianBlurEffect);
8290
8459
 
8291
- var __defProp$v = Object.defineProperty;
8292
- var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
8293
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8294
- var __decorateClass$C = (decorators, target, key, kind) => {
8295
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
8460
+ var __defProp$s = Object.defineProperty;
8461
+ var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
8462
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8463
+ var __decorateClass$v = (decorators, target, key, kind) => {
8464
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
8296
8465
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8297
8466
  if (decorator = decorators[i])
8298
8467
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8299
- if (kind && result) __defProp$v(target, key, result);
8468
+ if (kind && result) __defProp$s(target, key, result);
8300
8469
  return result;
8301
8470
  };
8302
8471
  var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, key + "" , value);
@@ -8360,34 +8529,34 @@ void main(void) {
8360
8529
  gl_FragColor = sample;
8361
8530
  }`
8362
8531
  }));
8363
- __decorateClass$C([
8532
+ __decorateClass$v([
8364
8533
  modernIdoc.property({ fallback: "#000000FF" })
8365
8534
  ], exports.DropShadowEffect.prototype, "color", 2);
8366
- __decorateClass$C([
8535
+ __decorateClass$v([
8367
8536
  modernIdoc.property({ fallback: 4 })
8368
8537
  ], exports.DropShadowEffect.prototype, "blur", 2);
8369
- __decorateClass$C([
8538
+ __decorateClass$v([
8370
8539
  modernIdoc.property({ fallback: 4 })
8371
8540
  ], exports.DropShadowEffect.prototype, "offsetX", 2);
8372
- __decorateClass$C([
8541
+ __decorateClass$v([
8373
8542
  modernIdoc.property({ fallback: 4 })
8374
8543
  ], exports.DropShadowEffect.prototype, "offsetY", 2);
8375
- __decorateClass$C([
8544
+ __decorateClass$v([
8376
8545
  modernIdoc.property({ fallback: false })
8377
8546
  ], exports.DropShadowEffect.prototype, "shadowOnly", 2);
8378
- exports.DropShadowEffect = __decorateClass$C([
8547
+ exports.DropShadowEffect = __decorateClass$v([
8379
8548
  customNode("DropShadowEffect")
8380
8549
  ], exports.DropShadowEffect);
8381
8550
 
8382
- var __defProp$u = Object.defineProperty;
8383
- var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
8384
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8385
- var __decorateClass$B = (decorators, target, key, kind) => {
8386
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
8551
+ var __defProp$r = Object.defineProperty;
8552
+ var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
8553
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8554
+ var __decorateClass$u = (decorators, target, key, kind) => {
8555
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
8387
8556
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8388
8557
  if (decorator = decorators[i])
8389
8558
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8390
- if (kind && result) __defProp$u(target, key, result);
8559
+ if (kind && result) __defProp$r(target, key, result);
8391
8560
  return result;
8392
8561
  };
8393
8562
  var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, key + "" , value);
@@ -8432,22 +8601,22 @@ void main(void) {
8432
8601
  gl_FragColor = vec4(color.rgb * alpha, alpha);
8433
8602
  }`
8434
8603
  }));
8435
- __decorateClass$B([
8604
+ __decorateClass$u([
8436
8605
  modernIdoc.property({ fallback: 5 })
8437
8606
  ], exports.EmbossEffect.prototype, "strength", 2);
8438
- exports.EmbossEffect = __decorateClass$B([
8607
+ exports.EmbossEffect = __decorateClass$u([
8439
8608
  customNode("EmbossEffect")
8440
8609
  ], exports.EmbossEffect);
8441
8610
 
8442
- var __defProp$t = Object.defineProperty;
8443
- var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
8444
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8445
- var __decorateClass$A = (decorators, target, key, kind) => {
8446
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
8611
+ var __defProp$q = Object.defineProperty;
8612
+ var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
8613
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8614
+ var __decorateClass$t = (decorators, target, key, kind) => {
8615
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
8447
8616
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8448
8617
  if (decorator = decorators[i])
8449
8618
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8450
- if (kind && result) __defProp$t(target, key, result);
8619
+ if (kind && result) __defProp$q(target, key, result);
8451
8620
  return result;
8452
8621
  };
8453
8622
  var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
@@ -8621,46 +8790,46 @@ void main(void) {
8621
8790
  gl_FragColor.a = texture2D(sampler, coord).a;
8622
8791
  }`
8623
8792
  }));
8624
- __decorateClass$A([
8793
+ __decorateClass$t([
8625
8794
  modernIdoc.property({ fallback: 10 })
8626
8795
  ], exports.GlitchEffect.prototype, "slices", 2);
8627
- __decorateClass$A([
8796
+ __decorateClass$t([
8628
8797
  modernIdoc.property({ fallback: 512 })
8629
8798
  ], exports.GlitchEffect.prototype, "sampleSize", 2);
8630
- __decorateClass$A([
8799
+ __decorateClass$t([
8631
8800
  modernIdoc.property({ fallback: 100 })
8632
8801
  ], exports.GlitchEffect.prototype, "offset", 2);
8633
- __decorateClass$A([
8802
+ __decorateClass$t([
8634
8803
  modernIdoc.property({ fallback: 0 })
8635
8804
  ], exports.GlitchEffect.prototype, "direction", 2);
8636
- __decorateClass$A([
8805
+ __decorateClass$t([
8637
8806
  modernIdoc.property({ fallback: 2 })
8638
8807
  ], exports.GlitchEffect.prototype, "fillMode", 2);
8639
- __decorateClass$A([
8808
+ __decorateClass$t([
8640
8809
  modernIdoc.property({ fallback: 0 })
8641
8810
  ], exports.GlitchEffect.prototype, "seed", 2);
8642
- __decorateClass$A([
8811
+ __decorateClass$t([
8643
8812
  modernIdoc.property({ default: () => [2, 2] })
8644
8813
  ], exports.GlitchEffect.prototype, "red", 2);
8645
- __decorateClass$A([
8814
+ __decorateClass$t([
8646
8815
  modernIdoc.property({ default: () => [-10, 4] })
8647
8816
  ], exports.GlitchEffect.prototype, "green", 2);
8648
- __decorateClass$A([
8817
+ __decorateClass$t([
8649
8818
  modernIdoc.property({ default: () => [10, -4] })
8650
8819
  ], exports.GlitchEffect.prototype, "blue", 2);
8651
- exports.GlitchEffect = __decorateClass$A([
8820
+ exports.GlitchEffect = __decorateClass$t([
8652
8821
  customNode("GlitchEffect")
8653
8822
  ], exports.GlitchEffect);
8654
8823
 
8655
- var __defProp$s = Object.defineProperty;
8656
- var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
8657
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8658
- var __decorateClass$z = (decorators, target, key, kind) => {
8659
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
8824
+ var __defProp$p = Object.defineProperty;
8825
+ var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
8826
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8827
+ var __decorateClass$s = (decorators, target, key, kind) => {
8828
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
8660
8829
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8661
8830
  if (decorator = decorators[i])
8662
8831
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8663
- if (kind && result) __defProp$s(target, key, result);
8832
+ if (kind && result) __defProp$p(target, key, result);
8664
8833
  return result;
8665
8834
  };
8666
8835
  var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
@@ -8838,39 +9007,39 @@ void main(void) {
8838
9007
  gl_FragColor = vec4(color.rgb + mist.rgb, color.a);
8839
9008
  }`
8840
9009
  }));
8841
- __decorateClass$z([
9010
+ __decorateClass$s([
8842
9011
  modernIdoc.property({ fallback: 0 })
8843
9012
  ], exports.GodrayEffect.prototype, "time", 2);
8844
- __decorateClass$z([
9013
+ __decorateClass$s([
8845
9014
  modernIdoc.property({ fallback: 30 })
8846
9015
  ], exports.GodrayEffect.prototype, "angle", 2);
8847
- __decorateClass$z([
9016
+ __decorateClass$s([
8848
9017
  modernIdoc.property({ fallback: 0.5 })
8849
9018
  ], exports.GodrayEffect.prototype, "gain", 2);
8850
- __decorateClass$z([
9019
+ __decorateClass$s([
8851
9020
  modernIdoc.property({ fallback: 2.5 })
8852
9021
  ], exports.GodrayEffect.prototype, "lacunarity", 2);
8853
- __decorateClass$z([
9022
+ __decorateClass$s([
8854
9023
  modernIdoc.property({ fallback: true })
8855
9024
  ], exports.GodrayEffect.prototype, "parallel", 2);
8856
- __decorateClass$z([
9025
+ __decorateClass$s([
8857
9026
  modernIdoc.property({ default: () => [0, 0] })
8858
9027
  ], exports.GodrayEffect.prototype, "center", 2);
8859
- __decorateClass$z([
9028
+ __decorateClass$s([
8860
9029
  modernIdoc.property({ fallback: 1 })
8861
9030
  ], exports.GodrayEffect.prototype, "alpha", 2);
8862
- exports.GodrayEffect = __decorateClass$z([
9031
+ exports.GodrayEffect = __decorateClass$s([
8863
9032
  customNode("GodrayEffect")
8864
9033
  ], exports.GodrayEffect);
8865
9034
 
8866
- var __defProp$r = Object.defineProperty;
8867
- var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
8868
- var __decorateClass$y = (decorators, target, key, kind) => {
8869
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
9035
+ var __defProp$o = Object.defineProperty;
9036
+ var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
9037
+ var __decorateClass$r = (decorators, target, key, kind) => {
9038
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
8870
9039
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8871
9040
  if (decorator = decorators[i])
8872
9041
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8873
- if (kind && result) __defProp$r(target, key, result);
9042
+ if (kind && result) __defProp$o(target, key, result);
8874
9043
  return result;
8875
9044
  };
8876
9045
  const frag$1 = `varying vec2 vUv;
@@ -8960,28 +9129,28 @@ void main() {
8960
9129
  });
8961
9130
  }
8962
9131
  };
8963
- __decorateClass$y([
9132
+ __decorateClass$r([
8964
9133
  modernIdoc.property({ fallback: 4 })
8965
9134
  ], exports.KawaseBlurEffect.prototype, "strength", 2);
8966
- __decorateClass$y([
9135
+ __decorateClass$r([
8967
9136
  modernIdoc.property({ fallback: 3 })
8968
9137
  ], exports.KawaseBlurEffect.prototype, "quality", 2);
8969
- __decorateClass$y([
9138
+ __decorateClass$r([
8970
9139
  modernIdoc.property({ default: () => [1, 1] })
8971
9140
  ], exports.KawaseBlurEffect.prototype, "pixelSize", 2);
8972
- exports.KawaseBlurEffect = __decorateClass$y([
9141
+ exports.KawaseBlurEffect = __decorateClass$r([
8973
9142
  customNode("KawaseBlurEffect")
8974
9143
  ], exports.KawaseBlurEffect);
8975
9144
 
8976
- var __defProp$q = Object.defineProperty;
8977
- var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
8978
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$q(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8979
- var __decorateClass$x = (decorators, target, key, kind) => {
8980
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
9145
+ var __defProp$n = Object.defineProperty;
9146
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
9147
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9148
+ var __decorateClass$q = (decorators, target, key, kind) => {
9149
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
8981
9150
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8982
9151
  if (decorator = decorators[i])
8983
9152
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8984
- if (kind && result) __defProp$q(target, key, result);
9153
+ if (kind && result) __defProp$n(target, key, result);
8985
9154
  return result;
8986
9155
  };
8987
9156
  var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
@@ -9069,25 +9238,25 @@ void main(void) {
9069
9238
  }
9070
9239
  }`
9071
9240
  }));
9072
- __decorateClass$x([
9241
+ __decorateClass$q([
9073
9242
  modernIdoc.property({ internal: true })
9074
9243
  ], exports.MaskEffect.prototype, "texture", 2);
9075
- __decorateClass$x([
9244
+ __decorateClass$q([
9076
9245
  modernIdoc.property({ fallback: "" })
9077
9246
  ], exports.MaskEffect.prototype, "src", 2);
9078
- exports.MaskEffect = __decorateClass$x([
9247
+ exports.MaskEffect = __decorateClass$q([
9079
9248
  customNode("MaskEffect")
9080
9249
  ], exports.MaskEffect);
9081
9250
 
9082
- var __defProp$p = Object.defineProperty;
9083
- var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
9084
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9085
- var __decorateClass$w = (decorators, target, key, kind) => {
9086
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
9251
+ var __defProp$m = Object.defineProperty;
9252
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
9253
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9254
+ var __decorateClass$p = (decorators, target, key, kind) => {
9255
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
9087
9256
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9088
9257
  if (decorator = decorators[i])
9089
9258
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9090
- if (kind && result) __defProp$p(target, key, result);
9259
+ if (kind && result) __defProp$m(target, key, result);
9091
9260
  return result;
9092
9261
  };
9093
9262
  var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -9174,40 +9343,40 @@ void main() {
9174
9343
  };
9175
9344
  __publicField$7(exports.OutlineEffect, "MIN_SAMPLES", 1);
9176
9345
  __publicField$7(exports.OutlineEffect, "MAX_SAMPLES", 100);
9177
- __decorateClass$w([
9346
+ __decorateClass$p([
9178
9347
  modernIdoc.property({ fallback: "#000000ff" })
9179
9348
  ], exports.OutlineEffect.prototype, "color", 2);
9180
- __decorateClass$w([
9349
+ __decorateClass$p([
9181
9350
  modernIdoc.property({ fallback: 1 })
9182
9351
  ], exports.OutlineEffect.prototype, "width", 2);
9183
- __decorateClass$w([
9352
+ __decorateClass$p([
9184
9353
  modernIdoc.property({ fallback: "solid" })
9185
9354
  ], exports.OutlineEffect.prototype, "style", 2);
9186
- __decorateClass$w([
9355
+ __decorateClass$p([
9187
9356
  modernIdoc.property()
9188
9357
  ], exports.OutlineEffect.prototype, "image", 2);
9189
- __decorateClass$w([
9358
+ __decorateClass$p([
9190
9359
  modernIdoc.property({ fallback: 1 })
9191
9360
  ], exports.OutlineEffect.prototype, "opacity", 2);
9192
- __decorateClass$w([
9361
+ __decorateClass$p([
9193
9362
  modernIdoc.property({ fallback: 0.1 })
9194
9363
  ], exports.OutlineEffect.prototype, "quality", 2);
9195
- __decorateClass$w([
9364
+ __decorateClass$p([
9196
9365
  modernIdoc.property({ fallback: false })
9197
9366
  ], exports.OutlineEffect.prototype, "knockout", 2);
9198
- exports.OutlineEffect = __decorateClass$w([
9367
+ exports.OutlineEffect = __decorateClass$p([
9199
9368
  customNode("OutlineEffect")
9200
9369
  ], exports.OutlineEffect);
9201
9370
 
9202
- var __defProp$o = Object.defineProperty;
9203
- var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
9204
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9205
- var __decorateClass$v = (decorators, target, key, kind) => {
9206
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
9371
+ var __defProp$l = Object.defineProperty;
9372
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
9373
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9374
+ var __decorateClass$o = (decorators, target, key, kind) => {
9375
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
9207
9376
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9208
9377
  if (decorator = decorators[i])
9209
9378
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9210
- if (kind && result) __defProp$o(target, key, result);
9379
+ if (kind && result) __defProp$l(target, key, result);
9211
9380
  return result;
9212
9381
  };
9213
9382
  var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
@@ -9263,22 +9432,22 @@ void main(void) {
9263
9432
  gl_FragColor = texture2D(sampler, coord);
9264
9433
  }`
9265
9434
  }));
9266
- __decorateClass$v([
9435
+ __decorateClass$o([
9267
9436
  modernIdoc.property({ fallback: 10 })
9268
9437
  ], exports.PixelateEffect.prototype, "strength", 2);
9269
- exports.PixelateEffect = __decorateClass$v([
9438
+ exports.PixelateEffect = __decorateClass$o([
9270
9439
  customNode("PixelateEffect")
9271
9440
  ], exports.PixelateEffect);
9272
9441
 
9273
- var __defProp$n = Object.defineProperty;
9274
- var __getOwnPropDesc$l = Object.getOwnPropertyDescriptor;
9275
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9276
- var __decorateClass$u = (decorators, target, key, kind) => {
9277
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$l(target, key) : target;
9442
+ var __defProp$k = Object.defineProperty;
9443
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
9444
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9445
+ var __decorateClass$n = (decorators, target, key, kind) => {
9446
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
9278
9447
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9279
9448
  if (decorator = decorators[i])
9280
9449
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9281
- if (kind && result) __defProp$n(target, key, result);
9450
+ if (kind && result) __defProp$k(target, key, result);
9282
9451
  return result;
9283
9452
  };
9284
9453
  var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
@@ -9391,19 +9560,19 @@ void main() {
9391
9560
  gl_FragColor = color;
9392
9561
  }`
9393
9562
  }));
9394
- __decorateClass$u([
9563
+ __decorateClass$n([
9395
9564
  modernIdoc.property()
9396
9565
  ], exports.ZoomBlurEffect.prototype, "center", 2);
9397
- __decorateClass$u([
9566
+ __decorateClass$n([
9398
9567
  modernIdoc.property({ fallback: 20 })
9399
9568
  ], exports.ZoomBlurEffect.prototype, "innerRadius", 2);
9400
- __decorateClass$u([
9569
+ __decorateClass$n([
9401
9570
  modernIdoc.property({ fallback: -1 })
9402
9571
  ], exports.ZoomBlurEffect.prototype, "radius", 2);
9403
- __decorateClass$u([
9572
+ __decorateClass$n([
9404
9573
  modernIdoc.property({ fallback: 0.1 })
9405
9574
  ], exports.ZoomBlurEffect.prototype, "strength", 2);
9406
- exports.ZoomBlurEffect = __decorateClass$u([
9575
+ exports.ZoomBlurEffect = __decorateClass$n([
9407
9576
  customNode("ZoomBlurEffect")
9408
9577
  ], exports.ZoomBlurEffect);
9409
9578
 
@@ -9451,13 +9620,13 @@ function getDrawOptions(fill, box) {
9451
9620
  return { disableWrapMode, uvTransform };
9452
9621
  }
9453
9622
 
9454
- var __defProp$m = Object.defineProperty;
9455
- var __decorateClass$t = (decorators, target, key, kind) => {
9623
+ var __defProp$j = Object.defineProperty;
9624
+ var __decorateClass$m = (decorators, target, key, kind) => {
9456
9625
  var result = void 0 ;
9457
9626
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9458
9627
  if (decorator = decorators[i])
9459
9628
  result = (decorator(target, key, result) ) || result;
9460
- if (result) __defProp$m(target, key, result);
9629
+ if (result) __defProp$j(target, key, result);
9461
9630
  return result;
9462
9631
  };
9463
9632
  class BaseElement2DFill extends CoreObject {
@@ -9567,47 +9736,47 @@ class BaseElement2DFill extends CoreObject {
9567
9736
  return this;
9568
9737
  }
9569
9738
  }
9570
- __decorateClass$t([
9739
+ __decorateClass$m([
9571
9740
  modernIdoc.property({ fallback: true })
9572
9741
  ], BaseElement2DFill.prototype, "enabled");
9573
- __decorateClass$t([
9742
+ __decorateClass$m([
9574
9743
  modernIdoc.property()
9575
9744
  ], BaseElement2DFill.prototype, "color");
9576
- __decorateClass$t([
9745
+ __decorateClass$m([
9577
9746
  modernIdoc.property()
9578
9747
  ], BaseElement2DFill.prototype, "image");
9579
- __decorateClass$t([
9748
+ __decorateClass$m([
9580
9749
  modernIdoc.property()
9581
9750
  ], BaseElement2DFill.prototype, "linearGradient");
9582
- __decorateClass$t([
9751
+ __decorateClass$m([
9583
9752
  modernIdoc.property()
9584
9753
  ], BaseElement2DFill.prototype, "radialGradient");
9585
- __decorateClass$t([
9754
+ __decorateClass$m([
9586
9755
  modernIdoc.property()
9587
9756
  ], BaseElement2DFill.prototype, "cropRect");
9588
- __decorateClass$t([
9757
+ __decorateClass$m([
9589
9758
  modernIdoc.property()
9590
9759
  ], BaseElement2DFill.prototype, "stretchRect");
9591
- __decorateClass$t([
9760
+ __decorateClass$m([
9592
9761
  modernIdoc.property()
9593
9762
  ], BaseElement2DFill.prototype, "dpi");
9594
- __decorateClass$t([
9763
+ __decorateClass$m([
9595
9764
  modernIdoc.property()
9596
9765
  ], BaseElement2DFill.prototype, "rotateWithShape");
9597
- __decorateClass$t([
9766
+ __decorateClass$m([
9598
9767
  modernIdoc.property()
9599
9768
  ], BaseElement2DFill.prototype, "tile");
9600
- __decorateClass$t([
9769
+ __decorateClass$m([
9601
9770
  modernIdoc.property()
9602
9771
  ], BaseElement2DFill.prototype, "opacity");
9603
9772
 
9604
- var __defProp$l = Object.defineProperty;
9605
- var __decorateClass$s = (decorators, target, key, kind) => {
9773
+ var __defProp$i = Object.defineProperty;
9774
+ var __decorateClass$l = (decorators, target, key, kind) => {
9606
9775
  var result = void 0 ;
9607
9776
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9608
9777
  if (decorator = decorators[i])
9609
9778
  result = (decorator(target, key, result) ) || result;
9610
- if (result) __defProp$l(target, key, result);
9779
+ if (result) __defProp$i(target, key, result);
9611
9780
  return result;
9612
9781
  };
9613
9782
  class BaseElement2DBackground extends BaseElement2DFill {
@@ -9625,17 +9794,17 @@ class BaseElement2DBackground extends BaseElement2DFill {
9625
9794
  }
9626
9795
  }
9627
9796
  }
9628
- __decorateClass$s([
9797
+ __decorateClass$l([
9629
9798
  modernIdoc.property()
9630
9799
  ], BaseElement2DBackground.prototype, "fillWithShape");
9631
9800
 
9632
- var __defProp$k = Object.defineProperty;
9633
- var __decorateClass$r = (decorators, target, key, kind) => {
9801
+ var __defProp$h = Object.defineProperty;
9802
+ var __decorateClass$k = (decorators, target, key, kind) => {
9634
9803
  var result = void 0 ;
9635
9804
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9636
9805
  if (decorator = decorators[i])
9637
9806
  result = (decorator(target, key, result) ) || result;
9638
- if (result) __defProp$k(target, key, result);
9807
+ if (result) __defProp$h(target, key, result);
9639
9808
  return result;
9640
9809
  };
9641
9810
  class BaseElement2DForeground extends BaseElement2DFill {
@@ -9653,17 +9822,17 @@ class BaseElement2DForeground extends BaseElement2DFill {
9653
9822
  }
9654
9823
  }
9655
9824
  }
9656
- __decorateClass$r([
9825
+ __decorateClass$k([
9657
9826
  modernIdoc.property()
9658
9827
  ], BaseElement2DForeground.prototype, "fillWithShape");
9659
9828
 
9660
- var __defProp$j = Object.defineProperty;
9661
- var __decorateClass$q = (decorators, target, key, kind) => {
9829
+ var __defProp$g = Object.defineProperty;
9830
+ var __decorateClass$j = (decorators, target, key, kind) => {
9662
9831
  var result = void 0 ;
9663
9832
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9664
9833
  if (decorator = decorators[i])
9665
9834
  result = (decorator(target, key, result) ) || result;
9666
- if (result) __defProp$j(target, key, result);
9835
+ if (result) __defProp$g(target, key, result);
9667
9836
  return result;
9668
9837
  };
9669
9838
  class BaseElement2DOutline extends BaseElement2DFill {
@@ -9706,29 +9875,29 @@ class BaseElement2DOutline extends BaseElement2DFill {
9706
9875
  ctx.stroke({ disableWrapMode });
9707
9876
  }
9708
9877
  }
9709
- __decorateClass$q([
9878
+ __decorateClass$j([
9710
9879
  modernIdoc.property({ fallback: "#00000000" })
9711
9880
  ], BaseElement2DOutline.prototype, "color");
9712
- __decorateClass$q([
9881
+ __decorateClass$j([
9713
9882
  modernIdoc.property({ fallback: 0 })
9714
9883
  ], BaseElement2DOutline.prototype, "width");
9715
- __decorateClass$q([
9884
+ __decorateClass$j([
9716
9885
  modernIdoc.property({ fallback: "solid" })
9717
9886
  ], BaseElement2DOutline.prototype, "style");
9718
- __decorateClass$q([
9887
+ __decorateClass$j([
9719
9888
  modernIdoc.property({ fallback: "butt" })
9720
9889
  ], BaseElement2DOutline.prototype, "lineCap");
9721
- __decorateClass$q([
9890
+ __decorateClass$j([
9722
9891
  modernIdoc.property({ fallback: "miter" })
9723
9892
  ], BaseElement2DOutline.prototype, "lineJoin");
9724
9893
 
9725
- var __defProp$i = Object.defineProperty;
9726
- var __decorateClass$p = (decorators, target, key, kind) => {
9894
+ var __defProp$f = Object.defineProperty;
9895
+ var __decorateClass$i = (decorators, target, key, kind) => {
9727
9896
  var result = void 0 ;
9728
9897
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9729
9898
  if (decorator = decorators[i])
9730
9899
  result = (decorator(target, key, result) ) || result;
9731
- if (result) __defProp$i(target, key, result);
9900
+ if (result) __defProp$f(target, key, result);
9732
9901
  return result;
9733
9902
  };
9734
9903
  class BaseElement2DShadow extends CoreObject {
@@ -9768,29 +9937,29 @@ class BaseElement2DShadow extends CoreObject {
9768
9937
  }
9769
9938
  }
9770
9939
  }
9771
- __decorateClass$p([
9940
+ __decorateClass$i([
9772
9941
  modernIdoc.property({ fallback: true })
9773
9942
  ], BaseElement2DShadow.prototype, "enabled");
9774
- __decorateClass$p([
9943
+ __decorateClass$i([
9775
9944
  modernIdoc.property({ fallback: "#000000FF" })
9776
9945
  ], BaseElement2DShadow.prototype, "color");
9777
- __decorateClass$p([
9946
+ __decorateClass$i([
9778
9947
  modernIdoc.property({ fallback: 0 })
9779
9948
  ], BaseElement2DShadow.prototype, "blur");
9780
- __decorateClass$p([
9949
+ __decorateClass$i([
9781
9950
  modernIdoc.property({ fallback: 0 })
9782
9951
  ], BaseElement2DShadow.prototype, "offsetY");
9783
- __decorateClass$p([
9952
+ __decorateClass$i([
9784
9953
  modernIdoc.property({ fallback: 0 })
9785
9954
  ], BaseElement2DShadow.prototype, "offsetX");
9786
9955
 
9787
- var __defProp$h = Object.defineProperty;
9788
- var __decorateClass$o = (decorators, target, key, kind) => {
9956
+ var __defProp$e = Object.defineProperty;
9957
+ var __decorateClass$h = (decorators, target, key, kind) => {
9789
9958
  var result = void 0 ;
9790
9959
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9791
9960
  if (decorator = decorators[i])
9792
9961
  result = (decorator(target, key, result) ) || result;
9793
- if (result) __defProp$h(target, key, result);
9962
+ if (result) __defProp$e(target, key, result);
9794
9963
  return result;
9795
9964
  };
9796
9965
  class BaseElement2DShape extends CoreObject {
@@ -9865,19 +10034,19 @@ class BaseElement2DShape extends CoreObject {
9865
10034
  }
9866
10035
  }
9867
10036
  }
9868
- __decorateClass$o([
10037
+ __decorateClass$h([
9869
10038
  modernIdoc.property({ fallback: true })
9870
10039
  ], BaseElement2DShape.prototype, "enabled");
9871
- __decorateClass$o([
10040
+ __decorateClass$h([
9872
10041
  modernIdoc.property()
9873
10042
  ], BaseElement2DShape.prototype, "preset");
9874
- __decorateClass$o([
10043
+ __decorateClass$h([
9875
10044
  modernIdoc.property()
9876
10045
  ], BaseElement2DShape.prototype, "svg");
9877
- __decorateClass$o([
10046
+ __decorateClass$h([
9878
10047
  modernIdoc.property()
9879
10048
  ], BaseElement2DShape.prototype, "viewBox");
9880
- __decorateClass$o([
10049
+ __decorateClass$h([
9881
10050
  modernIdoc.property()
9882
10051
  ], BaseElement2DShape.prototype, "paths");
9883
10052
 
@@ -9893,13 +10062,13 @@ for (const key in defaultStyles$1) {
9893
10062
  modernIdoc.defineProperty(BaseElement2DStyle, key, { fallback });
9894
10063
  }
9895
10064
 
9896
- var __defProp$g = Object.defineProperty;
9897
- var __decorateClass$n = (decorators, target, key, kind) => {
10065
+ var __defProp$d = Object.defineProperty;
10066
+ var __decorateClass$g = (decorators, target, key, kind) => {
9898
10067
  var result = void 0 ;
9899
10068
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
9900
10069
  if (decorator = decorators[i])
9901
10070
  result = (decorator(target, key, result) ) || result;
9902
- if (result) __defProp$g(target, key, result);
10071
+ if (result) __defProp$d(target, key, result);
9903
10072
  return result;
9904
10073
  };
9905
10074
  class BaseElement2DText extends CoreObject {
@@ -10089,34 +10258,34 @@ class BaseElement2DText extends CoreObject {
10089
10258
  });
10090
10259
  }
10091
10260
  }
10092
- __decorateClass$n([
10261
+ __decorateClass$g([
10093
10262
  modernIdoc.property({ fallback: true })
10094
10263
  ], BaseElement2DText.prototype, "enabled");
10095
- __decorateClass$n([
10264
+ __decorateClass$g([
10096
10265
  modernIdoc.property({ fallback: () => [] })
10097
10266
  ], BaseElement2DText.prototype, "content");
10098
- __decorateClass$n([
10267
+ __decorateClass$g([
10099
10268
  modernIdoc.property({ alias: "parent.style.json" })
10100
10269
  ], BaseElement2DText.prototype, "style");
10101
- __decorateClass$n([
10270
+ __decorateClass$g([
10102
10271
  modernIdoc.property()
10103
10272
  ], BaseElement2DText.prototype, "effects");
10104
- __decorateClass$n([
10273
+ __decorateClass$g([
10105
10274
  modernIdoc.property()
10106
10275
  ], BaseElement2DText.prototype, "fill");
10107
- __decorateClass$n([
10276
+ __decorateClass$g([
10108
10277
  modernIdoc.property()
10109
10278
  ], BaseElement2DText.prototype, "outline");
10110
- __decorateClass$n([
10279
+ __decorateClass$g([
10111
10280
  modernIdoc.property({ alias: "base.measureDom" })
10112
10281
  ], BaseElement2DText.prototype, "measureDom");
10113
- __decorateClass$n([
10282
+ __decorateClass$g([
10114
10283
  modernIdoc.property({ alias: "base.fonts" })
10115
10284
  ], BaseElement2DText.prototype, "fonts");
10116
10285
 
10117
- var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
10118
- var __decorateClass$m = (decorators, target, key, kind) => {
10119
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$k(target, key) : target;
10286
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
10287
+ var __decorateClass$f = (decorators, target, key, kind) => {
10288
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
10120
10289
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
10121
10290
  if (decorator = decorators[i])
10122
10291
  result = (decorator(result)) || result;
@@ -10323,6 +10492,14 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
10323
10492
  super.updateGlobalTransform();
10324
10493
  this._updateOverflow();
10325
10494
  }
10495
+ _relayout(batchables) {
10496
+ return super._relayout(batchables).map((batchable) => {
10497
+ return {
10498
+ ...batchable,
10499
+ dimension: this.size.toFloat32Array()
10500
+ };
10501
+ });
10502
+ }
10326
10503
  getRect() {
10327
10504
  return this.getGlobalAabb();
10328
10505
  }
@@ -10535,7 +10712,7 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
10535
10712
  });
10536
10713
  }
10537
10714
  };
10538
- exports.BaseElement2D = __decorateClass$m([
10715
+ exports.BaseElement2D = __decorateClass$f([
10539
10716
  customNode("BaseElement2D")
10540
10717
  ], exports.BaseElement2D);
10541
10718
 
@@ -10562,9 +10739,9 @@ class FlexElement2DStyle extends BaseElement2DStyle {
10562
10739
  }
10563
10740
  }
10564
10741
 
10565
- var __getOwnPropDesc$j = Object.getOwnPropertyDescriptor;
10566
- var __decorateClass$l = (decorators, target, key, kind) => {
10567
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$j(target, key) : target;
10742
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
10743
+ var __decorateClass$e = (decorators, target, key, kind) => {
10744
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
10568
10745
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
10569
10746
  if (decorator = decorators[i])
10570
10747
  result = (decorator(result)) || result;
@@ -10615,7 +10792,7 @@ exports.Element2D = class Element2D extends exports.BaseElement2D {
10615
10792
  }
10616
10793
  }
10617
10794
  };
10618
- exports.Element2D = __decorateClass$l([
10795
+ exports.Element2D = __decorateClass$e([
10619
10796
  customNode("Element2D")
10620
10797
  ], exports.Element2D);
10621
10798
 
@@ -10925,9 +11102,9 @@ class FlexLayout {
10925
11102
  }
10926
11103
  }
10927
11104
 
10928
- var __getOwnPropDesc$i = Object.getOwnPropertyDescriptor;
10929
- var __decorateClass$k = (decorators, target, key, kind) => {
10930
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$i(target, key) : target;
11105
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
11106
+ var __decorateClass$d = (decorators, target, key, kind) => {
11107
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
10931
11108
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
10932
11109
  if (decorator = decorators[i])
10933
11110
  result = (decorator(result)) || result;
@@ -11004,18 +11181,18 @@ exports.FlexElement2D = class FlexElement2D extends exports.BaseElement2D {
11004
11181
  }
11005
11182
  }
11006
11183
  };
11007
- exports.FlexElement2D = __decorateClass$k([
11184
+ exports.FlexElement2D = __decorateClass$d([
11008
11185
  customNode("FlexElement2D")
11009
11186
  ], exports.FlexElement2D);
11010
11187
 
11011
- var __defProp$f = Object.defineProperty;
11012
- var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
11013
- var __decorateClass$j = (decorators, target, key, kind) => {
11014
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
11188
+ var __defProp$c = Object.defineProperty;
11189
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
11190
+ var __decorateClass$c = (decorators, target, key, kind) => {
11191
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
11015
11192
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11016
11193
  if (decorator = decorators[i])
11017
11194
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11018
- if (kind && result) __defProp$f(target, key, result);
11195
+ if (kind && result) __defProp$c(target, key, result);
11019
11196
  return result;
11020
11197
  };
11021
11198
  exports.Image2D = class Image2D extends exports.Element2D {
@@ -11151,19 +11328,19 @@ exports.Image2D = class Image2D extends exports.Element2D {
11151
11328
  });
11152
11329
  }
11153
11330
  };
11154
- __decorateClass$j([
11331
+ __decorateClass$c([
11155
11332
  modernIdoc.property({ internal: true })
11156
11333
  ], exports.Image2D.prototype, "texture", 2);
11157
- __decorateClass$j([
11334
+ __decorateClass$c([
11158
11335
  modernIdoc.property({ fallback: "" })
11159
11336
  ], exports.Image2D.prototype, "src", 2);
11160
- __decorateClass$j([
11337
+ __decorateClass$c([
11161
11338
  modernIdoc.property()
11162
11339
  ], exports.Image2D.prototype, "srcRect", 2);
11163
- __decorateClass$j([
11340
+ __decorateClass$c([
11164
11341
  modernIdoc.property({ fallback: false })
11165
11342
  ], exports.Image2D.prototype, "gif", 2);
11166
- exports.Image2D = __decorateClass$j([
11343
+ exports.Image2D = __decorateClass$c([
11167
11344
  customNode("Image2D")
11168
11345
  ], exports.Image2D);
11169
11346
 
@@ -11187,14 +11364,14 @@ class TextureRect2D extends exports.Element2D {
11187
11364
  }
11188
11365
  }
11189
11366
 
11190
- var __defProp$e = Object.defineProperty;
11191
- var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
11192
- var __decorateClass$i = (decorators, target, key, kind) => {
11193
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
11367
+ var __defProp$b = Object.defineProperty;
11368
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
11369
+ var __decorateClass$b = (decorators, target, key, kind) => {
11370
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
11194
11371
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11195
11372
  if (decorator = decorators[i])
11196
11373
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11197
- if (kind && result) __defProp$e(target, key, result);
11374
+ if (kind && result) __defProp$b(target, key, result);
11198
11375
  return result;
11199
11376
  };
11200
11377
  exports.Lottie2D = class Lottie2D extends TextureRect2D {
@@ -11237,20 +11414,20 @@ exports.Lottie2D = class Lottie2D extends TextureRect2D {
11237
11414
  super._process(delta);
11238
11415
  }
11239
11416
  };
11240
- __decorateClass$i([
11417
+ __decorateClass$b([
11241
11418
  modernIdoc.property({ fallback: "" })
11242
11419
  ], exports.Lottie2D.prototype, "src", 2);
11243
- exports.Lottie2D = __decorateClass$i([
11420
+ exports.Lottie2D = __decorateClass$b([
11244
11421
  customNode("Lottie2D")
11245
11422
  ], exports.Lottie2D);
11246
11423
 
11247
- var __defProp$d = Object.defineProperty;
11248
- var __decorateClass$h = (decorators, target, key, kind) => {
11424
+ var __defProp$a = Object.defineProperty;
11425
+ var __decorateClass$a = (decorators, target, key, kind) => {
11249
11426
  var result = void 0 ;
11250
11427
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11251
11428
  if (decorator = decorators[i])
11252
11429
  result = (decorator(target, key, result) ) || result;
11253
- if (result) __defProp$d(target, key, result);
11430
+ if (result) __defProp$a(target, key, result);
11254
11431
  return result;
11255
11432
  };
11256
11433
  class TransformRect2D extends exports.Element2D {
@@ -11296,18 +11473,18 @@ class TransformRect2D extends exports.Element2D {
11296
11473
  this._drawEllipse(width, height / 2);
11297
11474
  }
11298
11475
  }
11299
- __decorateClass$h([
11476
+ __decorateClass$a([
11300
11477
  modernIdoc.property({ fallback: 6 })
11301
11478
  ], TransformRect2D.prototype, "handleSize");
11302
11479
 
11303
- var __defProp$c = Object.defineProperty;
11304
- var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
11305
- var __decorateClass$g = (decorators, target, key, kind) => {
11306
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
11480
+ var __defProp$9 = Object.defineProperty;
11481
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
11482
+ var __decorateClass$9 = (decorators, target, key, kind) => {
11483
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
11307
11484
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11308
11485
  if (decorator = decorators[i])
11309
11486
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11310
- if (kind && result) __defProp$c(target, key, result);
11487
+ if (kind && result) __defProp$9(target, key, result);
11311
11488
  return result;
11312
11489
  };
11313
11490
  exports.Video2D = class Video2D extends TextureRect2D {
@@ -11360,21 +11537,21 @@ exports.Video2D = class Video2D extends TextureRect2D {
11360
11537
  super._process(delta);
11361
11538
  }
11362
11539
  };
11363
- __decorateClass$g([
11540
+ __decorateClass$9([
11364
11541
  modernIdoc.property({ fallback: "" })
11365
11542
  ], exports.Video2D.prototype, "src", 2);
11366
- exports.Video2D = __decorateClass$g([
11543
+ exports.Video2D = __decorateClass$9([
11367
11544
  customNode("Video2D")
11368
11545
  ], exports.Video2D);
11369
11546
 
11370
- var __defProp$b = Object.defineProperty;
11371
- var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
11372
- var __decorateClass$f = (decorators, target, key, kind) => {
11373
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
11547
+ var __defProp$8 = Object.defineProperty;
11548
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
11549
+ var __decorateClass$8 = (decorators, target, key, kind) => {
11550
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
11374
11551
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
11375
11552
  if (decorator = decorators[i])
11376
11553
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11377
- if (kind && result) __defProp$b(target, key, result);
11554
+ if (kind && result) __defProp$8(target, key, result);
11378
11555
  return result;
11379
11556
  };
11380
11557
  const linear = (amount) => amount;
@@ -11693,19 +11870,19 @@ exports.Animation = class Animation extends exports.TimelineNode {
11693
11870
  });
11694
11871
  }
11695
11872
  };
11696
- __decorateClass$f([
11873
+ __decorateClass$8([
11697
11874
  modernIdoc.property({ fallback: "parent" })
11698
11875
  ], exports.Animation.prototype, "effectMode", 2);
11699
- __decorateClass$f([
11876
+ __decorateClass$8([
11700
11877
  modernIdoc.property({ fallback: false })
11701
11878
  ], exports.Animation.prototype, "loop", 2);
11702
- __decorateClass$f([
11879
+ __decorateClass$8([
11703
11880
  modernIdoc.property({ default: () => [] })
11704
11881
  ], exports.Animation.prototype, "keyframes", 2);
11705
- __decorateClass$f([
11882
+ __decorateClass$8([
11706
11883
  modernIdoc.property()
11707
11884
  ], exports.Animation.prototype, "easing", 2);
11708
- exports.Animation = __decorateClass$f([
11885
+ exports.Animation = __decorateClass$8([
11709
11886
  customNode("Animation", {
11710
11887
  renderMode: "disabled",
11711
11888
  processMode: "pausable",
@@ -12586,11 +12763,11 @@ class WebAudio extends AudioPipeline {
12586
12763
  }
12587
12764
  }
12588
12765
 
12589
- var __defProp$a = Object.defineProperty;
12590
- var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
12591
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12592
- var __decorateClass$e = (decorators, target, key, kind) => {
12593
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
12766
+ var __defProp$7 = Object.defineProperty;
12767
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
12768
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12769
+ var __decorateClass$7 = (decorators, target, key, kind) => {
12770
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
12594
12771
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
12595
12772
  if (decorator = decorators[i])
12596
12773
  result = (decorator(result)) || result;
@@ -12801,7 +12978,7 @@ exports.Audio = class Audio extends exports.TimelineNode {
12801
12978
  }
12802
12979
  };
12803
12980
  __publicField$4(exports.Audio, "_soundPool", []);
12804
- exports.Audio = __decorateClass$e([
12981
+ exports.Audio = __decorateClass$7([
12805
12982
  customNode("Audio")
12806
12983
  ], exports.Audio);
12807
12984
 
@@ -12809,14 +12986,14 @@ class AudioSpectrum extends exports.Node2D {
12809
12986
  //
12810
12987
  }
12811
12988
 
12812
- var __defProp$9 = Object.defineProperty;
12813
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
12814
- var __decorateClass$d = (decorators, target, key, kind) => {
12815
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
12816
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
12989
+ var __defProp$6 = Object.defineProperty;
12990
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
12991
+ var __decorateClass$6 = (decorators, target, key, kind) => {
12992
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
12993
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
12817
12994
  if (decorator = decorators[i])
12818
12995
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12819
- if (kind && result) __defProp$9(target, key, result);
12996
+ if (kind && result) __defProp$6(target, key, result);
12820
12997
  return result;
12821
12998
  };
12822
12999
  exports.AudioWaveform = class AudioWaveform extends exports.Element2D {
@@ -12907,430 +13084,23 @@ exports.AudioWaveform = class AudioWaveform extends exports.Element2D {
12907
13084
  }
12908
13085
  }
12909
13086
  };
12910
- __decorateClass$d([
13087
+ __decorateClass$6([
12911
13088
  modernIdoc.property()
12912
13089
  ], exports.AudioWaveform.prototype, "src", 2);
12913
- __decorateClass$d([
13090
+ __decorateClass$6([
12914
13091
  modernIdoc.property({ fallback: 0 })
12915
13092
  ], exports.AudioWaveform.prototype, "gap", 2);
12916
- __decorateClass$d([
13093
+ __decorateClass$6([
12917
13094
  modernIdoc.property({ fallback: "#000000" })
12918
13095
  ], exports.AudioWaveform.prototype, "color", 2);
12919
- exports.AudioWaveform = __decorateClass$d([
13096
+ exports.AudioWaveform = __decorateClass$6([
12920
13097
  customNode("AudioWaveform")
12921
13098
  ], exports.AudioWaveform);
12922
13099
 
12923
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
12924
- var __decorateClass$c = (decorators, target, key, kind) => {
12925
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
12926
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
12927
- if (decorator = decorators[i])
12928
- result = (decorator(result)) || result;
12929
- return result;
12930
- };
12931
- exports.Control = class Control extends exports.Element2D {
12932
- constructor(properties, children = []) {
12933
- super();
12934
- this._parentUpdateRect = this._parentUpdateRect.bind(this);
12935
- this.setProperties(properties);
12936
- this.append(children);
12937
- }
12938
- _parented(parent) {
12939
- super._parented(parent);
12940
- parent.on("updateRect", this._parentUpdateRect);
12941
- }
12942
- _unparented(oldParent) {
12943
- super._unparented(oldParent);
12944
- oldParent.off("updateRect", this._parentUpdateRect);
12945
- }
12946
- _parentUpdateRect() {
12947
- const rect = this._parent.getRect();
12948
- this.style.left = rect.left;
12949
- this.style.top = rect.top;
12950
- this.style.width = rect.width;
12951
- this.style.height = rect.height;
12952
- }
12953
- _input(event, key) {
12954
- super._input(event, key);
12955
- this._guiInput(event, key);
12956
- }
12957
- _updateStyleProperty(key, value, oldValue) {
12958
- super._updateStyleProperty(key, value, oldValue);
12959
- switch (key) {
12960
- case "width":
12961
- case "height":
12962
- case "left":
12963
- case "top":
12964
- this.emit("updateRect");
12965
- break;
12966
- }
12967
- }
12968
- // eslint-disable-next-line unused-imports/no-unused-vars
12969
- _guiInput(event, key) {
12970
- }
12971
- };
12972
- exports.Control = __decorateClass$c([
12973
- customNode("Control")
12974
- ], exports.Control);
12975
-
12976
- var __defProp$8 = Object.defineProperty;
12977
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
12978
- var __decorateClass$b = (decorators, target, key, kind) => {
12979
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
12980
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
12981
- if (decorator = decorators[i])
12982
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12983
- if (kind && result) __defProp$8(target, key, result);
12984
- return result;
12985
- };
12986
- exports.Range = class Range extends exports.Control {
12987
- constructor(properties, children = []) {
12988
- super();
12989
- this.setProperties(properties).append(children);
12990
- }
12991
- _updateProperty(key, value, oldValue) {
12992
- super._updateProperty(key, value, oldValue);
12993
- switch (key) {
12994
- case "allowGreater":
12995
- case "allowLesser":
12996
- case "page":
12997
- case "minValue":
12998
- case "maxValue":
12999
- case "step":
13000
- case "value":
13001
- this.requestRedraw();
13002
- break;
13003
- }
13004
- }
13005
- };
13006
- __decorateClass$b([
13007
- modernIdoc.property({ fallback: false })
13008
- ], exports.Range.prototype, "allowGreater", 2);
13009
- __decorateClass$b([
13010
- modernIdoc.property({ fallback: false })
13011
- ], exports.Range.prototype, "allowLesser", 2);
13012
- __decorateClass$b([
13013
- modernIdoc.property({ fallback: 1 })
13014
- ], exports.Range.prototype, "page", 2);
13015
- __decorateClass$b([
13016
- modernIdoc.property({ fallback: 0 })
13017
- ], exports.Range.prototype, "minValue", 2);
13018
- __decorateClass$b([
13019
- modernIdoc.property({ fallback: 100 })
13020
- ], exports.Range.prototype, "maxValue", 2);
13021
- __decorateClass$b([
13022
- modernIdoc.property({ fallback: 0.01 })
13023
- ], exports.Range.prototype, "step", 2);
13024
- __decorateClass$b([
13025
- modernIdoc.property({ fallback: 0 })
13026
- ], exports.Range.prototype, "value", 2);
13027
- exports.Range = __decorateClass$b([
13028
- customNode("Range")
13029
- ], exports.Range);
13030
-
13031
- var __defProp$7 = Object.defineProperty;
13032
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
13033
- var __decorateClass$a = (decorators, target, key, kind) => {
13034
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
13035
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13036
- if (decorator = decorators[i])
13037
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13038
- if (kind && result) __defProp$7(target, key, result);
13039
- return result;
13040
- };
13041
- exports.Ruler = class Ruler extends exports.Control {
13042
- texture = new CanvasTexture();
13043
- constructor(properties, children = []) {
13044
- super();
13045
- this.setProperties(properties);
13046
- this.append(children);
13047
- }
13048
- _updateProperty(key, value, oldValue) {
13049
- super._updateProperty(key, value, oldValue);
13050
- switch (key) {
13051
- case "offsetX":
13052
- case "offsetY":
13053
- case "thickness":
13054
- case "markHeight":
13055
- case "color":
13056
- case "markBackgroundColor":
13057
- case "markColor":
13058
- case "gap":
13059
- case "scale":
13060
- this.requestRedraw();
13061
- break;
13062
- }
13063
- }
13064
- _updateStyleProperty(key, value, oldValue) {
13065
- super._updateStyleProperty(key, value, oldValue);
13066
- switch (key) {
13067
- case "width":
13068
- case "height":
13069
- this.texture[key] = value;
13070
- this.requestRedraw();
13071
- break;
13072
- }
13073
- }
13074
- _drawTexture() {
13075
- const { width, height } = this.size;
13076
- const {
13077
- offsetX,
13078
- offsetY,
13079
- thickness,
13080
- markHeight,
13081
- markBackgroundColor,
13082
- markColor,
13083
- color,
13084
- gap: _gap,
13085
- gapScale: _scale
13086
- } = this;
13087
- const canvas = this.texture.source;
13088
- const ctx = canvas.getContext("2d");
13089
- ctx.reset();
13090
- ctx.scale(this.texture.pixelRatio, this.texture.pixelRatio);
13091
- const x = Math.round(offsetX);
13092
- const y = Math.round(offsetY);
13093
- ctx.beginPath();
13094
- ctx.fillStyle = markBackgroundColor || "#EEE";
13095
- ctx.fillRect(0, 0, width, thickness);
13096
- ctx.fillRect(0, 0, thickness, height);
13097
- ctx.fill();
13098
- ctx.strokeStyle = markColor || "#000";
13099
- ctx.moveTo(thickness, 0);
13100
- ctx.lineTo(thickness, height);
13101
- ctx.moveTo(0, thickness);
13102
- ctx.lineTo(width, thickness);
13103
- ctx.stroke();
13104
- const originGap = _gap;
13105
- const curGap = _gap * _scale;
13106
- let scale;
13107
- let gap;
13108
- let markSize;
13109
- let axis;
13110
- let i;
13111
- if (originGap >= curGap) {
13112
- scale = originGap / curGap;
13113
- gap = Math.floor(scale) * originGap / 20;
13114
- markSize = originGap / 20 * Math.floor(scale) / scale;
13115
- } else {
13116
- scale = curGap / originGap;
13117
- gap = Math.floor(originGap / 20 / scale);
13118
- if (gap >= 2) {
13119
- gap = Math.floor(gap / 2) * 2;
13120
- } else {
13121
- gap = 1;
13122
- }
13123
- markSize = gap * scale;
13124
- }
13125
- ctx.fillStyle = ctx.strokeStyle;
13126
- for (axis = x, i = 0; axis < width; i++, axis += markSize) {
13127
- ctx.moveTo(axis, thickness - (i % 5 ? markHeight : 2 * markHeight));
13128
- ctx.lineTo(axis, thickness);
13129
- }
13130
- for (axis = x, i = 0; axis > thickness; i++, axis -= markSize) {
13131
- ctx.moveTo(axis, thickness - (i % 5 ? markHeight : 2 * markHeight));
13132
- ctx.lineTo(axis, thickness);
13133
- }
13134
- let textOffset = 0;
13135
- for (axis = y, i = 0; axis > thickness; i++, axis -= markSize) {
13136
- ctx.moveTo(thickness - (i % 5 ? markHeight : 2 * markHeight), axis);
13137
- ctx.lineTo(thickness, axis);
13138
- }
13139
- for (axis = y, i = 0; axis < height; i++, axis += markSize) {
13140
- ctx.moveTo(thickness - (i % 5 ? markHeight : 2 * markHeight), axis);
13141
- ctx.lineTo(thickness, axis);
13142
- }
13143
- ctx.save();
13144
- ctx.fillStyle = color;
13145
- ctx.scale(0.8, 0.8);
13146
- textOffset = thickness - 8;
13147
- for (axis = x, i = 0; axis < width; i++, axis += markSize) {
13148
- if (i % 10 === 0) {
13149
- ctx.fillText(String(Math.ceil(gap * i)), axis * 1.25 - 3, textOffset * 1.25);
13150
- }
13151
- }
13152
- for (axis = x, i = 0; axis > thickness; i++, axis -= markSize) {
13153
- if (i % 10 === 0) {
13154
- ctx.fillText(String(Math.ceil(-gap * i)), axis * 1.25 - 3, textOffset * 1.25);
13155
- }
13156
- }
13157
- textOffset = 0;
13158
- for (axis = y, i = 0; axis > thickness; i++, axis -= markSize) {
13159
- if (i % 10 === 0) {
13160
- ctx.fillText(String(Math.ceil(gap * i)), textOffset * 1.25, axis * 1.25 + 3);
13161
- }
13162
- }
13163
- for (axis = y, i = 0; axis < height; i++, axis += markSize) {
13164
- if (i % 10 === 0) {
13165
- ctx.fillText(String(Math.ceil(-gap * i)), textOffset * 1.25, axis * 1.25 + 3);
13166
- }
13167
- }
13168
- ctx.restore();
13169
- ctx.stroke();
13170
- this.texture.requestUpload();
13171
- }
13172
- _draw() {
13173
- this._drawTexture();
13174
- const texture = this.texture;
13175
- if (texture?.valid) {
13176
- this.context.fillStyle = texture;
13177
- this.context.uvTransform = new Transform2D().scale(
13178
- 1 / this.size.width,
13179
- 1 / this.size.height
13180
- );
13181
- this.context.rect(0, 0, texture.width, texture.height);
13182
- this.context.fill();
13183
- }
13184
- }
13185
- };
13186
- __decorateClass$a([
13187
- modernIdoc.property({ fallback: 0 })
13188
- ], exports.Ruler.prototype, "offsetX", 2);
13189
- __decorateClass$a([
13190
- modernIdoc.property({ fallback: 0 })
13191
- ], exports.Ruler.prototype, "offsetY", 2);
13192
- __decorateClass$a([
13193
- modernIdoc.property({ fallback: 20 })
13194
- ], exports.Ruler.prototype, "thickness", 2);
13195
- __decorateClass$a([
13196
- modernIdoc.property({ fallback: 3 })
13197
- ], exports.Ruler.prototype, "markHeight", 2);
13198
- __decorateClass$a([
13199
- modernIdoc.property({ fallback: "#b2b6bc" })
13200
- ], exports.Ruler.prototype, "color", 2);
13201
- __decorateClass$a([
13202
- modernIdoc.property({ fallback: "#f9f9fa" })
13203
- ], exports.Ruler.prototype, "markBackgroundColor", 2);
13204
- __decorateClass$a([
13205
- modernIdoc.property({ fallback: "#b2b6bc" })
13206
- ], exports.Ruler.prototype, "markColor", 2);
13207
- __decorateClass$a([
13208
- modernIdoc.property({ fallback: 300 })
13209
- ], exports.Ruler.prototype, "gap", 2);
13210
- __decorateClass$a([
13211
- modernIdoc.property({ fallback: 1 })
13212
- ], exports.Ruler.prototype, "gapScale", 2);
13213
- exports.Ruler = __decorateClass$a([
13214
- customNode("Ruler")
13215
- ], exports.Ruler);
13216
-
13217
- var __defProp$6 = Object.defineProperty;
13218
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
13219
- var __decorateClass$9 = (decorators, target, key, kind) => {
13220
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
13221
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13222
- if (decorator = decorators[i])
13223
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13224
- if (kind && result) __defProp$6(target, key, result);
13225
- return result;
13226
- };
13227
- exports.ScrollBar = class ScrollBar extends exports.Range {
13228
- constructor(properties, children = []) {
13229
- super();
13230
- this.setProperties(properties).append(children);
13231
- }
13232
- _updateStyleProperty(key, value, oldValue) {
13233
- super._updateStyleProperty(key, value, oldValue);
13234
- switch (key) {
13235
- case "width":
13236
- case "height":
13237
- case "left":
13238
- case "top":
13239
- this.requestRedraw();
13240
- break;
13241
- }
13242
- }
13243
- _rect() {
13244
- const { size, position } = this;
13245
- let left, top, width, height, radii;
13246
- if (this.direction === "vertical") {
13247
- width = 10;
13248
- height = size.height * (this.page / (this.maxValue - this.minValue));
13249
- left = position.left + size.width - width;
13250
- top = size.height * (this.value / (this.maxValue - this.minValue));
13251
- radii = width / 2;
13252
- } else {
13253
- width = size.width * (this.page / (this.maxValue - this.minValue));
13254
- height = 10;
13255
- left = size.width * (this.value / (this.maxValue - this.minValue));
13256
- top = position.top + size.height - height;
13257
- radii = height / 2;
13258
- }
13259
- return { left, top, width, height, radii };
13260
- }
13261
- _draw() {
13262
- const { left, top, width, height, radii } = this._rect();
13263
- this.context.roundRect(left, top, width, height, radii);
13264
- this.context.fillStyle = 34;
13265
- this.context.fill();
13266
- }
13267
- _pointerInput(point, key) {
13268
- const { left, top, width, height } = this._rect();
13269
- const flag = point.x >= left && point.x < left + width && point.y >= top && point.y < top + height;
13270
- switch (key) {
13271
- case "pointerdown":
13272
- case "pointermove":
13273
- if (flag) {
13274
- this._tree?.input.setCursor("pointer");
13275
- } else {
13276
- this._tree?.input.setCursor(void 0);
13277
- }
13278
- break;
13279
- }
13280
- return false;
13281
- }
13282
- };
13283
- __decorateClass$9([
13284
- modernIdoc.property({ fallback: "vertical" })
13285
- ], exports.ScrollBar.prototype, "direction", 2);
13286
- exports.ScrollBar = __decorateClass$9([
13287
- customNode("ScrollBar")
13288
- ], exports.ScrollBar);
13289
-
13290
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
13291
- var __decorateClass$8 = (decorators, target, key, kind) => {
13292
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
13293
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13294
- if (decorator = decorators[i])
13295
- result = (decorator(result)) || result;
13296
- return result;
13297
- };
13298
- exports.XScrollBar = class XScrollBar extends exports.ScrollBar {
13299
- constructor(properties, children = []) {
13300
- super();
13301
- this.setProperties(properties).append(children);
13302
- }
13303
- };
13304
- exports.XScrollBar = __decorateClass$8([
13305
- customNode("XScrollBar", {
13306
- direction: "horizontal"
13307
- })
13308
- ], exports.XScrollBar);
13309
-
13310
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
13311
- var __decorateClass$7 = (decorators, target, key, kind) => {
13312
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
13313
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
13314
- if (decorator = decorators[i])
13315
- result = (decorator(result)) || result;
13316
- return result;
13317
- };
13318
- exports.YScrollBar = class YScrollBar extends exports.ScrollBar {
13319
- constructor(properties, children = []) {
13320
- super();
13321
- this.setProperties(properties).append(children);
13322
- }
13323
- };
13324
- exports.YScrollBar = __decorateClass$7([
13325
- customNode("YScrollBar", {
13326
- direction: "vertical"
13327
- })
13328
- ], exports.YScrollBar);
13329
-
13330
13100
  var __defProp$5 = Object.defineProperty;
13331
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
13332
- var __decorateClass$6 = (decorators, target, key, kind) => {
13333
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
13101
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
13102
+ var __decorateClass$5 = (decorators, target, key, kind) => {
13103
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
13334
13104
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13335
13105
  if (decorator = decorators[i])
13336
13106
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
@@ -13395,22 +13165,22 @@ exports.Scaler = class Scaler extends exports.Node {
13395
13165
  }
13396
13166
  }
13397
13167
  };
13398
- __decorateClass$6([
13168
+ __decorateClass$5([
13399
13169
  modernIdoc.property({ default: 1 })
13400
13170
  ], exports.Scaler.prototype, "translateX", 2);
13401
- __decorateClass$6([
13171
+ __decorateClass$5([
13402
13172
  modernIdoc.property({ default: 1 })
13403
13173
  ], exports.Scaler.prototype, "translateY", 2);
13404
- __decorateClass$6([
13174
+ __decorateClass$5([
13405
13175
  modernIdoc.property({ default: 1 })
13406
13176
  ], exports.Scaler.prototype, "scale", 2);
13407
- __decorateClass$6([
13177
+ __decorateClass$5([
13408
13178
  modernIdoc.property({ default: 0.05 })
13409
13179
  ], exports.Scaler.prototype, "minScale", 2);
13410
- __decorateClass$6([
13180
+ __decorateClass$5([
13411
13181
  modernIdoc.property({ default: 10 })
13412
13182
  ], exports.Scaler.prototype, "maxScale", 2);
13413
- exports.Scaler = __decorateClass$6([
13183
+ exports.Scaler = __decorateClass$5([
13414
13184
  customNode("Scaler", {
13415
13185
  processMode: "disabled",
13416
13186
  renderMode: "disabled"
@@ -13418,10 +13188,10 @@ exports.Scaler = __decorateClass$6([
13418
13188
  ], exports.Scaler);
13419
13189
 
13420
13190
  var __defProp$4 = Object.defineProperty;
13421
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
13191
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
13422
13192
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13423
- var __decorateClass$5 = (decorators, target, key, kind) => {
13424
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
13193
+ var __decorateClass$4 = (decorators, target, key, kind) => {
13194
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
13425
13195
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13426
13196
  if (decorator = decorators[i])
13427
13197
  result = (decorator(result)) || result;
@@ -13509,15 +13279,15 @@ void main(void) {
13509
13279
  gl_FragColor = color;
13510
13280
  }`
13511
13281
  }));
13512
- exports.KawaseTransition = __decorateClass$5([
13282
+ exports.KawaseTransition = __decorateClass$4([
13513
13283
  customNode("KawaseTransition")
13514
13284
  ], exports.KawaseTransition);
13515
13285
 
13516
13286
  var __defProp$3 = Object.defineProperty;
13517
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
13287
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
13518
13288
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13519
- var __decorateClass$4 = (decorators, target, key, kind) => {
13520
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
13289
+ var __decorateClass$3 = (decorators, target, key, kind) => {
13290
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
13521
13291
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13522
13292
  if (decorator = decorators[i])
13523
13293
  result = (decorator(result)) || result;
@@ -13562,15 +13332,15 @@ void main() {
13562
13332
  gl_FragColor = mix(src2Color, src1Color, mixPercent);
13563
13333
  }`
13564
13334
  }));
13565
- exports.LeftEraseTransition = __decorateClass$4([
13335
+ exports.LeftEraseTransition = __decorateClass$3([
13566
13336
  customNode("LeftEraseTransition")
13567
13337
  ], exports.LeftEraseTransition);
13568
13338
 
13569
13339
  var __defProp$2 = Object.defineProperty;
13570
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
13340
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
13571
13341
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13572
- var __decorateClass$3 = (decorators, target, key, kind) => {
13573
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
13342
+ var __decorateClass$2 = (decorators, target, key, kind) => {
13343
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
13574
13344
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13575
13345
  if (decorator = decorators[i])
13576
13346
  result = (decorator(result)) || result;
@@ -13669,15 +13439,15 @@ void main(void) {
13669
13439
  gl_FragColor = color;
13670
13440
  }`
13671
13441
  }));
13672
- exports.TiltShiftTransition = __decorateClass$3([
13442
+ exports.TiltShiftTransition = __decorateClass$2([
13673
13443
  customNode("TiltShiftTransition")
13674
13444
  ], exports.TiltShiftTransition);
13675
13445
 
13676
13446
  var __defProp$1 = Object.defineProperty;
13677
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
13447
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13678
13448
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13679
- var __decorateClass$2 = (decorators, target, key, kind) => {
13680
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
13449
+ var __decorateClass$1 = (decorators, target, key, kind) => {
13450
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
13681
13451
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
13682
13452
  if (decorator = decorators[i])
13683
13453
  result = (decorator(result)) || result;
@@ -13763,7 +13533,7 @@ void main(void) {
13763
13533
  gl_FragColor = texture2D(sampler, coord);
13764
13534
  }`
13765
13535
  }));
13766
- exports.TwistTransition = __decorateClass$2([
13536
+ exports.TwistTransition = __decorateClass$1([
13767
13537
  customNode("TwistTransition")
13768
13538
  ], exports.TwistTransition);
13769
13539
 
@@ -14127,220 +13897,6 @@ class Assets {
14127
13897
  }
14128
13898
  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());
14129
13899
 
14130
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14131
- var __decorateClass$1 = (decorators, target, key, kind) => {
14132
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14133
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
14134
- if (decorator = decorators[i])
14135
- result = (decorator(result)) || result;
14136
- return result;
14137
- };
14138
- exports.CanvasItemEditor = class CanvasItemEditor extends exports.Control {
14139
- _pointerStart;
14140
- _pointerOffset;
14141
- selected;
14142
- dragging;
14143
- hovered;
14144
- hover = new exports.Element2D({
14145
- name: "hover",
14146
- internalMode: "back",
14147
- style: {
14148
- visibility: "hidden",
14149
- outlineStyle: "solid",
14150
- outlineColor: "#00FF00FF",
14151
- outlineWidth: 2,
14152
- pointerEvents: "none"
14153
- }
14154
- });
14155
- transformRect = new TransformRect2D({
14156
- name: "transformRect",
14157
- internalMode: "back",
14158
- style: {
14159
- visibility: "hidden",
14160
- pointerEvents: "none"
14161
- }
14162
- });
14163
- scaler = new exports.Scaler({
14164
- name: "Scaler",
14165
- internalMode: "back"
14166
- }).on("updateScale", (scale) => {
14167
- this.ruler.gapScale = scale;
14168
- this._updateScrollbars();
14169
- this._updateSelectionRect();
14170
- });
14171
- xScrollBar = new exports.XScrollBar({
14172
- name: "XScrollBar",
14173
- internalMode: "back",
14174
- style: {
14175
- visibility: "hidden"
14176
- }
14177
- });
14178
- yScrollBar = new exports.YScrollBar({
14179
- name: "yScrollBar",
14180
- internalMode: "back",
14181
- style: {
14182
- visibility: "hidden"
14183
- }
14184
- });
14185
- drawboard = new exports.Element2D({
14186
- name: "drawboard",
14187
- style: {
14188
- width: 500,
14189
- height: 500,
14190
- backgroundColor: "#00FFFFFF",
14191
- // overflow: 'hidden',
14192
- pointerEvents: "none"
14193
- // boxShadow: '2px 2px 2px 1px rgba(0, 0, 0, 0.2)',
14194
- }
14195
- }, [
14196
- this.scaler
14197
- ]);
14198
- ruler = new exports.Ruler({
14199
- name: "ruler",
14200
- offsetX: 100,
14201
- offsetY: 100,
14202
- style: {
14203
- pointerEvents: "none"
14204
- }
14205
- }, [
14206
- this.drawboard,
14207
- this.hover,
14208
- this.transformRect,
14209
- this.xScrollBar,
14210
- this.yScrollBar
14211
- ]);
14212
- constructor() {
14213
- super();
14214
- this._onPointerdown = this._onPointerdown.bind(this);
14215
- this._onPointermove = this._onPointermove.bind(this);
14216
- this._onPointerup = this._onPointerup.bind(this);
14217
- this.append(this.ruler);
14218
- }
14219
- _updateStyleProperty(key, value, oldValue) {
14220
- super._updateStyleProperty(key, value, oldValue);
14221
- switch (key) {
14222
- case "width":
14223
- this.drawboard.style.left = (this.size.width - this.drawboard.size.width) / 2;
14224
- this.ruler.offsetX = this.drawboard.style.left;
14225
- break;
14226
- case "height":
14227
- this.drawboard.style.top = (this.size.height - this.drawboard.size.height) / 2;
14228
- this.ruler.offsetY = this.drawboard.style.top;
14229
- break;
14230
- }
14231
- }
14232
- _guiInput(event, key) {
14233
- super._guiInput(event, key);
14234
- switch (key) {
14235
- case "pointerdown":
14236
- this._onPointerdown(event);
14237
- break;
14238
- case "pointermove":
14239
- this._onPointermove(event);
14240
- break;
14241
- case "pointerup":
14242
- this._onPointerup();
14243
- break;
14244
- }
14245
- }
14246
- _onPointerdown(e) {
14247
- let target = e.target;
14248
- if (target?.equal(this)) {
14249
- target = void 0;
14250
- }
14251
- if (target?.equal(this.transformRect)) {
14252
- target = this.selected;
14253
- }
14254
- this._pointerOffset = { x: e.offsetX, y: e.offsetY };
14255
- this.selected = target;
14256
- this.dragging = target;
14257
- if (target instanceof exports.Element2D) {
14258
- this._pointerStart = target.style.clone();
14259
- } else {
14260
- this._pointerStart = void 0;
14261
- }
14262
- this._updateHover();
14263
- this._updateSelectionRect();
14264
- }
14265
- _onPointermove(e) {
14266
- let target = e.target;
14267
- if (target?.equal(this)) {
14268
- target = void 0;
14269
- }
14270
- if (target?.equal(this.transformRect)) {
14271
- target = this.selected;
14272
- }
14273
- const { selected, dragging, _pointerStart, _pointerOffset } = this;
14274
- if (selected && target?.equal(selected)) {
14275
- this.hovered = void 0;
14276
- } else {
14277
- this.hovered = target;
14278
- }
14279
- const offset = _pointerOffset ? { x: e.offsetX - _pointerOffset.x, y: e.offsetY - _pointerOffset.y } : { x: 0, y: 0 };
14280
- if (dragging && _pointerStart) {
14281
- dragging.style.left = _pointerStart.left + offset.x / this.scaler.scale;
14282
- dragging.style.top = _pointerStart.top + offset.y / this.scaler.scale;
14283
- dragging.update();
14284
- }
14285
- this._updateHover();
14286
- this._updateSelectionRect();
14287
- }
14288
- _onPointerup() {
14289
- this.dragging = void 0;
14290
- this._updateHover();
14291
- this._updateSelectionRect();
14292
- }
14293
- _copyGlobalTransform(a, b) {
14294
- a.style.visibility = "visible";
14295
- a.style.width = b.globalScale.x * b.size.x;
14296
- a.style.height = b.globalScale.y * b.size.y;
14297
- a.style.left = b.globalPosition.x;
14298
- a.style.top = b.globalPosition.y;
14299
- a.style.rotate = b.globalRotation;
14300
- a.update();
14301
- }
14302
- _updateHover() {
14303
- const hovered = this.hovered;
14304
- if (hovered instanceof exports.Element2D) {
14305
- this.hover.style.visibility = "visible";
14306
- this._copyGlobalTransform(this.hover, hovered);
14307
- this.hover.requestRedraw();
14308
- } else {
14309
- this.hover.style.visibility = "hidden";
14310
- }
14311
- }
14312
- _updateSelectionRect() {
14313
- if (this.selected) {
14314
- this.transformRect.style.visibility = "visible";
14315
- this._copyGlobalTransform(this.transformRect, this.selected);
14316
- } else {
14317
- this.transformRect.style.visibility = "hidden";
14318
- }
14319
- }
14320
- _updateScrollbars() {
14321
- const scale = this.ruler.gapScale;
14322
- const scrollHeight = this.drawboard.size.height * scale;
14323
- const scrollWidth = this.drawboard.size.width * scale;
14324
- if (scrollHeight > this.size.height) {
14325
- this.yScrollBar.style.visibility = "visible";
14326
- this.yScrollBar.maxValue = scrollHeight;
14327
- this.yScrollBar.page = this.size.height;
14328
- } else {
14329
- this.yScrollBar.style.visibility = "hidden";
14330
- }
14331
- if (scrollWidth > this.size.width) {
14332
- this.xScrollBar.style.visibility = "visible";
14333
- this.xScrollBar.maxValue = scrollWidth;
14334
- this.xScrollBar.page = this.size.width;
14335
- } else {
14336
- this.xScrollBar.style.visibility = "hidden";
14337
- }
14338
- }
14339
- };
14340
- exports.CanvasItemEditor = __decorateClass$1([
14341
- customNode("CanvasItemEditor")
14342
- ], exports.CanvasItemEditor);
14343
-
14344
13900
  var __defProp = Object.defineProperty;
14345
13901
  var __decorateClass = (decorators, target, key, kind) => {
14346
13902
  var result = void 0 ;
@@ -14577,6 +14133,7 @@ async function start(sleep = 100) {
14577
14133
  async function task(options) {
14578
14134
  const { debug = false, fonts, width, height, time = 0, data } = options;
14579
14135
  engine ??= new Engine({
14136
+ pixelRatio: 1,
14580
14137
  width: 1,
14581
14138
  height: 1,
14582
14139
  preserveDrawingBuffer: true