modern-canvas 0.4.21 → 0.4.23

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
@@ -2,10 +2,10 @@
2
2
 
3
3
  const colord = require('colord');
4
4
  const namesPlugin = require('colord/plugins/names');
5
- const modernIdoc = require('modern-idoc');
6
5
  const modernPath2d = require('modern-path2d');
7
- const load = require('yoga-layout/load');
6
+ const modernIdoc = require('modern-idoc');
8
7
  const modernText = require('modern-text');
8
+ const load = require('yoga-layout/load');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
11
11
 
@@ -2155,13 +2155,13 @@ class Vector3 extends Vector {
2155
2155
  }
2156
2156
  }
2157
2157
 
2158
- var __defProp$J = Object.defineProperty;
2159
- var __decorateClass$R = (decorators, target, key, kind) => {
2158
+ var __defProp$O = Object.defineProperty;
2159
+ var __decorateClass$W = (decorators, target, key, kind) => {
2160
2160
  var result = void 0 ;
2161
2161
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
2162
2162
  if (decorator = decorators[i])
2163
2163
  result = (decorator(target, key, result) ) || result;
2164
- if (result) __defProp$J(target, key, result);
2164
+ if (result) __defProp$O(target, key, result);
2165
2165
  return result;
2166
2166
  };
2167
2167
  class MainLoop extends CoreObject {
@@ -2204,10 +2204,10 @@ class MainLoop extends CoreObject {
2204
2204
  this.stop();
2205
2205
  }
2206
2206
  }
2207
- __decorateClass$R([
2207
+ __decorateClass$W([
2208
2208
  property({ default: 24 })
2209
2209
  ], MainLoop.prototype, "fps");
2210
- __decorateClass$R([
2210
+ __decorateClass$W([
2211
2211
  property({ default: 1 })
2212
2212
  ], MainLoop.prototype, "speed");
2213
2213
 
@@ -4509,13 +4509,13 @@ class Geometry extends Resource {
4509
4509
  }
4510
4510
  }
4511
4511
 
4512
- var __defProp$I = Object.defineProperty;
4513
- var __decorateClass$Q = (decorators, target, key, kind) => {
4512
+ var __defProp$N = Object.defineProperty;
4513
+ var __decorateClass$V = (decorators, target, key, kind) => {
4514
4514
  var result = void 0 ;
4515
4515
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4516
4516
  if (decorator = decorators[i])
4517
4517
  result = (decorator(target, key, result) ) || result;
4518
- if (result) __defProp$I(target, key, result);
4518
+ if (result) __defProp$N(target, key, result);
4519
4519
  return result;
4520
4520
  };
4521
4521
  class IndexBuffer extends Resource {
@@ -4559,20 +4559,20 @@ class IndexBuffer extends Resource {
4559
4559
  return result;
4560
4560
  }
4561
4561
  }
4562
- __decorateClass$Q([
4562
+ __decorateClass$V([
4563
4563
  protectedProperty({ default: null })
4564
4564
  ], IndexBuffer.prototype, "data");
4565
- __decorateClass$Q([
4565
+ __decorateClass$V([
4566
4566
  protectedProperty({ default: false })
4567
4567
  ], IndexBuffer.prototype, "dynamic");
4568
4568
 
4569
- var __defProp$H = Object.defineProperty;
4570
- var __decorateClass$P = (decorators, target, key, kind) => {
4569
+ var __defProp$M = Object.defineProperty;
4570
+ var __decorateClass$U = (decorators, target, key, kind) => {
4571
4571
  var result = void 0 ;
4572
4572
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4573
4573
  if (decorator = decorators[i])
4574
4574
  result = (decorator(target, key, result) ) || result;
4575
- if (result) __defProp$H(target, key, result);
4575
+ if (result) __defProp$M(target, key, result);
4576
4576
  return result;
4577
4577
  };
4578
4578
  class VertexBuffer extends Resource {
@@ -4616,20 +4616,20 @@ class VertexBuffer extends Resource {
4616
4616
  return result;
4617
4617
  }
4618
4618
  }
4619
- __decorateClass$P([
4619
+ __decorateClass$U([
4620
4620
  protectedProperty({ default: null })
4621
4621
  ], VertexBuffer.prototype, "data");
4622
- __decorateClass$P([
4622
+ __decorateClass$U([
4623
4623
  protectedProperty({ default: false })
4624
4624
  ], VertexBuffer.prototype, "dynamic");
4625
4625
 
4626
- var __defProp$G = Object.defineProperty;
4627
- var __decorateClass$O = (decorators, target, key, kind) => {
4626
+ var __defProp$L = Object.defineProperty;
4627
+ var __decorateClass$T = (decorators, target, key, kind) => {
4628
4628
  var result = void 0 ;
4629
4629
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4630
4630
  if (decorator = decorators[i])
4631
4631
  result = (decorator(target, key, result) ) || result;
4632
- if (result) __defProp$G(target, key, result);
4632
+ if (result) __defProp$L(target, key, result);
4633
4633
  return result;
4634
4634
  };
4635
4635
  class VertexAttribute extends Resource {
@@ -4666,25 +4666,25 @@ class VertexAttribute extends Resource {
4666
4666
  return result;
4667
4667
  }
4668
4668
  }
4669
- __decorateClass$O([
4669
+ __decorateClass$T([
4670
4670
  protectedProperty()
4671
4671
  ], VertexAttribute.prototype, "buffer");
4672
- __decorateClass$O([
4672
+ __decorateClass$T([
4673
4673
  protectedProperty({ default: 0 })
4674
4674
  ], VertexAttribute.prototype, "size");
4675
- __decorateClass$O([
4675
+ __decorateClass$T([
4676
4676
  protectedProperty({ default: false })
4677
4677
  ], VertexAttribute.prototype, "normalized");
4678
- __decorateClass$O([
4678
+ __decorateClass$T([
4679
4679
  protectedProperty({ default: "float" })
4680
4680
  ], VertexAttribute.prototype, "type");
4681
- __decorateClass$O([
4681
+ __decorateClass$T([
4682
4682
  protectedProperty()
4683
4683
  ], VertexAttribute.prototype, "stride");
4684
- __decorateClass$O([
4684
+ __decorateClass$T([
4685
4685
  protectedProperty()
4686
4686
  ], VertexAttribute.prototype, "offset");
4687
- __decorateClass$O([
4687
+ __decorateClass$T([
4688
4688
  protectedProperty()
4689
4689
  ], VertexAttribute.prototype, "divisor");
4690
4690
 
@@ -4928,13 +4928,13 @@ class UvGeometry extends Geometry {
4928
4928
  }
4929
4929
  }
4930
4930
 
4931
- var __defProp$F = Object.defineProperty;
4932
- var __decorateClass$N = (decorators, target, key, kind) => {
4931
+ var __defProp$K = Object.defineProperty;
4932
+ var __decorateClass$S = (decorators, target, key, kind) => {
4933
4933
  var result = void 0 ;
4934
4934
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
4935
4935
  if (decorator = decorators[i])
4936
4936
  result = (decorator(target, key, result) ) || result;
4937
- if (result) __defProp$F(target, key, result);
4937
+ if (result) __defProp$K(target, key, result);
4938
4938
  return result;
4939
4939
  };
4940
4940
  class Texture2D extends Resource {
@@ -5060,22 +5060,22 @@ class Texture2D extends Resource {
5060
5060
  }
5061
5061
  }
5062
5062
  }
5063
- __decorateClass$N([
5063
+ __decorateClass$S([
5064
5064
  protectedProperty()
5065
5065
  ], Texture2D.prototype, "source");
5066
- __decorateClass$N([
5066
+ __decorateClass$S([
5067
5067
  property({ default: 0 })
5068
5068
  ], Texture2D.prototype, "width");
5069
- __decorateClass$N([
5069
+ __decorateClass$S([
5070
5070
  property({ default: 0 })
5071
5071
  ], Texture2D.prototype, "height");
5072
- __decorateClass$N([
5072
+ __decorateClass$S([
5073
5073
  property({ default: "linear" })
5074
5074
  ], Texture2D.prototype, "filterMode");
5075
- __decorateClass$N([
5075
+ __decorateClass$S([
5076
5076
  property({ default: "clamp_to_edge" })
5077
5077
  ], Texture2D.prototype, "wrapMode");
5078
- __decorateClass$N([
5078
+ __decorateClass$S([
5079
5079
  property({ default: 1 })
5080
5080
  ], Texture2D.prototype, "pixelRatio");
5081
5081
 
@@ -5105,13 +5105,13 @@ class AnimatedTexture extends Resource {
5105
5105
  }
5106
5106
  }
5107
5107
 
5108
- var __defProp$E = Object.defineProperty;
5109
- var __decorateClass$M = (decorators, target, key, kind) => {
5108
+ var __defProp$J = Object.defineProperty;
5109
+ var __decorateClass$R = (decorators, target, key, kind) => {
5110
5110
  var result = void 0 ;
5111
5111
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5112
5112
  if (decorator = decorators[i])
5113
5113
  result = (decorator(target, key, result) ) || result;
5114
- if (result) __defProp$E(target, key, result);
5114
+ if (result) __defProp$J(target, key, result);
5115
5115
  return result;
5116
5116
  };
5117
5117
  class CanvasTexture extends Texture2D {
@@ -5130,7 +5130,7 @@ class CanvasTexture extends Texture2D {
5130
5130
  super._updateProperty(key, value, oldValue, declaration);
5131
5131
  }
5132
5132
  }
5133
- __decorateClass$M([
5133
+ __decorateClass$R([
5134
5134
  property({ default: 2 })
5135
5135
  ], CanvasTexture.prototype, "pixelRatio");
5136
5136
 
@@ -5292,13 +5292,13 @@ class PixelsTexture extends Texture2D {
5292
5292
  }
5293
5293
  }
5294
5294
 
5295
- var __defProp$D = Object.defineProperty;
5296
- var __decorateClass$L = (decorators, target, key, kind) => {
5295
+ var __defProp$I = Object.defineProperty;
5296
+ var __decorateClass$Q = (decorators, target, key, kind) => {
5297
5297
  var result = void 0 ;
5298
5298
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5299
5299
  if (decorator = decorators[i])
5300
5300
  result = (decorator(target, key, result) ) || result;
5301
- if (result) __defProp$D(target, key, result);
5301
+ if (result) __defProp$I(target, key, result);
5302
5302
  return result;
5303
5303
  };
5304
5304
  function resolveOptions(options) {
@@ -5542,10 +5542,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
5542
5542
  }
5543
5543
  }
5544
5544
  };
5545
- __decorateClass$L([
5545
+ __decorateClass$Q([
5546
5546
  protectedProperty({ default: true })
5547
5547
  ], _VideoTexture.prototype, "autoUpdate");
5548
- __decorateClass$L([
5548
+ __decorateClass$Q([
5549
5549
  protectedProperty({ default: 0 })
5550
5550
  ], _VideoTexture.prototype, "fps");
5551
5551
  let VideoTexture = _VideoTexture;
@@ -5554,14 +5554,14 @@ class ViewportTexture extends PixelsTexture {
5554
5554
  //
5555
5555
  }
5556
5556
 
5557
- var __defProp$C = Object.defineProperty;
5557
+ var __defProp$H = Object.defineProperty;
5558
5558
  var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
5559
- var __decorateClass$K = (decorators, target, key, kind) => {
5559
+ var __decorateClass$P = (decorators, target, key, kind) => {
5560
5560
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$I(target, key) : target;
5561
5561
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
5562
5562
  if (decorator = decorators[i])
5563
5563
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5564
- if (kind && result) __defProp$C(target, key, result);
5564
+ if (kind && result) __defProp$H(target, key, result);
5565
5565
  return result;
5566
5566
  };
5567
5567
  const tagUidMap = {};
@@ -5738,11 +5738,9 @@ exports.Node = class Node extends CoreObject {
5738
5738
  }
5739
5739
  }
5740
5740
  _update(changed) {
5741
- this._tree?.log(this.name, "updating");
5742
5741
  super._update(changed);
5743
5742
  }
5744
5743
  _updateProperty(key, value, oldValue, declaration) {
5745
- this._tree?.log(this.name, `updating [${String(key)}]`);
5746
5744
  super._updateProperty(key, value, oldValue, declaration);
5747
5745
  }
5748
5746
  _onTreeEnter(tree) {
@@ -6066,36 +6064,36 @@ exports.Node = class Node extends CoreObject {
6066
6064
  return node;
6067
6065
  }
6068
6066
  };
6069
- __decorateClass$K([
6067
+ __decorateClass$P([
6070
6068
  protectedProperty()
6071
6069
  ], exports.Node.prototype, "name", 2);
6072
- __decorateClass$K([
6070
+ __decorateClass$P([
6073
6071
  property()
6074
6072
  ], exports.Node.prototype, "mask", 2);
6075
- __decorateClass$K([
6073
+ __decorateClass$P([
6076
6074
  property({ default: "inherit" })
6077
6075
  ], exports.Node.prototype, "processMode", 2);
6078
- __decorateClass$K([
6076
+ __decorateClass$P([
6079
6077
  property({ default: "default" })
6080
6078
  ], exports.Node.prototype, "processSortMode", 2);
6081
- __decorateClass$K([
6079
+ __decorateClass$P([
6082
6080
  property({ default: "inherit" })
6083
6081
  ], exports.Node.prototype, "renderMode", 2);
6084
- __decorateClass$K([
6082
+ __decorateClass$P([
6085
6083
  property({ default: "default" })
6086
6084
  ], exports.Node.prototype, "internalMode", 2);
6087
- exports.Node = __decorateClass$K([
6085
+ exports.Node = __decorateClass$P([
6088
6086
  customNode("Node")
6089
6087
  ], exports.Node);
6090
6088
 
6091
- var __defProp$B = Object.defineProperty;
6089
+ var __defProp$G = Object.defineProperty;
6092
6090
  var __getOwnPropDesc$H = Object.getOwnPropertyDescriptor;
6093
- var __decorateClass$J = (decorators, target, key, kind) => {
6091
+ var __decorateClass$O = (decorators, target, key, kind) => {
6094
6092
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$H(target, key) : target;
6095
6093
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6096
6094
  if (decorator = decorators[i])
6097
6095
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6098
- if (kind && result) __defProp$B(target, key, result);
6096
+ if (kind && result) __defProp$G(target, key, result);
6099
6097
  return result;
6100
6098
  };
6101
6099
  exports.TimelineNode = class TimelineNode extends exports.Node {
@@ -6155,30 +6153,30 @@ exports.TimelineNode = class TimelineNode extends exports.Node {
6155
6153
  this._updateCurrentTime();
6156
6154
  }
6157
6155
  };
6158
- __decorateClass$J([
6156
+ __decorateClass$O([
6159
6157
  property({ default: 0 })
6160
6158
  ], exports.TimelineNode.prototype, "delay", 2);
6161
- __decorateClass$J([
6159
+ __decorateClass$O([
6162
6160
  property({ default: 0 })
6163
6161
  ], exports.TimelineNode.prototype, "duration", 2);
6164
- __decorateClass$J([
6162
+ __decorateClass$O([
6165
6163
  property({ default: false })
6166
6164
  ], exports.TimelineNode.prototype, "paused", 2);
6167
- __decorateClass$J([
6165
+ __decorateClass$O([
6168
6166
  protectedProperty()
6169
6167
  ], exports.TimelineNode.prototype, "insideTimeRange", 2);
6170
- exports.TimelineNode = __decorateClass$J([
6168
+ exports.TimelineNode = __decorateClass$O([
6171
6169
  customNode("TimelineNode")
6172
6170
  ], exports.TimelineNode);
6173
6171
 
6174
- var __defProp$A = Object.defineProperty;
6172
+ var __defProp$F = Object.defineProperty;
6175
6173
  var __getOwnPropDesc$G = Object.getOwnPropertyDescriptor;
6176
- var __decorateClass$I = (decorators, target, key, kind) => {
6174
+ var __decorateClass$N = (decorators, target, key, kind) => {
6177
6175
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$G(target, key) : target;
6178
6176
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6179
6177
  if (decorator = decorators[i])
6180
6178
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6181
- if (kind && result) __defProp$A(target, key, result);
6179
+ if (kind && result) __defProp$F(target, key, result);
6182
6180
  return result;
6183
6181
  };
6184
6182
  exports.Viewport = class Viewport extends exports.Node {
@@ -6316,30 +6314,30 @@ exports.Viewport = class Viewport extends exports.Node {
6316
6314
  return this._projection.toArray(transpose);
6317
6315
  }
6318
6316
  };
6319
- __decorateClass$I([
6317
+ __decorateClass$N([
6320
6318
  property({ default: 0 })
6321
6319
  ], exports.Viewport.prototype, "x", 2);
6322
- __decorateClass$I([
6320
+ __decorateClass$N([
6323
6321
  property({ default: 0 })
6324
6322
  ], exports.Viewport.prototype, "y", 2);
6325
- __decorateClass$I([
6323
+ __decorateClass$N([
6326
6324
  property({ default: 0 })
6327
6325
  ], exports.Viewport.prototype, "width", 2);
6328
- __decorateClass$I([
6326
+ __decorateClass$N([
6329
6327
  property({ default: 0 })
6330
6328
  ], exports.Viewport.prototype, "height", 2);
6331
- exports.Viewport = __decorateClass$I([
6329
+ exports.Viewport = __decorateClass$N([
6332
6330
  customNode("Viewport")
6333
6331
  ], exports.Viewport);
6334
6332
 
6335
- var __defProp$z = Object.defineProperty;
6333
+ var __defProp$E = Object.defineProperty;
6336
6334
  var __getOwnPropDesc$F = Object.getOwnPropertyDescriptor;
6337
- var __decorateClass$H = (decorators, target, key, kind) => {
6335
+ var __decorateClass$M = (decorators, target, key, kind) => {
6338
6336
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$F(target, key) : target;
6339
6337
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6340
6338
  if (decorator = decorators[i])
6341
6339
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6342
- if (kind && result) __defProp$z(target, key, result);
6340
+ if (kind && result) __defProp$E(target, key, result);
6343
6341
  return result;
6344
6342
  };
6345
6343
  exports.Effect = class Effect extends exports.TimelineNode {
@@ -6580,151 +6578,34 @@ exports.Effect = class Effect extends exports.TimelineNode {
6580
6578
  }
6581
6579
  }
6582
6580
  };
6583
- __decorateClass$H([
6581
+ __decorateClass$M([
6584
6582
  protectedProperty()
6585
6583
  ], exports.Effect.prototype, "material", 2);
6586
- __decorateClass$H([
6584
+ __decorateClass$M([
6587
6585
  property()
6588
6586
  ], exports.Effect.prototype, "effectMode", 2);
6589
- __decorateClass$H([
6587
+ __decorateClass$M([
6590
6588
  property({ default: "" })
6591
6589
  ], exports.Effect.prototype, "glsl", 2);
6592
- __decorateClass$H([
6590
+ __decorateClass$M([
6593
6591
  property({ default: "" })
6594
6592
  ], exports.Effect.prototype, "glslSrc", 2);
6595
- exports.Effect = __decorateClass$H([
6593
+ exports.Effect = __decorateClass$M([
6596
6594
  customNode("Effect")
6597
6595
  ], exports.Effect);
6598
6596
 
6599
- var __defProp$y = Object.defineProperty;
6597
+ var __defProp$D = Object.defineProperty;
6600
6598
  var __getOwnPropDesc$E = Object.getOwnPropertyDescriptor;
6601
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$y(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6602
- var __decorateClass$G = (decorators, target, key, kind) => {
6599
+ var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$D(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6600
+ var __decorateClass$L = (decorators, target, key, kind) => {
6603
6601
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$E(target, key) : target;
6604
6602
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6605
6603
  if (decorator = decorators[i])
6606
6604
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6607
- if (kind && result) __defProp$y(target, key, result);
6608
- return result;
6609
- };
6610
- var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
6611
- const frag$2 = `varying vec2 vUv[9];
6612
- uniform sampler2D sampler;
6613
-
6614
- void main(void) {
6615
- gl_FragColor = vec4(0.0);
6616
- float flag = 0.0;
6617
- for (int i = 0; i < 9; i++) {
6618
- vec2 uv = vUv[i];
6619
- if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {
6620
- flag = 1.0;
6621
- break;
6622
- }
6623
- }
6624
- if (flag == 1.0) {
6625
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.028532;
6626
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.067234;
6627
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.124009;
6628
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.179044;
6629
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.20236;
6630
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.179044;
6631
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.124009;
6632
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.067234;
6633
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.028532;
6634
- } else {
6635
- gl_FragColor += texture2D(sampler, vUv[0]) * 0.028532;
6636
- gl_FragColor += texture2D(sampler, vUv[1]) * 0.067234;
6637
- gl_FragColor += texture2D(sampler, vUv[2]) * 0.124009;
6638
- gl_FragColor += texture2D(sampler, vUv[3]) * 0.179044;
6639
- gl_FragColor += texture2D(sampler, vUv[4]) * 0.20236;
6640
- gl_FragColor += texture2D(sampler, vUv[5]) * 0.179044;
6641
- gl_FragColor += texture2D(sampler, vUv[6]) * 0.124009;
6642
- gl_FragColor += texture2D(sampler, vUv[7]) * 0.067234;
6643
- gl_FragColor += texture2D(sampler, vUv[8]) * 0.028532;
6644
- }
6645
- }`;
6646
- exports.BlurEffect = class BlurEffect extends exports.Effect {
6647
- constructor(properties, children = []) {
6648
- super();
6649
- this.setProperties(properties).append(children);
6650
- }
6651
- apply(renderer, source) {
6652
- source.redraw(renderer, () => {
6653
- QuadUvGeometry.draw(renderer, exports.BlurEffect.materialX, {
6654
- sampler: 0,
6655
- strength: 1 / source.width * this.strength / this.quality
6656
- });
6657
- });
6658
- source.redraw(renderer, () => {
6659
- QuadUvGeometry.draw(renderer, exports.BlurEffect.materialY, {
6660
- sampler: 0,
6661
- strength: 1 / source.height * this.strength / this.quality
6662
- });
6663
- });
6664
- }
6665
- };
6666
- __publicField$i(exports.BlurEffect, "materialX", new Material({
6667
- vert: `attribute vec2 position;
6668
- attribute vec2 uv;
6669
- varying vec2 vUv[9];
6670
- uniform float strength;
6671
-
6672
- void main(void) {
6673
- gl_Position = vec4(position, 0, 1);
6674
- vUv[0] = uv + vec2(-4.0 * strength, 0.0);
6675
- vUv[1] = uv + vec2(-3.0 * strength, 0.0);
6676
- vUv[2] = uv + vec2(-2.0 * strength, 0.0);
6677
- vUv[3] = uv + vec2(-1.0 * strength, 0.0);
6678
- vUv[4] = uv + vec2(0.0 * strength, 0.0);
6679
- vUv[5] = uv + vec2(1.0 * strength, 0.0);
6680
- vUv[6] = uv + vec2(2.0 * strength, 0.0);
6681
- vUv[7] = uv + vec2(3.0 * strength, 0.0);
6682
- vUv[8] = uv + vec2(4.0 * strength, 0.0);
6683
- }`,
6684
- frag: frag$2
6685
- }));
6686
- __publicField$i(exports.BlurEffect, "materialY", new Material({
6687
- vert: `attribute vec2 position;
6688
- attribute vec2 uv;
6689
- uniform float strength;
6690
- varying vec2 vUv[9];
6691
-
6692
- void main(void) {
6693
- gl_Position = vec4(position, 0, 1);
6694
- vUv[0] = uv + vec2(0.0, -4.0 * strength);
6695
- vUv[1] = uv + vec2(0.0, -3.0 * strength);
6696
- vUv[2] = uv + vec2(0.0, -2.0 * strength);
6697
- vUv[3] = uv + vec2(0.0, -1.0 * strength);
6698
- vUv[4] = uv + vec2(0.0, 0.0 * strength);
6699
- vUv[5] = uv + vec2(0.0, 1.0 * strength);
6700
- vUv[6] = uv + vec2(0.0, 2.0 * strength);
6701
- vUv[7] = uv + vec2(0.0, 3.0 * strength);
6702
- vUv[8] = uv + vec2(0.0, 4.0 * strength);
6703
- }`,
6704
- frag: frag$2
6705
- }));
6706
- __decorateClass$G([
6707
- property({ default: 4 })
6708
- ], exports.BlurEffect.prototype, "strength", 2);
6709
- __decorateClass$G([
6710
- property({ default: 3 })
6711
- ], exports.BlurEffect.prototype, "quality", 2);
6712
- exports.BlurEffect = __decorateClass$G([
6713
- customNode("BlurEffect")
6714
- ], exports.BlurEffect);
6715
-
6716
- var __defProp$x = Object.defineProperty;
6717
- var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
6718
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$x(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6719
- var __decorateClass$F = (decorators, target, key, kind) => {
6720
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
6721
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6722
- if (decorator = decorators[i])
6723
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6724
- if (kind && result) __defProp$x(target, key, result);
6605
+ if (kind && result) __defProp$D(target, key, result);
6725
6606
  return result;
6726
6607
  };
6727
- var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
6608
+ var __publicField$i = (obj, key, value) => __defNormalProp$i(obj, key + "" , value);
6728
6609
  exports.ColorAdjustEffect = class ColorAdjustEffect extends exports.Effect {
6729
6610
  constructor(properties, children = []) {
6730
6611
  super();
@@ -6746,7 +6627,7 @@ exports.ColorAdjustEffect = class ColorAdjustEffect extends exports.Effect {
6746
6627
  });
6747
6628
  }
6748
6629
  };
6749
- __publicField$h(exports.ColorAdjustEffect, "material", new Material({
6630
+ __publicField$i(exports.ColorAdjustEffect, "material", new Material({
6750
6631
  vert: `precision mediump float;
6751
6632
  attribute vec2 position;
6752
6633
  attribute vec2 uv;
@@ -6781,46 +6662,46 @@ void main(void) {
6781
6662
  gl_FragColor = c * alpha;
6782
6663
  }`
6783
6664
  }));
6784
- __decorateClass$F([
6665
+ __decorateClass$L([
6785
6666
  property({ default: 1 })
6786
6667
  ], exports.ColorAdjustEffect.prototype, "saturation", 2);
6787
- __decorateClass$F([
6668
+ __decorateClass$L([
6788
6669
  property({ default: 1 })
6789
6670
  ], exports.ColorAdjustEffect.prototype, "contrast", 2);
6790
- __decorateClass$F([
6671
+ __decorateClass$L([
6791
6672
  property({ default: 1 })
6792
6673
  ], exports.ColorAdjustEffect.prototype, "brightness", 2);
6793
- __decorateClass$F([
6674
+ __decorateClass$L([
6794
6675
  property({ default: 1 })
6795
6676
  ], exports.ColorAdjustEffect.prototype, "red", 2);
6796
- __decorateClass$F([
6677
+ __decorateClass$L([
6797
6678
  property({ default: 1 })
6798
6679
  ], exports.ColorAdjustEffect.prototype, "green", 2);
6799
- __decorateClass$F([
6680
+ __decorateClass$L([
6800
6681
  property({ default: 1 })
6801
6682
  ], exports.ColorAdjustEffect.prototype, "blue", 2);
6802
- __decorateClass$F([
6683
+ __decorateClass$L([
6803
6684
  property({ default: 1 })
6804
6685
  ], exports.ColorAdjustEffect.prototype, "alpha", 2);
6805
- __decorateClass$F([
6686
+ __decorateClass$L([
6806
6687
  property({ default: 1 })
6807
6688
  ], exports.ColorAdjustEffect.prototype, "gamma", 2);
6808
- exports.ColorAdjustEffect = __decorateClass$F([
6689
+ exports.ColorAdjustEffect = __decorateClass$L([
6809
6690
  customNode("ColorAdjustEffect")
6810
6691
  ], exports.ColorAdjustEffect);
6811
6692
 
6812
- var __defProp$w = Object.defineProperty;
6813
- var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
6814
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$w(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6815
- var __decorateClass$E = (decorators, target, key, kind) => {
6816
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
6693
+ var __defProp$C = Object.defineProperty;
6694
+ var __getOwnPropDesc$D = Object.getOwnPropertyDescriptor;
6695
+ var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$C(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6696
+ var __decorateClass$K = (decorators, target, key, kind) => {
6697
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$D(target, key) : target;
6817
6698
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6818
6699
  if (decorator = decorators[i])
6819
6700
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6820
- if (kind && result) __defProp$w(target, key, result);
6701
+ if (kind && result) __defProp$C(target, key, result);
6821
6702
  return result;
6822
6703
  };
6823
- var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
6704
+ var __publicField$h = (obj, key, value) => __defNormalProp$h(obj, key + "" , value);
6824
6705
  exports.ColorFilterEffect = class ColorFilterEffect extends exports.Effect {
6825
6706
  _colorMatrix = new ColorMatrix();
6826
6707
  constructor(properties, children = []) {
@@ -6870,7 +6751,7 @@ exports.ColorFilterEffect = class ColorFilterEffect extends exports.Effect {
6870
6751
  });
6871
6752
  }
6872
6753
  };
6873
- __publicField$g(exports.ColorFilterEffect, "material", new Material({
6754
+ __publicField$h(exports.ColorFilterEffect, "material", new Material({
6874
6755
  vert: `precision mediump float;
6875
6756
  attribute vec2 position;
6876
6757
  attribute vec2 uv;
@@ -6897,25 +6778,25 @@ void main(void) {
6897
6778
  );
6898
6779
  }`
6899
6780
  }));
6900
- __decorateClass$E([
6781
+ __decorateClass$K([
6901
6782
  property()
6902
6783
  ], exports.ColorFilterEffect.prototype, "filter", 2);
6903
- exports.ColorFilterEffect = __decorateClass$E([
6784
+ exports.ColorFilterEffect = __decorateClass$K([
6904
6785
  customNode("ColorFilterEffect")
6905
6786
  ], exports.ColorFilterEffect);
6906
6787
 
6907
- var __defProp$v = Object.defineProperty;
6908
- var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
6909
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6910
- var __decorateClass$D = (decorators, target, key, kind) => {
6911
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
6788
+ var __defProp$B = Object.defineProperty;
6789
+ var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
6790
+ var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$B(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6791
+ var __decorateClass$J = (decorators, target, key, kind) => {
6792
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$C(target, key) : target;
6912
6793
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
6913
6794
  if (decorator = decorators[i])
6914
6795
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6915
- if (kind && result) __defProp$v(target, key, result);
6796
+ if (kind && result) __defProp$B(target, key, result);
6916
6797
  return result;
6917
6798
  };
6918
- var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
6799
+ var __publicField$g = (obj, key, value) => __defNormalProp$g(obj, key + "" , value);
6919
6800
  const MAX_COLORS$1 = 50;
6920
6801
  exports.ColorOverlayEffect = class ColorOverlayEffect extends exports.Effect {
6921
6802
  _color = new Color();
@@ -6941,7 +6822,7 @@ exports.ColorOverlayEffect = class ColorOverlayEffect extends exports.Effect {
6941
6822
  });
6942
6823
  }
6943
6824
  };
6944
- __publicField$f(exports.ColorOverlayEffect, "material", new Material({
6825
+ __publicField$g(exports.ColorOverlayEffect, "material", new Material({
6945
6826
  vert: `precision mediump float;
6946
6827
  attribute vec2 position;
6947
6828
  attribute vec2 uv;
@@ -6988,28 +6869,28 @@ void main(void) {
6988
6869
  gl_FragColor = vec4(mix(color.rgb, mask.rgb, color.a * mask.a), color.a);
6989
6870
  }`
6990
6871
  }));
6991
- __decorateClass$D([
6872
+ __decorateClass$J([
6992
6873
  property({ default: [] })
6993
6874
  ], exports.ColorOverlayEffect.prototype, "colors", 2);
6994
- __decorateClass$D([
6875
+ __decorateClass$J([
6995
6876
  property({ default: 0.5 })
6996
6877
  ], exports.ColorOverlayEffect.prototype, "alpha", 2);
6997
- exports.ColorOverlayEffect = __decorateClass$D([
6878
+ exports.ColorOverlayEffect = __decorateClass$J([
6998
6879
  customNode("ColorOverlayEffect")
6999
6880
  ], exports.ColorOverlayEffect);
7000
6881
 
7001
- var __defProp$u = Object.defineProperty;
7002
- var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
7003
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7004
- var __decorateClass$C = (decorators, target, key, kind) => {
7005
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
6882
+ var __defProp$A = Object.defineProperty;
6883
+ var __getOwnPropDesc$B = Object.getOwnPropertyDescriptor;
6884
+ var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$A(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6885
+ var __decorateClass$I = (decorators, target, key, kind) => {
6886
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$B(target, key) : target;
7006
6887
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7007
6888
  if (decorator = decorators[i])
7008
6889
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7009
- if (kind && result) __defProp$u(target, key, result);
6890
+ if (kind && result) __defProp$A(target, key, result);
7010
6891
  return result;
7011
6892
  };
7012
- var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
6893
+ var __publicField$f = (obj, key, value) => __defNormalProp$f(obj, key + "" , value);
7013
6894
  exports.ColorRemoveEffect = class ColorRemoveEffect extends exports.Effect {
7014
6895
  _color = new Color();
7015
6896
  constructor(properties, children = []) {
@@ -7040,7 +6921,7 @@ exports.ColorRemoveEffect = class ColorRemoveEffect extends exports.Effect {
7040
6921
  });
7041
6922
  }
7042
6923
  };
7043
- __publicField$e(exports.ColorRemoveEffect, "material", new Material({
6924
+ __publicField$f(exports.ColorRemoveEffect, "material", new Material({
7044
6925
  vert: `precision mediump float;
7045
6926
  attribute vec2 position;
7046
6927
  attribute vec2 uv;
@@ -7073,28 +6954,28 @@ void main(void) {
7073
6954
  gl_FragColor = color;
7074
6955
  }`
7075
6956
  }));
7076
- __decorateClass$C([
6957
+ __decorateClass$I([
7077
6958
  property({ default: [] })
7078
6959
  ], exports.ColorRemoveEffect.prototype, "colors", 2);
7079
- __decorateClass$C([
6960
+ __decorateClass$I([
7080
6961
  property({ default: 0.5 })
7081
6962
  ], exports.ColorRemoveEffect.prototype, "epsilon", 2);
7082
- exports.ColorRemoveEffect = __decorateClass$C([
6963
+ exports.ColorRemoveEffect = __decorateClass$I([
7083
6964
  customNode("ColorRemoveEffect")
7084
6965
  ], exports.ColorRemoveEffect);
7085
6966
 
7086
- var __defProp$t = Object.defineProperty;
7087
- var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
7088
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7089
- var __decorateClass$B = (decorators, target, key, kind) => {
7090
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
6967
+ var __defProp$z = Object.defineProperty;
6968
+ var __getOwnPropDesc$A = Object.getOwnPropertyDescriptor;
6969
+ var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$z(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6970
+ var __decorateClass$H = (decorators, target, key, kind) => {
6971
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$A(target, key) : target;
7091
6972
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7092
6973
  if (decorator = decorators[i])
7093
6974
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7094
- if (kind && result) __defProp$t(target, key, result);
6975
+ if (kind && result) __defProp$z(target, key, result);
7095
6976
  return result;
7096
6977
  };
7097
- var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, key + "" , value);
6978
+ var __publicField$e = (obj, key, value) => __defNormalProp$e(obj, key + "" , value);
7098
6979
  const MAX_COLORS = 50;
7099
6980
  exports.ColorReplaceEffect = class ColorReplaceEffect extends exports.Effect {
7100
6981
  _color = new Color();
@@ -7140,7 +7021,7 @@ exports.ColorReplaceEffect = class ColorReplaceEffect extends exports.Effect {
7140
7021
  });
7141
7022
  }
7142
7023
  };
7143
- __publicField$d(exports.ColorReplaceEffect, "material", new Material({
7024
+ __publicField$e(exports.ColorReplaceEffect, "material", new Material({
7144
7025
  vert: `precision mediump float;
7145
7026
  attribute vec2 position;
7146
7027
  attribute vec2 uv;
@@ -7180,13 +7061,13 @@ void main(void) {
7180
7061
  }
7181
7062
  }`
7182
7063
  }));
7183
- __decorateClass$B([
7064
+ __decorateClass$H([
7184
7065
  property({ default: [] })
7185
7066
  ], exports.ColorReplaceEffect.prototype, "colors", 2);
7186
- __decorateClass$B([
7067
+ __decorateClass$H([
7187
7068
  property({ default: 0.05 })
7188
7069
  ], exports.ColorReplaceEffect.prototype, "epsilon", 2);
7189
- exports.ColorReplaceEffect = __decorateClass$B([
7070
+ exports.ColorReplaceEffect = __decorateClass$H([
7190
7071
  customNode("ColorReplaceEffect")
7191
7072
  ], exports.ColorReplaceEffect);
7192
7073
 
@@ -7326,6 +7207,7 @@ class CanvasContext extends modernPath2d.Path2D {
7326
7207
  }
7327
7208
  if (vertices.length && oldTexture !== draw.texture && !oldTexture?.is(draw.texture)) {
7328
7209
  push(draw.type);
7210
+ texture = draw.texture;
7329
7211
  }
7330
7212
  const start = vertices.length;
7331
7213
  if (draw.type === "fill") {
@@ -7353,14 +7235,14 @@ class CanvasContext extends modernPath2d.Path2D {
7353
7235
  }
7354
7236
  }
7355
7237
 
7356
- var __defProp$s = Object.defineProperty;
7357
- var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
7358
- var __decorateClass$A = (decorators, target, key, kind) => {
7359
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
7238
+ var __defProp$y = Object.defineProperty;
7239
+ var __getOwnPropDesc$z = Object.getOwnPropertyDescriptor;
7240
+ var __decorateClass$G = (decorators, target, key, kind) => {
7241
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$z(target, key) : target;
7360
7242
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7361
7243
  if (decorator = decorators[i])
7362
7244
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7363
- if (kind && result) __defProp$s(target, key, result);
7245
+ if (kind && result) __defProp$y(target, key, result);
7364
7246
  return result;
7365
7247
  };
7366
7248
  exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
@@ -7522,19 +7404,19 @@ exports.CanvasItem = class CanvasItem extends exports.TimelineNode {
7522
7404
  super._render(renderer);
7523
7405
  }
7524
7406
  };
7525
- __decorateClass$A([
7407
+ __decorateClass$G([
7526
7408
  property()
7527
7409
  ], exports.CanvasItem.prototype, "modulate", 2);
7528
- __decorateClass$A([
7410
+ __decorateClass$G([
7529
7411
  property()
7530
7412
  ], exports.CanvasItem.prototype, "blendMode", 2);
7531
- __decorateClass$A([
7413
+ __decorateClass$G([
7532
7414
  protectedProperty({ default: true })
7533
7415
  ], exports.CanvasItem.prototype, "visible", 2);
7534
- __decorateClass$A([
7416
+ __decorateClass$G([
7535
7417
  protectedProperty({ default: 1 })
7536
7418
  ], exports.CanvasItem.prototype, "opacity", 2);
7537
- exports.CanvasItem = __decorateClass$A([
7419
+ exports.CanvasItem = __decorateClass$G([
7538
7420
  customNode("CanvasItem")
7539
7421
  ], exports.CanvasItem);
7540
7422
 
@@ -7564,14 +7446,14 @@ class RenderStack {
7564
7446
  }
7565
7447
  }
7566
7448
 
7567
- var __defProp$r = Object.defineProperty;
7568
- var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
7569
- var __decorateClass$z = (decorators, target, key, kind) => {
7570
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
7449
+ var __defProp$x = Object.defineProperty;
7450
+ var __getOwnPropDesc$y = Object.getOwnPropertyDescriptor;
7451
+ var __decorateClass$F = (decorators, target, key, kind) => {
7452
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$y(target, key) : target;
7571
7453
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7572
7454
  if (decorator = decorators[i])
7573
7455
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7574
- if (kind && result) __defProp$r(target, key, result);
7456
+ if (kind && result) __defProp$x(target, key, result);
7575
7457
  return result;
7576
7458
  };
7577
7459
  exports.Timeline = class Timeline extends exports.Node {
@@ -7616,29 +7498,29 @@ exports.Timeline = class Timeline extends exports.Node {
7616
7498
  this.addTime(delta);
7617
7499
  }
7618
7500
  };
7619
- __decorateClass$z([
7501
+ __decorateClass$F([
7620
7502
  property({ default: 0 })
7621
7503
  ], exports.Timeline.prototype, "startTime", 2);
7622
- __decorateClass$z([
7504
+ __decorateClass$F([
7623
7505
  property({ default: 0 })
7624
7506
  ], exports.Timeline.prototype, "currentTime", 2);
7625
- __decorateClass$z([
7507
+ __decorateClass$F([
7626
7508
  property({ default: Number.MAX_SAFE_INTEGER })
7627
7509
  ], exports.Timeline.prototype, "endTime", 2);
7628
- __decorateClass$z([
7510
+ __decorateClass$F([
7629
7511
  property({ default: false })
7630
7512
  ], exports.Timeline.prototype, "loop", 2);
7631
- exports.Timeline = __decorateClass$z([
7513
+ exports.Timeline = __decorateClass$F([
7632
7514
  customNode("Timeline")
7633
7515
  ], exports.Timeline);
7634
7516
 
7635
- var __defProp$q = Object.defineProperty;
7636
- var __decorateClass$y = (decorators, target, key, kind) => {
7517
+ var __defProp$w = Object.defineProperty;
7518
+ var __decorateClass$E = (decorators, target, key, kind) => {
7637
7519
  var result = void 0 ;
7638
7520
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7639
7521
  if (decorator = decorators[i])
7640
7522
  result = (decorator(target, key, result) ) || result;
7641
- if (result) __defProp$q(target, key, result);
7523
+ if (result) __defProp$w(target, key, result);
7642
7524
  return result;
7643
7525
  };
7644
7526
  class SceneTree extends MainLoop {
@@ -7711,19 +7593,19 @@ class SceneTree extends MainLoop {
7711
7593
  this.input.removeEventListeners();
7712
7594
  }
7713
7595
  }
7714
- __decorateClass$y([
7596
+ __decorateClass$E([
7715
7597
  property({ default: false })
7716
7598
  ], SceneTree.prototype, "processPaused");
7717
- __decorateClass$y([
7599
+ __decorateClass$E([
7718
7600
  property()
7719
7601
  ], SceneTree.prototype, "backgroundColor");
7720
- __decorateClass$y([
7602
+ __decorateClass$E([
7721
7603
  protectedProperty({ default: false })
7722
7604
  ], SceneTree.prototype, "debug");
7723
7605
 
7724
- var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
7725
- var __decorateClass$x = (decorators, target, key, kind) => {
7726
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
7606
+ var __getOwnPropDesc$x = Object.getOwnPropertyDescriptor;
7607
+ var __decorateClass$D = (decorators, target, key, kind) => {
7608
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$x(target, key) : target;
7727
7609
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7728
7610
  if (decorator = decorators[i])
7729
7611
  result = (decorator(result)) || result;
@@ -7735,7 +7617,7 @@ exports.Transition = class Transition extends exports.Effect {
7735
7617
  this.setProperties(properties).append(children);
7736
7618
  }
7737
7619
  };
7738
- exports.Transition = __decorateClass$x([
7620
+ exports.Transition = __decorateClass$D([
7739
7621
  customNode("Transition", {
7740
7622
  effectMode: "transition",
7741
7623
  processMode: "pausable",
@@ -7743,156 +7625,144 @@ exports.Transition = __decorateClass$x([
7743
7625
  })
7744
7626
  ], exports.Transition);
7745
7627
 
7746
- var __defProp$p = Object.defineProperty;
7747
- var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
7748
- var __decorateClass$w = (decorators, target, key, kind) => {
7749
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
7628
+ var __defProp$v = Object.defineProperty;
7629
+ var __getOwnPropDesc$w = Object.getOwnPropertyDescriptor;
7630
+ var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$v(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7631
+ var __decorateClass$C = (decorators, target, key, kind) => {
7632
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$w(target, key) : target;
7750
7633
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7751
7634
  if (decorator = decorators[i])
7752
7635
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7753
- if (kind && result) __defProp$p(target, key, result);
7636
+ if (kind && result) __defProp$v(target, key, result);
7754
7637
  return result;
7755
7638
  };
7756
- const frag$1 = `varying vec2 vUv;
7639
+ var __publicField$d = (obj, key, value) => __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
7640
+ const frag$2 = `varying vec2 vUv[9];
7757
7641
  uniform sampler2D sampler;
7758
- uniform vec2 uOffset;
7759
7642
 
7760
7643
  void main(void) {
7761
- vec4 color = vec4(0.0);
7762
- color += texture2D(sampler, vec2(vUv.x - uOffset.x, vUv.y + uOffset.y));
7763
- color += texture2D(sampler, vec2(vUv.x + uOffset.x, vUv.y + uOffset.y));
7764
- color += texture2D(sampler, vec2(vUv.x + uOffset.x, vUv.y - uOffset.y));
7765
- color += texture2D(sampler, vec2(vUv.x - uOffset.x, vUv.y - uOffset.y));
7766
- color *= 0.25;
7767
- gl_FragColor = color;
7768
- }`;
7769
- const clampFrag = `precision highp float;
7770
- varying vec2 vUv;
7771
- uniform sampler2D sampler;
7772
- uniform vec2 uOffset;
7773
- uniform vec4 uInputClamp;
7774
- void main(void) {
7775
- vec4 color = vec4(0.0);
7776
- color += texture2D(sampler, clamp(vec2(vUv.x - uOffset.x, vUv.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));
7777
- color += texture2D(sampler, clamp(vec2(vUv.x + uOffset.x, vUv.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));
7778
- color += texture2D(sampler, clamp(vec2(vUv.x + uOffset.x, vUv.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));
7779
- color += texture2D(sampler, clamp(vec2(vUv.x - uOffset.x, vUv.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));
7780
- color *= 0.25;
7781
- gl_FragColor = color;
7644
+ gl_FragColor = vec4(0.0);
7645
+ float flag = 0.0;
7646
+ for (int i = 0; i < 9; i++) {
7647
+ vec2 uv = vUv[i];
7648
+ if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) {
7649
+ flag = 1.0;
7650
+ break;
7651
+ }
7652
+ }
7653
+ if (flag == 1.0) {
7654
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.028532;
7655
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.067234;
7656
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.124009;
7657
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.179044;
7658
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.20236;
7659
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.179044;
7660
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.124009;
7661
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.067234;
7662
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.028532;
7663
+ } else {
7664
+ gl_FragColor += texture2D(sampler, vUv[0]) * 0.028532;
7665
+ gl_FragColor += texture2D(sampler, vUv[1]) * 0.067234;
7666
+ gl_FragColor += texture2D(sampler, vUv[2]) * 0.124009;
7667
+ gl_FragColor += texture2D(sampler, vUv[3]) * 0.179044;
7668
+ gl_FragColor += texture2D(sampler, vUv[4]) * 0.20236;
7669
+ gl_FragColor += texture2D(sampler, vUv[5]) * 0.179044;
7670
+ gl_FragColor += texture2D(sampler, vUv[6]) * 0.124009;
7671
+ gl_FragColor += texture2D(sampler, vUv[7]) * 0.067234;
7672
+ gl_FragColor += texture2D(sampler, vUv[8]) * 0.028532;
7673
+ }
7782
7674
  }`;
7783
- exports.KawaseBlurEffect = class KawaseBlurEffect extends exports.Effect {
7784
- material;
7785
- _kernels = [0];
7675
+ exports.GaussianBlurEffect = class GaussianBlurEffect extends exports.Effect {
7786
7676
  constructor(properties, children = []) {
7787
7677
  super();
7788
- this.material = new Material({
7789
- vert: `precision mediump float;
7790
- attribute vec2 position;
7791
- attribute vec2 uv;
7792
- varying vec2 vUv;
7793
- void main() {
7794
- gl_Position = vec4(position, 0.0, 1.0);
7795
- vUv = uv;
7796
- }`,
7797
- frag: properties?.clamp ? clampFrag : frag$1
7798
- });
7799
7678
  this.setProperties(properties).append(children);
7800
- this._generateKernels();
7801
- }
7802
- _updateProperty(key, value, oldValue, declaration) {
7803
- super._updateProperty(key, value, oldValue, declaration);
7804
- switch (key) {
7805
- case "quality":
7806
- case "strength":
7807
- this._generateKernels();
7808
- break;
7809
- }
7810
- }
7811
- /** Auto generate kernels by blur & quality */
7812
- _generateKernels() {
7813
- const blur = Math.max(1, Math.round(this.strength));
7814
- const quality = Math.max(1, Math.round(this.quality));
7815
- const kernels = [blur];
7816
- if (blur > 0) {
7817
- let k = blur;
7818
- const step = blur / quality;
7819
- for (let i = 1; i < quality; i++) {
7820
- k -= step;
7821
- kernels.push(k);
7822
- }
7823
- }
7824
- this._kernels = kernels;
7825
7679
  }
7826
7680
  apply(renderer, source) {
7827
- const uvX = this.pixelSize[0] / source.width;
7828
- const uvY = this.pixelSize[1] / source.height;
7829
- let offset;
7830
- if (this.quality === 1 || this.strength === 0) {
7831
- offset = this._kernels[0] + 0.5;
7681
+ const sx = 1 / source.width;
7682
+ const sy = 1 / source.height;
7683
+ const quality = Math.max(this.quality, 1);
7684
+ for (let i = 0; i < quality; i++) {
7832
7685
  source.redraw(renderer, () => {
7833
- QuadUvGeometry.draw(renderer, this.material, {
7686
+ QuadUvGeometry.draw(renderer, exports.GaussianBlurEffect.materialX, {
7834
7687
  sampler: 0,
7835
- uOffset: [
7836
- offset * uvX,
7837
- offset * uvY
7838
- ],
7839
- uInputClamp: [0, 0, 1, 1]
7688
+ uStrength: sx * (this.strength / quality)
7840
7689
  });
7841
7690
  });
7842
- } else {
7843
- const last = this.quality - 1;
7844
- for (let i = 0; i < last; i++) {
7845
- offset = this._kernels[i] + 0.5;
7846
- source.redraw(renderer, () => {
7847
- QuadUvGeometry.draw(renderer, this.material, {
7848
- sampler: 0,
7849
- uOffset: [
7850
- offset * uvX,
7851
- offset * uvY
7852
- ],
7853
- uInputClamp: [0, 0, 1, 1]
7854
- });
7691
+ }
7692
+ for (let i = 0; i < quality; i++) {
7693
+ source.redraw(renderer, () => {
7694
+ QuadUvGeometry.draw(renderer, exports.GaussianBlurEffect.materialY, {
7695
+ sampler: 0,
7696
+ uStrength: sy * (this.strength / quality)
7855
7697
  });
7856
- }
7857
- offset = this._kernels[last] + 0.5;
7858
- QuadUvGeometry.draw(renderer, this.material, {
7859
- sampler: 0,
7860
- uOffset: [
7861
- offset * uvX,
7862
- offset * uvY
7863
- ],
7864
- uInputClamp: [0, 0, 1, 1]
7865
7698
  });
7866
7699
  }
7867
7700
  }
7868
7701
  };
7869
- __decorateClass$w([
7702
+ __publicField$d(exports.GaussianBlurEffect, "materialX", new Material({
7703
+ vert: `attribute vec2 position;
7704
+ attribute vec2 uv;
7705
+ uniform float uStrength;
7706
+ varying vec2 vUv[9];
7707
+
7708
+ void main(void) {
7709
+ gl_Position = vec4(position, 0, 1);
7710
+ vUv[0] = uv + vec2(-4.0 * uStrength, 0.0);
7711
+ vUv[1] = uv + vec2(-3.0 * uStrength, 0.0);
7712
+ vUv[2] = uv + vec2(-2.0 * uStrength, 0.0);
7713
+ vUv[3] = uv + vec2(-1.0 * uStrength, 0.0);
7714
+ vUv[4] = uv + vec2(0.0 * uStrength, 0.0);
7715
+ vUv[5] = uv + vec2(1.0 * uStrength, 0.0);
7716
+ vUv[6] = uv + vec2(2.0 * uStrength, 0.0);
7717
+ vUv[7] = uv + vec2(3.0 * uStrength, 0.0);
7718
+ vUv[8] = uv + vec2(4.0 * uStrength, 0.0);
7719
+ }`,
7720
+ frag: frag$2
7721
+ }));
7722
+ __publicField$d(exports.GaussianBlurEffect, "materialY", new Material({
7723
+ vert: `attribute vec2 position;
7724
+ attribute vec2 uv;
7725
+ uniform float uStrength;
7726
+ varying vec2 vUv[9];
7727
+
7728
+ void main(void) {
7729
+ gl_Position = vec4(position, 0, 1);
7730
+ vUv[0] = uv + vec2(0.0, -4.0 * uStrength);
7731
+ vUv[1] = uv + vec2(0.0, -3.0 * uStrength);
7732
+ vUv[2] = uv + vec2(0.0, -2.0 * uStrength);
7733
+ vUv[3] = uv + vec2(0.0, -1.0 * uStrength);
7734
+ vUv[4] = uv + vec2(0.0, 0.0 * uStrength);
7735
+ vUv[5] = uv + vec2(0.0, 1.0 * uStrength);
7736
+ vUv[6] = uv + vec2(0.0, 2.0 * uStrength);
7737
+ vUv[7] = uv + vec2(0.0, 3.0 * uStrength);
7738
+ vUv[8] = uv + vec2(0.0, 4.0 * uStrength);
7739
+ }`,
7740
+ frag: frag$2
7741
+ }));
7742
+ __decorateClass$C([
7870
7743
  property({ default: 4 })
7871
- ], exports.KawaseBlurEffect.prototype, "strength", 2);
7872
- __decorateClass$w([
7744
+ ], exports.GaussianBlurEffect.prototype, "strength", 2);
7745
+ __decorateClass$C([
7873
7746
  property({ default: 3 })
7874
- ], exports.KawaseBlurEffect.prototype, "quality", 2);
7875
- __decorateClass$w([
7876
- property({ default: [1, 1] })
7877
- ], exports.KawaseBlurEffect.prototype, "pixelSize", 2);
7878
- exports.KawaseBlurEffect = __decorateClass$w([
7879
- customNode("KawaseBlurEffect")
7880
- ], exports.KawaseBlurEffect);
7747
+ ], exports.GaussianBlurEffect.prototype, "quality", 2);
7748
+ exports.GaussianBlurEffect = __decorateClass$C([
7749
+ customNode("GaussianBlurEffect")
7750
+ ], exports.GaussianBlurEffect);
7881
7751
 
7882
- var __defProp$o = Object.defineProperty;
7883
- var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
7884
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7885
- var __decorateClass$v = (decorators, target, key, kind) => {
7886
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
7752
+ var __defProp$u = Object.defineProperty;
7753
+ var __getOwnPropDesc$v = Object.getOwnPropertyDescriptor;
7754
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$u(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7755
+ var __decorateClass$B = (decorators, target, key, kind) => {
7756
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$v(target, key) : target;
7887
7757
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7888
7758
  if (decorator = decorators[i])
7889
7759
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7890
- if (kind && result) __defProp$o(target, key, result);
7760
+ if (kind && result) __defProp$u(target, key, result);
7891
7761
  return result;
7892
7762
  };
7893
7763
  var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, key + "" , value);
7894
7764
  exports.DropShadowEffect = class DropShadowEffect extends exports.Effect {
7895
- kawaseBlurEffect = new exports.KawaseBlurEffect();
7765
+ blurEffect = new exports.GaussianBlurEffect();
7896
7766
  viewport3 = new exports.Viewport();
7897
7767
  _color = new Color();
7898
7768
  constructor(properties, children = []) {
@@ -7905,16 +7775,14 @@ exports.DropShadowEffect = class DropShadowEffect extends exports.Effect {
7905
7775
  this._color.value = this.color;
7906
7776
  QuadUvGeometry.draw(renderer, exports.DropShadowEffect.material, {
7907
7777
  sampler: 0,
7908
- uAlpha: this.alpha,
7778
+ uAlpha: this._color.a,
7909
7779
  uColor: this._color.toArray().slice(0, 3),
7910
- uOffset: [-this.offset[0], this.offset[1]],
7780
+ uOffset: [-this.offsetX, this.offsetY],
7911
7781
  uInputSize: [source.width, source.height, 1 / source.width, 1 / source.height]
7912
7782
  });
7913
7783
  });
7914
- this.kawaseBlurEffect.strength = this.blur;
7915
- this.kawaseBlurEffect.quality = this.quality;
7916
- this.kawaseBlurEffect.pixelSize = this.pixelSize;
7917
- this.kawaseBlurEffect.apply(renderer, this.viewport3);
7784
+ this.blurEffect.strength = this.blur;
7785
+ this.blurEffect.apply(renderer, this.viewport3);
7918
7786
  source.redraw(renderer, () => {
7919
7787
  this.viewport3.texture.activate(renderer, 1);
7920
7788
  QuadUvGeometry.draw(renderer, UvMaterial.instance, {
@@ -7953,40 +7821,34 @@ void main(void) {
7953
7821
  gl_FragColor = sample;
7954
7822
  }`
7955
7823
  }));
7956
- __decorateClass$v([
7957
- property({ default: [4, 4] })
7958
- ], exports.DropShadowEffect.prototype, "offset", 2);
7959
- __decorateClass$v([
7824
+ __decorateClass$B([
7960
7825
  property({ default: 0 })
7961
7826
  ], exports.DropShadowEffect.prototype, "color", 2);
7962
- __decorateClass$v([
7963
- property({ default: 1 })
7964
- ], exports.DropShadowEffect.prototype, "alpha", 2);
7965
- __decorateClass$v([
7966
- property({ default: false })
7967
- ], exports.DropShadowEffect.prototype, "shadowOnly", 2);
7968
- __decorateClass$v([
7969
- property({ default: 2 })
7827
+ __decorateClass$B([
7828
+ property({ default: 4 })
7970
7829
  ], exports.DropShadowEffect.prototype, "blur", 2);
7971
- __decorateClass$v([
7830
+ __decorateClass$B([
7972
7831
  property({ default: 4 })
7973
- ], exports.DropShadowEffect.prototype, "quality", 2);
7974
- __decorateClass$v([
7975
- property({ default: [1, 1] })
7976
- ], exports.DropShadowEffect.prototype, "pixelSize", 2);
7977
- exports.DropShadowEffect = __decorateClass$v([
7832
+ ], exports.DropShadowEffect.prototype, "offsetX", 2);
7833
+ __decorateClass$B([
7834
+ property({ default: 4 })
7835
+ ], exports.DropShadowEffect.prototype, "offsetY", 2);
7836
+ __decorateClass$B([
7837
+ property({ default: false })
7838
+ ], exports.DropShadowEffect.prototype, "shadowOnly", 2);
7839
+ exports.DropShadowEffect = __decorateClass$B([
7978
7840
  customNode("DropShadowEffect")
7979
7841
  ], exports.DropShadowEffect);
7980
7842
 
7981
- var __defProp$n = Object.defineProperty;
7982
- var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
7983
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7984
- var __decorateClass$u = (decorators, target, key, kind) => {
7985
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
7843
+ var __defProp$t = Object.defineProperty;
7844
+ var __getOwnPropDesc$u = Object.getOwnPropertyDescriptor;
7845
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$t(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7846
+ var __decorateClass$A = (decorators, target, key, kind) => {
7847
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$u(target, key) : target;
7986
7848
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
7987
7849
  if (decorator = decorators[i])
7988
7850
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7989
- if (kind && result) __defProp$n(target, key, result);
7851
+ if (kind && result) __defProp$t(target, key, result);
7990
7852
  return result;
7991
7853
  };
7992
7854
  var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, key + "" , value);
@@ -8031,22 +7893,22 @@ void main(void) {
8031
7893
  gl_FragColor = vec4(color.rgb * alpha, alpha);
8032
7894
  }`
8033
7895
  }));
8034
- __decorateClass$u([
7896
+ __decorateClass$A([
8035
7897
  property({ default: 5 })
8036
7898
  ], exports.EmbossEffect.prototype, "strength", 2);
8037
- exports.EmbossEffect = __decorateClass$u([
7899
+ exports.EmbossEffect = __decorateClass$A([
8038
7900
  customNode("EmbossEffect")
8039
7901
  ], exports.EmbossEffect);
8040
7902
 
8041
- var __defProp$m = Object.defineProperty;
8042
- var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
8043
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8044
- var __decorateClass$t = (decorators, target, key, kind) => {
8045
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
7903
+ var __defProp$s = Object.defineProperty;
7904
+ var __getOwnPropDesc$t = Object.getOwnPropertyDescriptor;
7905
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$s(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7906
+ var __decorateClass$z = (decorators, target, key, kind) => {
7907
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$t(target, key) : target;
8046
7908
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8047
7909
  if (decorator = decorators[i])
8048
7910
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8049
- if (kind && result) __defProp$m(target, key, result);
7911
+ if (kind && result) __defProp$s(target, key, result);
8050
7912
  return result;
8051
7913
  };
8052
7914
  var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, key + "" , value);
@@ -8220,46 +8082,46 @@ void main(void) {
8220
8082
  gl_FragColor.a = texture2D(sampler, coord).a;
8221
8083
  }`
8222
8084
  }));
8223
- __decorateClass$t([
8085
+ __decorateClass$z([
8224
8086
  property({ default: 10 })
8225
8087
  ], exports.GlitchEffect.prototype, "slices", 2);
8226
- __decorateClass$t([
8088
+ __decorateClass$z([
8227
8089
  property({ default: 512 })
8228
8090
  ], exports.GlitchEffect.prototype, "sampleSize", 2);
8229
- __decorateClass$t([
8091
+ __decorateClass$z([
8230
8092
  property({ default: 100 })
8231
8093
  ], exports.GlitchEffect.prototype, "offset", 2);
8232
- __decorateClass$t([
8094
+ __decorateClass$z([
8233
8095
  property({ default: 0 })
8234
8096
  ], exports.GlitchEffect.prototype, "direction", 2);
8235
- __decorateClass$t([
8097
+ __decorateClass$z([
8236
8098
  property({ default: 2 })
8237
8099
  ], exports.GlitchEffect.prototype, "fillMode", 2);
8238
- __decorateClass$t([
8100
+ __decorateClass$z([
8239
8101
  property({ default: 0 })
8240
8102
  ], exports.GlitchEffect.prototype, "seed", 2);
8241
- __decorateClass$t([
8103
+ __decorateClass$z([
8242
8104
  property({ default: [2, 2] })
8243
8105
  ], exports.GlitchEffect.prototype, "red", 2);
8244
- __decorateClass$t([
8106
+ __decorateClass$z([
8245
8107
  property({ default: [-10, 4] })
8246
8108
  ], exports.GlitchEffect.prototype, "green", 2);
8247
- __decorateClass$t([
8109
+ __decorateClass$z([
8248
8110
  property({ default: [10, -4] })
8249
8111
  ], exports.GlitchEffect.prototype, "blue", 2);
8250
- exports.GlitchEffect = __decorateClass$t([
8112
+ exports.GlitchEffect = __decorateClass$z([
8251
8113
  customNode("GlitchEffect")
8252
8114
  ], exports.GlitchEffect);
8253
8115
 
8254
- var __defProp$l = Object.defineProperty;
8255
- var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
8256
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8257
- var __decorateClass$s = (decorators, target, key, kind) => {
8258
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
8116
+ var __defProp$r = Object.defineProperty;
8117
+ var __getOwnPropDesc$s = Object.getOwnPropertyDescriptor;
8118
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$r(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8119
+ var __decorateClass$y = (decorators, target, key, kind) => {
8120
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$s(target, key) : target;
8259
8121
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8260
8122
  if (decorator = decorators[i])
8261
8123
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8262
- if (kind && result) __defProp$l(target, key, result);
8124
+ if (kind && result) __defProp$r(target, key, result);
8263
8125
  return result;
8264
8126
  };
8265
8127
  var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, key + "" , value);
@@ -8437,40 +8299,151 @@ void main(void) {
8437
8299
  gl_FragColor = vec4(color.rgb + mist.rgb, color.a);
8438
8300
  }`
8439
8301
  }));
8440
- __decorateClass$s([
8302
+ __decorateClass$y([
8441
8303
  property({ default: 0 })
8442
8304
  ], exports.GodrayEffect.prototype, "time", 2);
8443
- __decorateClass$s([
8305
+ __decorateClass$y([
8444
8306
  property({ default: 30 })
8445
8307
  ], exports.GodrayEffect.prototype, "angle", 2);
8446
- __decorateClass$s([
8308
+ __decorateClass$y([
8447
8309
  property({ default: 0.5 })
8448
8310
  ], exports.GodrayEffect.prototype, "gain", 2);
8449
- __decorateClass$s([
8311
+ __decorateClass$y([
8450
8312
  property({ default: 2.5 })
8451
8313
  ], exports.GodrayEffect.prototype, "lacunarity", 2);
8452
- __decorateClass$s([
8314
+ __decorateClass$y([
8453
8315
  property({ default: true })
8454
8316
  ], exports.GodrayEffect.prototype, "parallel", 2);
8455
- __decorateClass$s([
8317
+ __decorateClass$y([
8456
8318
  property({ default: [0, 0] })
8457
8319
  ], exports.GodrayEffect.prototype, "center", 2);
8458
- __decorateClass$s([
8320
+ __decorateClass$y([
8459
8321
  property({ default: 1 })
8460
8322
  ], exports.GodrayEffect.prototype, "alpha", 2);
8461
- exports.GodrayEffect = __decorateClass$s([
8323
+ exports.GodrayEffect = __decorateClass$y([
8462
8324
  customNode("GodrayEffect")
8463
8325
  ], exports.GodrayEffect);
8464
8326
 
8465
- var __defProp$k = Object.defineProperty;
8327
+ var __defProp$q = Object.defineProperty;
8328
+ var __getOwnPropDesc$r = Object.getOwnPropertyDescriptor;
8329
+ var __decorateClass$x = (decorators, target, key, kind) => {
8330
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$r(target, key) : target;
8331
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8332
+ if (decorator = decorators[i])
8333
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8334
+ if (kind && result) __defProp$q(target, key, result);
8335
+ return result;
8336
+ };
8337
+ const frag$1 = `varying vec2 vUv;
8338
+ uniform sampler2D sampler;
8339
+ uniform vec2 uOffset;
8340
+
8341
+ void main(void) {
8342
+ vec4 color = vec4(0.0);
8343
+ color += texture2D(sampler, vec2(vUv.x - uOffset.x, vUv.y + uOffset.y));
8344
+ color += texture2D(sampler, vec2(vUv.x + uOffset.x, vUv.y + uOffset.y));
8345
+ color += texture2D(sampler, vec2(vUv.x + uOffset.x, vUv.y - uOffset.y));
8346
+ color += texture2D(sampler, vec2(vUv.x - uOffset.x, vUv.y - uOffset.y));
8347
+ color *= 0.25;
8348
+ gl_FragColor = color;
8349
+ }`;
8350
+ const clampFrag = `precision highp float;
8351
+ varying vec2 vUv;
8352
+ uniform sampler2D sampler;
8353
+ uniform vec2 uOffset;
8354
+ uniform vec4 uInputClamp;
8355
+ void main(void) {
8356
+ vec4 color = vec4(0.0);
8357
+ color += texture2D(sampler, clamp(vec2(vUv.x - uOffset.x, vUv.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));
8358
+ color += texture2D(sampler, clamp(vec2(vUv.x + uOffset.x, vUv.y + uOffset.y), uInputClamp.xy, uInputClamp.zw));
8359
+ color += texture2D(sampler, clamp(vec2(vUv.x + uOffset.x, vUv.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));
8360
+ color += texture2D(sampler, clamp(vec2(vUv.x - uOffset.x, vUv.y - uOffset.y), uInputClamp.xy, uInputClamp.zw));
8361
+ color *= 0.25;
8362
+ gl_FragColor = color;
8363
+ }`;
8364
+ exports.KawaseBlurEffect = class KawaseBlurEffect extends exports.Effect {
8365
+ material;
8366
+ _kernels = [0];
8367
+ constructor(properties, children = []) {
8368
+ super();
8369
+ this.material = new Material({
8370
+ vert: `precision mediump float;
8371
+ attribute vec2 position;
8372
+ attribute vec2 uv;
8373
+ varying vec2 vUv;
8374
+ void main() {
8375
+ gl_Position = vec4(position, 0.0, 1.0);
8376
+ vUv = uv;
8377
+ }`,
8378
+ frag: properties?.clamp ? clampFrag : frag$1
8379
+ });
8380
+ this.setProperties(properties).append(children);
8381
+ this._generateKernels();
8382
+ }
8383
+ _updateProperty(key, value, oldValue, declaration) {
8384
+ super._updateProperty(key, value, oldValue, declaration);
8385
+ switch (key) {
8386
+ case "quality":
8387
+ case "strength":
8388
+ this._generateKernels();
8389
+ break;
8390
+ }
8391
+ }
8392
+ /** Auto generate kernels by blur & quality */
8393
+ _generateKernels() {
8394
+ const blur = Math.max(1, Math.round(this.strength));
8395
+ const quality = Math.max(1, Math.round(this.quality));
8396
+ const kernels = [blur];
8397
+ if (blur > 0) {
8398
+ let k = blur;
8399
+ const step = blur / quality;
8400
+ for (let i = 1; i < quality; i++) {
8401
+ k -= step;
8402
+ kernels.push(k);
8403
+ }
8404
+ }
8405
+ this._kernels = kernels;
8406
+ }
8407
+ apply(renderer, source) {
8408
+ const uvX = this.pixelSize[0] / source.width;
8409
+ const uvY = this.pixelSize[1] / source.height;
8410
+ this._kernels.forEach((kernel) => {
8411
+ const offset = kernel + 0.5;
8412
+ source.redraw(renderer, () => {
8413
+ QuadUvGeometry.draw(renderer, this.material, {
8414
+ sampler: 0,
8415
+ uOffset: [
8416
+ offset * uvX,
8417
+ offset * uvY
8418
+ ],
8419
+ uInputClamp: [0, 0, 1, 1]
8420
+ });
8421
+ });
8422
+ });
8423
+ }
8424
+ };
8425
+ __decorateClass$x([
8426
+ property({ default: 4 })
8427
+ ], exports.KawaseBlurEffect.prototype, "strength", 2);
8428
+ __decorateClass$x([
8429
+ property({ default: 3 })
8430
+ ], exports.KawaseBlurEffect.prototype, "quality", 2);
8431
+ __decorateClass$x([
8432
+ property({ default: [1, 1] })
8433
+ ], exports.KawaseBlurEffect.prototype, "pixelSize", 2);
8434
+ exports.KawaseBlurEffect = __decorateClass$x([
8435
+ customNode("KawaseBlurEffect")
8436
+ ], exports.KawaseBlurEffect);
8437
+
8438
+ var __defProp$p = Object.defineProperty;
8466
8439
  var __getOwnPropDesc$q = Object.getOwnPropertyDescriptor;
8467
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8468
- var __decorateClass$r = (decorators, target, key, kind) => {
8440
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$p(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8441
+ var __decorateClass$w = (decorators, target, key, kind) => {
8469
8442
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$q(target, key) : target;
8470
8443
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8471
8444
  if (decorator = decorators[i])
8472
8445
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8473
- if (kind && result) __defProp$k(target, key, result);
8446
+ if (kind && result) __defProp$p(target, key, result);
8474
8447
  return result;
8475
8448
  };
8476
8449
  var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, key + "" , value);
@@ -8559,25 +8532,25 @@ void main(void) {
8559
8532
  }
8560
8533
  }`
8561
8534
  }));
8562
- __decorateClass$r([
8535
+ __decorateClass$w([
8563
8536
  protectedProperty()
8564
8537
  ], exports.MaskEffect.prototype, "texture", 2);
8565
- __decorateClass$r([
8538
+ __decorateClass$w([
8566
8539
  property({ default: "" })
8567
8540
  ], exports.MaskEffect.prototype, "src", 2);
8568
- exports.MaskEffect = __decorateClass$r([
8541
+ exports.MaskEffect = __decorateClass$w([
8569
8542
  customNode("MaskEffect")
8570
8543
  ], exports.MaskEffect);
8571
8544
 
8572
- var __defProp$j = Object.defineProperty;
8545
+ var __defProp$o = Object.defineProperty;
8573
8546
  var __getOwnPropDesc$p = Object.getOwnPropertyDescriptor;
8574
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8575
- var __decorateClass$q = (decorators, target, key, kind) => {
8547
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$o(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8548
+ var __decorateClass$v = (decorators, target, key, kind) => {
8576
8549
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$p(target, key) : target;
8577
8550
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8578
8551
  if (decorator = decorators[i])
8579
8552
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8580
- if (kind && result) __defProp$j(target, key, result);
8553
+ if (kind && result) __defProp$o(target, key, result);
8581
8554
  return result;
8582
8555
  };
8583
8556
  var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -8651,11 +8624,11 @@ void main() {
8651
8624
  QuadUvGeometry.draw(renderer, this.material, {
8652
8625
  sampler: 0,
8653
8626
  uThickness: [
8654
- this.thickness / source.width,
8655
- this.thickness / source.height
8627
+ this.width / source.width,
8628
+ this.width / source.height
8656
8629
  ],
8657
8630
  uColor: this._color.toArray().slice(0, 3),
8658
- uAlpha: this.alpha,
8631
+ uAlpha: this.opacity !== 1 ? this.opacity : this._color.a,
8659
8632
  uAngleStep: exports.OutlineEffect.getAngleStep(this.quality),
8660
8633
  uKnockout: this.knockout ? 1 : 0,
8661
8634
  uInputClamp: [0, 0, 1, 1]
@@ -8665,34 +8638,40 @@ void main() {
8665
8638
  };
8666
8639
  __publicField$7(exports.OutlineEffect, "MIN_SAMPLES", 1);
8667
8640
  __publicField$7(exports.OutlineEffect, "MAX_SAMPLES", 100);
8668
- __decorateClass$q([
8669
- property({ default: 1 })
8670
- ], exports.OutlineEffect.prototype, "thickness", 2);
8671
- __decorateClass$q([
8641
+ __decorateClass$v([
8672
8642
  property({ default: 0 })
8673
8643
  ], exports.OutlineEffect.prototype, "color", 2);
8674
- __decorateClass$q([
8644
+ __decorateClass$v([
8675
8645
  property({ default: 1 })
8676
- ], exports.OutlineEffect.prototype, "alpha", 2);
8677
- __decorateClass$q([
8646
+ ], exports.OutlineEffect.prototype, "width", 2);
8647
+ __decorateClass$v([
8648
+ property({ default: "solid" })
8649
+ ], exports.OutlineEffect.prototype, "style", 2);
8650
+ __decorateClass$v([
8651
+ property()
8652
+ ], exports.OutlineEffect.prototype, "image", 2);
8653
+ __decorateClass$v([
8654
+ property({ default: 1 })
8655
+ ], exports.OutlineEffect.prototype, "opacity", 2);
8656
+ __decorateClass$v([
8678
8657
  property({ default: 0.1 })
8679
8658
  ], exports.OutlineEffect.prototype, "quality", 2);
8680
- __decorateClass$q([
8659
+ __decorateClass$v([
8681
8660
  property({ default: false })
8682
8661
  ], exports.OutlineEffect.prototype, "knockout", 2);
8683
- exports.OutlineEffect = __decorateClass$q([
8662
+ exports.OutlineEffect = __decorateClass$v([
8684
8663
  customNode("OutlineEffect")
8685
8664
  ], exports.OutlineEffect);
8686
8665
 
8687
- var __defProp$i = Object.defineProperty;
8666
+ var __defProp$n = Object.defineProperty;
8688
8667
  var __getOwnPropDesc$o = Object.getOwnPropertyDescriptor;
8689
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8690
- var __decorateClass$p = (decorators, target, key, kind) => {
8668
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$n(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8669
+ var __decorateClass$u = (decorators, target, key, kind) => {
8691
8670
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$o(target, key) : target;
8692
8671
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8693
8672
  if (decorator = decorators[i])
8694
8673
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8695
- if (kind && result) __defProp$i(target, key, result);
8674
+ if (kind && result) __defProp$n(target, key, result);
8696
8675
  return result;
8697
8676
  };
8698
8677
  var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, key + "" , value);
@@ -8748,22 +8727,22 @@ void main(void) {
8748
8727
  gl_FragColor = texture2D(sampler, coord);
8749
8728
  }`
8750
8729
  }));
8751
- __decorateClass$p([
8730
+ __decorateClass$u([
8752
8731
  property({ default: 10 })
8753
8732
  ], exports.PixelateEffect.prototype, "strength", 2);
8754
- exports.PixelateEffect = __decorateClass$p([
8733
+ exports.PixelateEffect = __decorateClass$u([
8755
8734
  customNode("PixelateEffect")
8756
8735
  ], exports.PixelateEffect);
8757
8736
 
8758
- var __defProp$h = Object.defineProperty;
8737
+ var __defProp$m = Object.defineProperty;
8759
8738
  var __getOwnPropDesc$n = Object.getOwnPropertyDescriptor;
8760
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8761
- var __decorateClass$o = (decorators, target, key, kind) => {
8739
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$m(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8740
+ var __decorateClass$t = (decorators, target, key, kind) => {
8762
8741
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$n(target, key) : target;
8763
8742
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
8764
8743
  if (decorator = decorators[i])
8765
8744
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8766
- if (kind && result) __defProp$h(target, key, result);
8745
+ if (kind && result) __defProp$m(target, key, result);
8767
8746
  return result;
8768
8747
  };
8769
8748
  var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, key + "" , value);
@@ -8772,11 +8751,18 @@ exports.ZoomBlurEffect = class ZoomBlurEffect extends exports.Effect {
8772
8751
  super();
8773
8752
  this.setProperties(properties).append(children);
8774
8753
  }
8775
- apply(renderer, source) {
8754
+ apply(renderer, source, context) {
8755
+ let center = this.center;
8756
+ if (context.targetArea) {
8757
+ center = [
8758
+ (context.targetArea[0] + context.targetArea[2] / 2) * source.width,
8759
+ (context.targetArea[1] + context.targetArea[3] / 2) * source.height
8760
+ ];
8761
+ }
8776
8762
  source.redraw(renderer, () => {
8777
8763
  QuadUvGeometry.draw(renderer, exports.ZoomBlurEffect.material, {
8778
8764
  sampler: 0,
8779
- uCenter: this.center ?? [source.width / 2, source.height / 2],
8765
+ uCenter: center ?? [source.width / 2, source.height / 2],
8780
8766
  uInnerRadius: this.innerRadius,
8781
8767
  uRadius: this.radius,
8782
8768
  uStrength: this.strength,
@@ -8869,22 +8855,277 @@ void main() {
8869
8855
  gl_FragColor = color;
8870
8856
  }`
8871
8857
  }));
8872
- __decorateClass$o([
8858
+ __decorateClass$t([
8873
8859
  property()
8874
8860
  ], exports.ZoomBlurEffect.prototype, "center", 2);
8875
- __decorateClass$o([
8861
+ __decorateClass$t([
8876
8862
  property({ default: 20 })
8877
8863
  ], exports.ZoomBlurEffect.prototype, "innerRadius", 2);
8878
- __decorateClass$o([
8864
+ __decorateClass$t([
8879
8865
  property({ default: -1 })
8880
8866
  ], exports.ZoomBlurEffect.prototype, "radius", 2);
8881
- __decorateClass$o([
8867
+ __decorateClass$t([
8882
8868
  property({ default: 0.1 })
8883
8869
  ], exports.ZoomBlurEffect.prototype, "strength", 2);
8884
- exports.ZoomBlurEffect = __decorateClass$o([
8870
+ exports.ZoomBlurEffect = __decorateClass$t([
8885
8871
  customNode("ZoomBlurEffect")
8886
8872
  ], exports.ZoomBlurEffect);
8887
8873
 
8874
+ var __defProp$l = Object.defineProperty;
8875
+ var __decorateClass$s = (decorators, target, key, kind) => {
8876
+ var result = void 0 ;
8877
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8878
+ if (decorator = decorators[i])
8879
+ result = (decorator(target, key, result) ) || result;
8880
+ if (result) __defProp$l(target, key, result);
8881
+ return result;
8882
+ };
8883
+ class BaseElement2DFill extends CoreObject {
8884
+ constructor(parent, properties) {
8885
+ super();
8886
+ this.parent = parent;
8887
+ this.setProperties(properties);
8888
+ }
8889
+ _image;
8890
+ _updateProperty(key, value, oldValue, declaration) {
8891
+ super._updateProperty(key, value, oldValue, declaration);
8892
+ switch (key) {
8893
+ case "color":
8894
+ case "dpi":
8895
+ case "rotateWithShape":
8896
+ case "tile":
8897
+ this.parent.requestRedraw();
8898
+ break;
8899
+ case "image":
8900
+ this._updateImage();
8901
+ break;
8902
+ }
8903
+ }
8904
+ async loadImage() {
8905
+ if (this.image && this.image !== "none") {
8906
+ return await assets.texture.load(this.image);
8907
+ }
8908
+ }
8909
+ async _updateImage() {
8910
+ this._image = await this.loadImage();
8911
+ this.parent.requestRedraw();
8912
+ }
8913
+ canDraw() {
8914
+ return Boolean(
8915
+ this._image || this.color
8916
+ );
8917
+ }
8918
+ draw() {
8919
+ const ctx = this.parent.context;
8920
+ if (this._image) {
8921
+ const { width, height } = this.parent.size;
8922
+ ctx.textureTransform = new Transform2D().scale(1 / width, 1 / height);
8923
+ ctx.fillStyle = this._image;
8924
+ } else {
8925
+ ctx.fillStyle = this.color;
8926
+ }
8927
+ ctx.fill();
8928
+ }
8929
+ }
8930
+ __decorateClass$s([
8931
+ property()
8932
+ ], BaseElement2DFill.prototype, "color");
8933
+ __decorateClass$s([
8934
+ property()
8935
+ ], BaseElement2DFill.prototype, "image");
8936
+ __decorateClass$s([
8937
+ property()
8938
+ ], BaseElement2DFill.prototype, "dpi");
8939
+ __decorateClass$s([
8940
+ property()
8941
+ ], BaseElement2DFill.prototype, "rotateWithShape");
8942
+ __decorateClass$s([
8943
+ property()
8944
+ ], BaseElement2DFill.prototype, "tile");
8945
+
8946
+ var __defProp$k = Object.defineProperty;
8947
+ var __decorateClass$r = (decorators, target, key, kind) => {
8948
+ var result = void 0 ;
8949
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
8950
+ if (decorator = decorators[i])
8951
+ result = (decorator(target, key, result) ) || result;
8952
+ if (result) __defProp$k(target, key, result);
8953
+ return result;
8954
+ };
8955
+ class BaseElement2DGeometry extends CoreObject {
8956
+ constructor(parent, properties) {
8957
+ super();
8958
+ this.parent = parent;
8959
+ this.setProperties(properties);
8960
+ this._updatePath2DSet();
8961
+ }
8962
+ _path2DSet = new modernPath2d.Path2DSet();
8963
+ _updateProperty(key, value, oldValue, declaration) {
8964
+ super._updateProperty(key, value, oldValue, declaration);
8965
+ switch (key) {
8966
+ case "svg":
8967
+ case "data":
8968
+ case "viewBox":
8969
+ this._updatePath2DSet();
8970
+ this.parent.requestRedraw();
8971
+ break;
8972
+ }
8973
+ }
8974
+ _updatePath2DSet() {
8975
+ let viewBox;
8976
+ if (this.svg) {
8977
+ const dom = modernPath2d.svgToDOM(this.svg);
8978
+ this._path2DSet = modernPath2d.svgToPath2DSet(dom);
8979
+ viewBox = this._path2DSet.viewBox ?? this.viewBox;
8980
+ } else {
8981
+ viewBox = this.viewBox;
8982
+ this.data.forEach((path, i) => {
8983
+ const { data, ...style } = path;
8984
+ const path2D = new modernPath2d.Path2D();
8985
+ path2D.style = style;
8986
+ path2D.addData(data);
8987
+ this._path2DSet.paths[i] = path2D;
8988
+ });
8989
+ }
8990
+ const [x, y, w, h] = viewBox;
8991
+ this._path2DSet.paths.forEach((path) => {
8992
+ path.applyTransform(new modernPath2d.Matrix3().translate(-x, -y).scale(1 / w, 1 / h));
8993
+ });
8994
+ }
8995
+ draw() {
8996
+ const ctx = this.parent.context;
8997
+ const { width, height } = this.parent.size;
8998
+ this._path2DSet.paths.forEach((path) => {
8999
+ modernPath2d.svgPathCommandsAddToPath2D(
9000
+ path.clone().applyTransform(new modernPath2d.Matrix3().scale(width, height)).toCommands(),
9001
+ ctx
9002
+ );
9003
+ });
9004
+ }
9005
+ }
9006
+ __decorateClass$r([
9007
+ property()
9008
+ ], BaseElement2DGeometry.prototype, "name");
9009
+ __decorateClass$r([
9010
+ property()
9011
+ ], BaseElement2DGeometry.prototype, "svg");
9012
+ __decorateClass$r([
9013
+ property({ default: [0, 0, 1, 1] })
9014
+ ], BaseElement2DGeometry.prototype, "viewBox");
9015
+ __decorateClass$r([
9016
+ property({ default: [{ data: "M0,0L0,1L1,1L1,0Z" }] })
9017
+ ], BaseElement2DGeometry.prototype, "data");
9018
+
9019
+ var __defProp$j = Object.defineProperty;
9020
+ var __decorateClass$q = (decorators, target, key, kind) => {
9021
+ var result = void 0 ;
9022
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9023
+ if (decorator = decorators[i])
9024
+ result = (decorator(target, key, result) ) || result;
9025
+ if (result) __defProp$j(target, key, result);
9026
+ return result;
9027
+ };
9028
+ class BaseElement2DOutline extends CoreObject {
9029
+ constructor(parent, properties) {
9030
+ super();
9031
+ this.parent = parent;
9032
+ this.setProperties(properties);
9033
+ }
9034
+ _updateProperty(key, value, oldValue, declaration) {
9035
+ super._updateProperty(key, value, oldValue, declaration);
9036
+ switch (key) {
9037
+ case "color":
9038
+ case "width":
9039
+ case "style":
9040
+ case "image":
9041
+ case "opacity":
9042
+ this.parent.requestRedraw();
9043
+ break;
9044
+ }
9045
+ }
9046
+ canDraw() {
9047
+ return Boolean(
9048
+ this.width || this.color
9049
+ );
9050
+ }
9051
+ draw() {
9052
+ const ctx = this.parent.context;
9053
+ ctx.lineWidth = this.width;
9054
+ ctx.strokeStyle = this.color;
9055
+ ctx.stroke();
9056
+ }
9057
+ }
9058
+ __decorateClass$q([
9059
+ property({ default: 0 })
9060
+ ], BaseElement2DOutline.prototype, "color");
9061
+ __decorateClass$q([
9062
+ property({ default: 0 })
9063
+ ], BaseElement2DOutline.prototype, "width");
9064
+ __decorateClass$q([
9065
+ property({ default: "solid" })
9066
+ ], BaseElement2DOutline.prototype, "style");
9067
+ __decorateClass$q([
9068
+ property()
9069
+ ], BaseElement2DOutline.prototype, "image");
9070
+ __decorateClass$q([
9071
+ property({ default: 1 })
9072
+ ], BaseElement2DOutline.prototype, "opacity");
9073
+
9074
+ var __defProp$i = Object.defineProperty;
9075
+ var __decorateClass$p = (decorators, target, key, kind) => {
9076
+ var result = void 0 ;
9077
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9078
+ if (decorator = decorators[i])
9079
+ result = (decorator(target, key, result) ) || result;
9080
+ if (result) __defProp$i(target, key, result);
9081
+ return result;
9082
+ };
9083
+ class BaseElement2DShadow extends CoreObject {
9084
+ constructor(parent, properties) {
9085
+ super();
9086
+ this.parent = parent;
9087
+ this.setProperties(properties);
9088
+ }
9089
+ _updateProperty(key, value, oldValue, declaration) {
9090
+ super._updateProperty(key, value, oldValue, declaration);
9091
+ switch (key) {
9092
+ case "color":
9093
+ case "blur":
9094
+ case "offsetX":
9095
+ case "offsetY":
9096
+ this.updateEffect();
9097
+ break;
9098
+ }
9099
+ }
9100
+ updateEffect() {
9101
+ const name = "__$shadow";
9102
+ let effect = this.parent.getNode(name);
9103
+ if (this.blur || this.offsetX || this.offsetY) {
9104
+ if (!effect) {
9105
+ effect = new exports.DropShadowEffect({ name });
9106
+ this.parent.appendChild(effect, "back");
9107
+ }
9108
+ effect.setProperties(this.getProperties());
9109
+ } else {
9110
+ if (effect) {
9111
+ this.parent.removeChild(effect);
9112
+ }
9113
+ }
9114
+ }
9115
+ }
9116
+ __decorateClass$p([
9117
+ property({ default: "#000000" })
9118
+ ], BaseElement2DShadow.prototype, "color");
9119
+ __decorateClass$p([
9120
+ property({ default: 0 })
9121
+ ], BaseElement2DShadow.prototype, "blur");
9122
+ __decorateClass$p([
9123
+ property({ default: 0 })
9124
+ ], BaseElement2DShadow.prototype, "offsetY");
9125
+ __decorateClass$p([
9126
+ property({ default: 0 })
9127
+ ], BaseElement2DShadow.prototype, "offsetX");
9128
+
8888
9129
  class BaseElement2DStyle extends Resource {
8889
9130
  _backgroundColor = new Color();
8890
9131
  constructor(properties) {
@@ -8919,6 +9160,93 @@ for (const key in defaultStyles$1) {
8919
9160
  });
8920
9161
  }
8921
9162
 
9163
+ var __defProp$h = Object.defineProperty;
9164
+ var __decorateClass$o = (decorators, target, key, kind) => {
9165
+ var result = void 0 ;
9166
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
9167
+ if (decorator = decorators[i])
9168
+ result = (decorator(target, key, result) ) || result;
9169
+ if (result) __defProp$h(target, key, result);
9170
+ return result;
9171
+ };
9172
+ class BaseElement2DText extends CoreObject {
9173
+ constructor(parent, properties) {
9174
+ super();
9175
+ this.parent = parent;
9176
+ this.setProperties(properties);
9177
+ }
9178
+ effects;
9179
+ measureDom;
9180
+ fonts;
9181
+ texture = new CanvasTexture();
9182
+ text = new modernText.Text();
9183
+ measureResult;
9184
+ _updateProperty(key, value, oldValue, declaration) {
9185
+ super._updateProperty(key, value, oldValue, declaration);
9186
+ switch (key) {
9187
+ case "content":
9188
+ case "effects":
9189
+ case "measureDom":
9190
+ case "fonts":
9191
+ case "split":
9192
+ this.parent.requestRedraw();
9193
+ break;
9194
+ }
9195
+ }
9196
+ _updateText() {
9197
+ this.text.style = this.parent.style.toJSON();
9198
+ this.text.content = this.content ?? "";
9199
+ this.text.effects = this.effects;
9200
+ this.text.fonts = this.fonts;
9201
+ this.text.measureDom = this.measureDom;
9202
+ this.text.requestUpdate();
9203
+ }
9204
+ measure() {
9205
+ this._updateText();
9206
+ return this.text.measure();
9207
+ }
9208
+ updateMeasure() {
9209
+ this.measureResult = this.measure();
9210
+ const textWidth = this.measureResult.boundingBox.width;
9211
+ const textHeight = this.measureResult.boundingBox.height;
9212
+ const { left, top, width, height = textHeight } = this.parent.style;
9213
+ this.parent.position.x = left + Math.min(0, ((width || textWidth) - textWidth) / 2);
9214
+ this.parent.position.y = top + Math.min(0, ((height || textHeight) - textHeight) / 2);
9215
+ this.parent.size.width = textWidth;
9216
+ this.parent.size.height = textHeight;
9217
+ return this;
9218
+ }
9219
+ canDraw() {
9220
+ return Boolean(
9221
+ this.content && this.texture?.valid
9222
+ );
9223
+ }
9224
+ draw() {
9225
+ const ctx = this.parent.context;
9226
+ this.text.render({
9227
+ pixelRatio: this.texture.pixelRatio,
9228
+ view: this.texture.source
9229
+ });
9230
+ this.texture.requestUpload();
9231
+ const { width, height } = this.parent.size;
9232
+ ctx.fillStyle = this.texture;
9233
+ ctx.textureTransform = new Transform2D().scale(1 / width, 1 / height);
9234
+ ctx.fill();
9235
+ }
9236
+ }
9237
+ __decorateClass$o([
9238
+ property({ default: "" })
9239
+ ], BaseElement2DText.prototype, "content");
9240
+ __decorateClass$o([
9241
+ property()
9242
+ ], BaseElement2DText.prototype, "effects");
9243
+ __decorateClass$o([
9244
+ protectedProperty()
9245
+ ], BaseElement2DText.prototype, "measureDom");
9246
+ __decorateClass$o([
9247
+ protectedProperty()
9248
+ ], BaseElement2DText.prototype, "fonts");
9249
+
8922
9250
  var __getOwnPropDesc$m = Object.getOwnPropertyDescriptor;
8923
9251
  var __decorateClass$n = (decorators, target, key, kind) => {
8924
9252
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$m(target, key) : target;
@@ -9026,6 +9354,41 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9026
9354
  this._style?.off("updateProperty", cb);
9027
9355
  this._style = style;
9028
9356
  }
9357
+ _text = new BaseElement2DText(this);
9358
+ get text() {
9359
+ return this._text;
9360
+ }
9361
+ set text(value) {
9362
+ this._text.setProperties(value);
9363
+ }
9364
+ _geometry = new BaseElement2DGeometry(this);
9365
+ get geometry() {
9366
+ return this._geometry;
9367
+ }
9368
+ set geometry(value) {
9369
+ this._geometry.setProperties(value);
9370
+ }
9371
+ _fill = new BaseElement2DFill(this);
9372
+ get fill() {
9373
+ return this._fill;
9374
+ }
9375
+ set fill(value) {
9376
+ this._fill.setProperties(value);
9377
+ }
9378
+ _outline = new BaseElement2DOutline(this);
9379
+ get outline() {
9380
+ return this._outline;
9381
+ }
9382
+ set outline(value) {
9383
+ this._outline.setProperties(value);
9384
+ }
9385
+ _shadow = new BaseElement2DShadow(this);
9386
+ get shadow() {
9387
+ return this._shadow;
9388
+ }
9389
+ set shadow(value) {
9390
+ this._shadow.setProperties(value);
9391
+ }
9029
9392
  constructor(properties, nodes = []) {
9030
9393
  super();
9031
9394
  this._updateStyleProperty = this._updateStyleProperty.bind(this);
@@ -9034,8 +9397,21 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9034
9397
  }
9035
9398
  setProperties(properties) {
9036
9399
  if (properties) {
9037
- const { style, ...restProperties } = properties;
9400
+ const {
9401
+ style,
9402
+ text,
9403
+ geometry,
9404
+ fill,
9405
+ outline,
9406
+ shadow,
9407
+ ...restProperties
9408
+ } = properties;
9038
9409
  style && this.style.setProperties(style);
9410
+ text && this.text.setProperties(text);
9411
+ geometry && this.geometry.setProperties(geometry);
9412
+ fill && this.fill.setProperties(fill);
9413
+ outline && this.outline.setProperties(outline);
9414
+ shadow && this.shadow.setProperties(shadow);
9039
9415
  super.setProperties(restProperties);
9040
9416
  }
9041
9417
  return this;
@@ -9092,9 +9468,6 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9092
9468
  case "filter":
9093
9469
  this.requestRepaint();
9094
9470
  break;
9095
- case "boxShadow":
9096
- this._updateBoxShadow();
9097
- break;
9098
9471
  case "maskImage":
9099
9472
  this._updateMaskImage();
9100
9473
  break;
@@ -9103,20 +9476,6 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9103
9476
  break;
9104
9477
  }
9105
9478
  }
9106
- _updateBoxShadow() {
9107
- const nodePath = "__$style.shadow";
9108
- if (this.style.boxShadow !== "none") {
9109
- const node = this.getNode(nodePath);
9110
- if (node) ; else {
9111
- this.appendChild(new exports.DropShadowEffect({ name: nodePath }), "back");
9112
- }
9113
- } else {
9114
- const node = this.getNode(nodePath);
9115
- if (node) {
9116
- this.removeChild(node);
9117
- }
9118
- }
9119
- }
9120
9479
  _updateMaskImage() {
9121
9480
  const nodePath = "__$style.maskImage";
9122
9481
  const maskImage = this.style.maskImage;
@@ -9205,10 +9564,34 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9205
9564
  }
9206
9565
  _draw() {
9207
9566
  super._draw();
9208
- this._drawBackground();
9209
- this._drawContent();
9210
- this._drawBorder();
9211
- this._drawOutline();
9567
+ let flag = false;
9568
+ if (this.text.canDraw()) {
9569
+ this.text.updateMeasure();
9570
+ }
9571
+ if (this.fill.canDraw()) {
9572
+ this._tree?.log(this.name, "draw fill");
9573
+ this.geometry.draw();
9574
+ this.fill.draw();
9575
+ flag = true;
9576
+ }
9577
+ if (this.outline.canDraw()) {
9578
+ this._tree?.log(this.name, "draw outline");
9579
+ this.geometry.draw();
9580
+ this.outline.draw();
9581
+ flag = true;
9582
+ }
9583
+ if (this.text.canDraw()) {
9584
+ this._tree?.log(this.name, "draw text");
9585
+ this._drawBoundingRect();
9586
+ this.text.draw();
9587
+ flag = true;
9588
+ }
9589
+ if (!flag) {
9590
+ this._drawBackground();
9591
+ this._drawContent();
9592
+ this._drawBorder();
9593
+ this._drawOutline();
9594
+ }
9212
9595
  }
9213
9596
  _drawBackground() {
9214
9597
  const texture = this._backgroundImage;
@@ -9280,13 +9663,6 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9280
9663
  this._input(event, key);
9281
9664
  }
9282
9665
  }
9283
- _pointerEntering = false;
9284
- _pointerEntered() {
9285
- this._pointerEntering = true;
9286
- }
9287
- _pointerExited() {
9288
- if (this._pointerEntering) ;
9289
- }
9290
9666
  // eslint-disable-next-line unused-imports/no-unused-vars
9291
9667
  _pointerInput(point, key) {
9292
9668
  const { width, height } = this.size;
@@ -9319,6 +9695,11 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9319
9695
  ...json,
9320
9696
  props: {
9321
9697
  style: this.style.toJSON(),
9698
+ text: this.text.toJSON(),
9699
+ geometry: this.geometry.toJSON(),
9700
+ fill: this.fill.toJSON(),
9701
+ outline: this.outline.toJSON(),
9702
+ shadow: this.shadow.toJSON(),
9322
9703
  ...json.props
9323
9704
  }
9324
9705
  };
@@ -9983,12 +10364,12 @@ exports.Image2D = class Image2D extends exports.Element2D {
9983
10364
  __decorateClass$i([
9984
10365
  protectedProperty()
9985
10366
  ], exports.Image2D.prototype, "texture", 2);
9986
- __decorateClass$i([
9987
- property()
9988
- ], exports.Image2D.prototype, "srcRect", 2);
9989
10367
  __decorateClass$i([
9990
10368
  property({ default: "" })
9991
10369
  ], exports.Image2D.prototype, "src", 2);
10370
+ __decorateClass$i([
10371
+ property()
10372
+ ], exports.Image2D.prototype, "srcRect", 2);
9992
10373
  __decorateClass$i([
9993
10374
  property({ default: false })
9994
10375
  ], exports.Image2D.prototype, "gif", 2);
@@ -10088,7 +10469,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10088
10469
  measureDom;
10089
10470
  fonts;
10090
10471
  texture = new CanvasTexture();
10091
- text = new modernText.Text();
10472
+ _baseText = new modernText.Text();
10092
10473
  measureResult;
10093
10474
  _subTextsCount = 0;
10094
10475
  constructor(properties, children = []) {
@@ -10115,12 +10496,12 @@ exports.Text2D = class Text2D extends TextureRect2D {
10115
10496
  }
10116
10497
  }
10117
10498
  _updateText() {
10118
- this.text.style = this.style.toJSON();
10119
- this.text.content = this.content ?? "";
10120
- this.text.effects = this.effects;
10121
- this.text.fonts = this.fonts;
10122
- this.text.measureDom = this.measureDom;
10123
- this.text.requestUpdate();
10499
+ this._baseText.style = this.style.toJSON();
10500
+ this._baseText.content = this.content ?? "";
10501
+ this._baseText.effects = this.effects;
10502
+ this._baseText.fonts = this.fonts;
10503
+ this._baseText.measureDom = this.measureDom;
10504
+ this._baseText.requestUpdate();
10124
10505
  }
10125
10506
  _updateStyleProperty(key, value, oldValue) {
10126
10507
  switch (key) {
@@ -10173,7 +10554,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10173
10554
  }
10174
10555
  measure() {
10175
10556
  this._updateText();
10176
- return this.text.measure();
10557
+ return this._baseText.measure();
10177
10558
  }
10178
10559
  updateMeasure() {
10179
10560
  this.measureResult = this.measure();
@@ -10225,7 +10606,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10225
10606
  if (onText2DRender) {
10226
10607
  onText2DRender();
10227
10608
  } else {
10228
- this.text.render({
10609
+ this._baseText.render({
10229
10610
  pixelRatio: this.texture.pixelRatio,
10230
10611
  view: this.texture.source
10231
10612
  });
@@ -13542,7 +13923,12 @@ exports.Assets = Assets;
13542
13923
  exports.AudioPipeline = AudioPipeline;
13543
13924
  exports.AudioProcessor = AudioProcessor;
13544
13925
  exports.AudioSpectrum = AudioSpectrum;
13926
+ exports.BaseElement2DFill = BaseElement2DFill;
13927
+ exports.BaseElement2DGeometry = BaseElement2DGeometry;
13928
+ exports.BaseElement2DOutline = BaseElement2DOutline;
13929
+ exports.BaseElement2DShadow = BaseElement2DShadow;
13545
13930
  exports.BaseElement2DStyle = BaseElement2DStyle;
13931
+ exports.BaseElement2DText = BaseElement2DText;
13546
13932
  exports.CanvasContext = CanvasContext;
13547
13933
  exports.CanvasItemEditor = CanvasItemEditor;
13548
13934
  exports.CanvasTexture = CanvasTexture;