modern-canvas 0.4.43 → 0.4.44

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
@@ -543,6 +543,12 @@ class CoreObject extends EventEmitter {
543
543
  }
544
544
  return this;
545
545
  }
546
+ resetProperties() {
547
+ for (const [name, property] of this.getPropertyDeclarations()) {
548
+ this.setProperty(name, property.default);
549
+ }
550
+ return this;
551
+ }
546
552
  requestUpdate(key, oldValue, declaration) {
547
553
  if (key !== void 0) {
548
554
  const newValue = this[key];
@@ -565,8 +571,12 @@ class CoreObject extends EventEmitter {
565
571
  const properties = this.getProperties(Array.from(this._changedProperties));
566
572
  for (const key in properties) {
567
573
  const value = properties[key];
568
- if (value && typeof value === "object" && "toJSON" in value && typeof value.toJSON === "function") {
569
- json[key] = value.toJSON();
574
+ if (value && typeof value === "object") {
575
+ if ("toJSON" in value && typeof value.toJSON === "function") {
576
+ json[key] = value.toJSON();
577
+ } else {
578
+ json[key] = { ...value };
579
+ }
570
580
  } else {
571
581
  json[key] = value;
572
582
  }
@@ -5161,7 +5171,8 @@ class GradientTexture extends Texture2D {
5161
5171
  if (!ctx) {
5162
5172
  throw new Error("Failed to parse linear gradient, get canvas context is null.");
5163
5173
  }
5164
- const { angle, stops } = linearGradient;
5174
+ let { angle, stops } = linearGradient;
5175
+ angle -= Math.PI / 2;
5165
5176
  const halfWidth = width / 2;
5166
5177
  const halfHeight = height / 2;
5167
5178
  const length = Math.sqrt(width * width + height * height) / 2;
@@ -5598,6 +5609,56 @@ class ViewportTexture extends PixelsTexture {
5598
5609
  //
5599
5610
  }
5600
5611
 
5612
+ class Children extends Array {
5613
+ front = [];
5614
+ back = [];
5615
+ get internal() {
5616
+ return [
5617
+ ...this.front,
5618
+ ...this,
5619
+ ...this.back
5620
+ ];
5621
+ }
5622
+ constructor(...items) {
5623
+ super();
5624
+ this.set(items);
5625
+ }
5626
+ set(items) {
5627
+ this.front.length = 0;
5628
+ this.length = 0;
5629
+ this.back.length = 0;
5630
+ items.forEach((item) => {
5631
+ switch (item.internalMode) {
5632
+ case "front":
5633
+ this.front.push(item);
5634
+ break;
5635
+ case "default":
5636
+ this.push(item);
5637
+ break;
5638
+ case "back":
5639
+ this.back.push(item);
5640
+ break;
5641
+ }
5642
+ });
5643
+ return this;
5644
+ }
5645
+ getInternal(includeInternal) {
5646
+ switch (includeInternal) {
5647
+ case "front":
5648
+ return this.front;
5649
+ case "default":
5650
+ return this;
5651
+ case "back":
5652
+ return this.back;
5653
+ default:
5654
+ throw new Error(`Unknown internal mode: ${includeInternal}`);
5655
+ }
5656
+ }
5657
+ toJSON() {
5658
+ return [...this];
5659
+ }
5660
+ }
5661
+
5601
5662
  var __defProp$J = Object.defineProperty;
5602
5663
  var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
5603
5664
  var __decorateClass$R = (decorators, target, key, kind) => {
@@ -5639,7 +5700,7 @@ exports.Node = class Node extends CoreObject {
5639
5700
  } = properties;
5640
5701
  if (meta) {
5641
5702
  for (const key in meta) {
5642
- this.setMeta(key, meta[key]);
5703
+ this.meta[key] = meta[key];
5643
5704
  }
5644
5705
  }
5645
5706
  super.setProperties(restProperties);
@@ -5684,8 +5745,9 @@ exports.Node = class Node extends CoreObject {
5684
5745
  if (tree) {
5685
5746
  this.emit("treeEnter", tree);
5686
5747
  }
5687
- for (let len = this._children.length, i = 0; i < len; i++) {
5688
- const node = this._children[i];
5748
+ const children = this._children.internal;
5749
+ for (let len = children.length, i = 0; i < len; i++) {
5750
+ const node = children[i];
5689
5751
  !tree && this.emit("childExitingTree", node);
5690
5752
  node.setTree(tree);
5691
5753
  tree && this.emit("childEnteredTree", node);
@@ -5709,7 +5771,7 @@ exports.Node = class Node extends CoreObject {
5709
5771
  this.setParent(parent);
5710
5772
  }
5711
5773
  hasParent() {
5712
- return !!this._parent;
5774
+ return Boolean(this._parent);
5713
5775
  }
5714
5776
  getParent() {
5715
5777
  return this._parent;
@@ -5729,7 +5791,13 @@ exports.Node = class Node extends CoreObject {
5729
5791
  return this;
5730
5792
  }
5731
5793
  /** Children */
5732
- _children = [];
5794
+ _children = new Children();
5795
+ get children() {
5796
+ return this._children;
5797
+ }
5798
+ set children(value) {
5799
+ value instanceof Children ? this._children = value : this._children.set(value);
5800
+ }
5733
5801
  get siblingIndex() {
5734
5802
  return this.getIndex();
5735
5803
  }
@@ -5737,35 +5805,18 @@ exports.Node = class Node extends CoreObject {
5737
5805
  this._parent?.moveChild(this, toIndex);
5738
5806
  }
5739
5807
  get previousSibling() {
5740
- return this._parent?.getChildren()[this.getIndex() - 1];
5808
+ return this._parent?.children[this.getIndex() - 1];
5741
5809
  }
5742
5810
  get nextSibling() {
5743
- return this._parent?.getChildren()[this.getIndex() + 1];
5811
+ return this._parent?.children[this.getIndex() + 1];
5744
5812
  }
5745
5813
  get firstSibling() {
5746
- return this._parent?.getChildren()[0];
5814
+ return this._parent?.children[0];
5747
5815
  }
5748
5816
  get lastSibling() {
5749
- const children = this._parent?.getChildren();
5817
+ const children = this._parent?.children;
5750
5818
  return children ? children[children.length - 1] : void 0;
5751
5819
  }
5752
- /** Meta */
5753
- _meta = /* @__PURE__ */ new Map();
5754
- hasMeta(name) {
5755
- return this._meta.has(name);
5756
- }
5757
- getMeta(name, defaultVal) {
5758
- return this._meta.get(name) ?? defaultVal;
5759
- }
5760
- setMeta(name, value) {
5761
- this._meta.set(name, value);
5762
- }
5763
- deleteMeta(name) {
5764
- this._meta.delete(name);
5765
- }
5766
- clearMeta() {
5767
- this._meta.clear();
5768
- }
5769
5820
  canProcess() {
5770
5821
  if (!this._tree)
5771
5822
  return false;
@@ -5826,8 +5877,7 @@ exports.Node = class Node extends CoreObject {
5826
5877
  const canProcess = this.canProcess();
5827
5878
  const childrenInBefore = [];
5828
5879
  const childrenInAfter = [];
5829
- for (let len = this._children.length, i = 0; i < len; i++) {
5830
- const child = this._children[i];
5880
+ this._children.internal.forEach((child) => {
5831
5881
  switch (child.processSortMode) {
5832
5882
  case "default":
5833
5883
  childrenInAfter.push(child);
@@ -5836,7 +5886,7 @@ exports.Node = class Node extends CoreObject {
5836
5886
  childrenInBefore.push(child);
5837
5887
  break;
5838
5888
  }
5839
- }
5889
+ });
5840
5890
  childrenInBefore.forEach((child) => {
5841
5891
  child.emit("process", delta);
5842
5892
  });
@@ -5887,27 +5937,14 @@ exports.Node = class Node extends CoreObject {
5887
5937
  }
5888
5938
  }
5889
5939
  input(event, key) {
5890
- for (let i = this._children.length - 1; i >= 0; i--) {
5891
- this._children[i].input(event, key);
5892
- }
5940
+ this._children.internal.forEach((child) => child.input(event, key));
5893
5941
  this._input(event, key);
5894
5942
  }
5895
- /** Children */
5896
- getChildren(includeInternal = false) {
5897
- switch (includeInternal) {
5898
- case true:
5899
- return this._children;
5900
- case false:
5901
- return this._children.filter((child) => child.internalMode === "default");
5902
- default:
5903
- return this._children.filter((child) => child.internalMode === includeInternal);
5904
- }
5905
- }
5906
- getIndex(includeInternal = false) {
5907
- return this._parent?.getChildren(includeInternal).indexOf(this) ?? 0;
5943
+ getIndex() {
5944
+ return this._parent?.children.getInternal(this.internalMode).indexOf(this) ?? 0;
5908
5945
  }
5909
5946
  getNode(path) {
5910
- return this._children.find((child) => child.name === path);
5947
+ return this._children.internal.find((child) => child.name === path);
5911
5948
  }
5912
5949
  removeNode(path) {
5913
5950
  this.getNode(path)?.remove();
@@ -5917,7 +5954,7 @@ exports.Node = class Node extends CoreObject {
5917
5954
  return this;
5918
5955
  }
5919
5956
  sibling.internalMode = this.internalMode;
5920
- this._parent.moveChild(sibling, this.getIndex(true) + 1);
5957
+ this._parent.moveChild(sibling, this.getIndex() + 1);
5921
5958
  return this;
5922
5959
  }
5923
5960
  prepend(...nodes) {
@@ -5950,7 +5987,7 @@ exports.Node = class Node extends CoreObject {
5950
5987
  _nodes = nodes;
5951
5988
  }
5952
5989
  _nodes.forEach((node) => {
5953
- this._parent?.moveChild(node, this.getIndex(true));
5990
+ this._parent?.moveChild(node, this.getIndex());
5954
5991
  });
5955
5992
  }
5956
5993
  after(...nodes) {
@@ -5961,128 +5998,83 @@ exports.Node = class Node extends CoreObject {
5961
5998
  _nodes = nodes;
5962
5999
  }
5963
6000
  _nodes.forEach((node) => {
5964
- this._parent?.moveChild(node, this.getIndex(true) + 1);
6001
+ this._parent?.moveChild(node, this.getIndex() + 1);
5965
6002
  });
5966
6003
  }
5967
6004
  insertBefore(node, child) {
5968
6005
  if (!child.hasParent() || !this.is(child.parent)) {
5969
6006
  return node;
5970
6007
  }
5971
- this.moveChild(node, child.getIndex(true));
6008
+ this.moveChild(node, child.getIndex());
5972
6009
  return node;
5973
6010
  }
5974
6011
  appendChild(node, internalMode = node.internalMode) {
5975
6012
  if (this.is(node) || node.hasParent()) {
5976
6013
  return node;
5977
6014
  }
5978
- let index = -1;
5979
6015
  switch (internalMode) {
5980
- case "default":
5981
- index = this._children.findLastIndex((node2) => node2.internalMode === "default");
5982
- if (index > -1) {
5983
- index += 1;
5984
- } else {
5985
- index = this._children.findIndex((node2) => node2.internalMode === "back");
5986
- }
6016
+ case "front":
6017
+ this._children.front.push(node);
5987
6018
  break;
5988
- case "front": {
5989
- index = this._children.findLastIndex((node2) => node2.internalMode === "front");
5990
- if (index > -1) {
5991
- index += 1;
5992
- } else {
5993
- index = this._children.findIndex((node2) => node2.internalMode === "default");
5994
- }
5995
- if (index > -1) {
5996
- index += 1;
5997
- } else {
5998
- index = this._children.findIndex((node2) => node2.internalMode === "back");
5999
- }
6019
+ case "default":
6020
+ this._children.push(node);
6000
6021
  break;
6001
- }
6002
6022
  case "back":
6003
- this._children.push(node);
6023
+ this._children.back.push(node);
6004
6024
  break;
6005
6025
  }
6006
- if (index > -1) {
6007
- this._children.splice(index, 0, node);
6008
- } else {
6009
- this._children.push(node);
6010
- }
6011
6026
  node.internalMode = internalMode;
6012
6027
  node.setParent(this);
6013
6028
  this.emit("appendChild", node);
6014
6029
  return node;
6015
6030
  }
6016
- moveChild(child, toIndex, internalMode = child.internalMode) {
6017
- if (this.is(child) || child.hasParent() && !this.is(child.parent)) {
6031
+ moveChild(node, toIndex, internalMode = node.internalMode) {
6032
+ if (this.is(node) || node.hasParent() && !this.is(node.parent)) {
6018
6033
  return this;
6019
6034
  }
6020
- child.internalMode = internalMode;
6021
- const oldIndex = this._children.indexOf(child);
6022
- let minIndex = this._children.findIndex((_child) => {
6023
- switch (internalMode) {
6024
- case "default":
6025
- return _child.internalMode !== "front";
6026
- case "back":
6027
- return _child.internalMode === "back";
6028
- case "front":
6029
- default:
6030
- return true;
6035
+ const fromArray = this._children.getInternal(node.internalMode);
6036
+ const fromIndex = fromArray.indexOf(node);
6037
+ const toArray = this._children.getInternal(internalMode);
6038
+ if (node.internalMode !== internalMode || toIndex !== fromIndex) {
6039
+ if (fromIndex > -1) {
6040
+ fromArray.splice(fromIndex, 1);
6031
6041
  }
6032
- });
6033
- minIndex = minIndex > -1 ? minIndex : Math.max(0, this._children.length - 1);
6034
- let maxIndex = this._children.slice(minIndex).findIndex((_child) => {
6035
- switch (internalMode) {
6036
- case "front":
6037
- return _child.internalMode !== "front";
6038
- case "default":
6039
- return _child.internalMode === "back";
6040
- case "back":
6041
- default:
6042
- return false;
6043
- }
6044
- });
6045
- maxIndex = maxIndex > -1 ? minIndex + maxIndex : Math.max(0, this._children.length);
6046
- const newIndex = clamp(minIndex, toIndex > -1 ? toIndex : maxIndex, maxIndex);
6047
- if (newIndex !== oldIndex) {
6048
- if (oldIndex > -1) {
6049
- this._children.splice(oldIndex, 1);
6050
- }
6051
- child.setParent(this);
6052
- if (newIndex > -1 && newIndex < this._children.length) {
6053
- this._children.splice(newIndex, 0, child);
6042
+ node.setParent(this);
6043
+ if (toIndex > -1 && toIndex < toArray.length) {
6044
+ toArray.splice(toIndex, 0, node);
6054
6045
  } else {
6055
- this._children.push(child);
6046
+ toArray.push(node);
6056
6047
  }
6057
- if (oldIndex > -1) {
6058
- this.emit("moveChild", child, newIndex, oldIndex);
6048
+ if (fromIndex > -1) {
6049
+ this.emit("moveChild", node, toIndex, fromIndex);
6059
6050
  } else {
6060
- this.emit("appendChild", child);
6051
+ this.emit("appendChild", node);
6061
6052
  }
6062
6053
  }
6054
+ node.internalMode = internalMode;
6063
6055
  return this;
6064
6056
  }
6065
6057
  removeChild(child) {
6066
- const index = child.getIndex(true);
6058
+ const index = child.getIndex();
6067
6059
  if (this.is(child.parent) && index > -1) {
6068
- this._children.splice(index, 1);
6060
+ this._children.internal.splice(index, 1);
6069
6061
  child.setParent(void 0);
6070
6062
  this.emit("removeChild", child, index);
6071
6063
  }
6072
6064
  return child;
6073
6065
  }
6074
6066
  removeChildren() {
6075
- this.getChildren().forEach((child) => this.removeChild(child));
6067
+ this._children.forEach((child) => this.removeChild(child));
6076
6068
  }
6077
6069
  remove() {
6078
6070
  this._parent?.removeChild(this);
6079
6071
  }
6080
6072
  forEachChild(callbackfn) {
6081
- this.getChildren().forEach(callbackfn);
6073
+ this._children.forEach(callbackfn);
6082
6074
  return this;
6083
6075
  }
6084
6076
  forEachDescendant(callbackfn) {
6085
- this.getChildren().forEach((child) => {
6077
+ this._children.forEach((child) => {
6086
6078
  callbackfn(child);
6087
6079
  child.forEachDescendant(callbackfn);
6088
6080
  });
@@ -6115,18 +6107,14 @@ exports.Node = class Node extends CoreObject {
6115
6107
  clone() {
6116
6108
  return new this.constructor(
6117
6109
  this.toJSON().props,
6118
- this.getChildren(true)
6110
+ this._children.internal
6119
6111
  );
6120
6112
  }
6121
6113
  toJSON() {
6122
6114
  return {
6123
6115
  tag: this.tag,
6124
- props: {
6125
- name: this.name,
6126
- ...super.toJSON()
6127
- },
6128
- meta: Object.fromEntries(this._meta.entries()),
6129
- children: this.getChildren().map((child) => child.toJSON())
6116
+ props: super.toJSON(),
6117
+ children: [...this._children.map((child) => child.toJSON())]
6130
6118
  };
6131
6119
  }
6132
6120
  static parse(JSON) {
@@ -6141,7 +6129,7 @@ exports.Node = class Node extends CoreObject {
6141
6129
  }
6142
6130
  };
6143
6131
  __decorateClass$R([
6144
- protectedProperty()
6132
+ property()
6145
6133
  ], exports.Node.prototype, "name", 2);
6146
6134
  __decorateClass$R([
6147
6135
  property()
@@ -6158,6 +6146,9 @@ __decorateClass$R([
6158
6146
  __decorateClass$R([
6159
6147
  property({ default: "default" })
6160
6148
  ], exports.Node.prototype, "internalMode", 2);
6149
+ __decorateClass$R([
6150
+ property({ default: {} })
6151
+ ], exports.Node.prototype, "meta", 2);
6161
6152
  exports.Node = __decorateClass$R([
6162
6153
  customNode("Node")
6163
6154
  ], exports.Node);
@@ -7673,7 +7664,7 @@ class SceneTree extends MainLoop {
7673
7664
  }
7674
7665
  free() {
7675
7666
  super.free();
7676
- this.root.getChildren(true).forEach((node) => this.root.removeChild(node));
7667
+ this.root.children.internal.forEach((node) => this.root.removeChild(node));
7677
7668
  this.input.removeEventListeners();
7678
7669
  }
7679
7670
  }
@@ -8974,7 +8965,9 @@ class BaseElement2DFill extends CoreObject {
8974
8965
  return super.setProperties(properties);
8975
8966
  }
8976
8967
  setProperties(properties) {
8977
- return this._setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeFill(properties));
8968
+ return this._setProperties(
8969
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeFill(properties)
8970
+ );
8978
8971
  }
8979
8972
  _updateProperty(key, value, oldValue, declaration) {
8980
8973
  super._updateProperty(key, value, oldValue, declaration);
@@ -9105,7 +9098,9 @@ var __decorateClass$t = (decorators, target, key, kind) => {
9105
9098
  };
9106
9099
  class BaseElement2DBackground extends BaseElement2DFill {
9107
9100
  setProperties(properties) {
9108
- return super._setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeBackground(properties));
9101
+ return super._setProperties(
9102
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeBackground(properties)
9103
+ );
9109
9104
  }
9110
9105
  }
9111
9106
  __decorateClass$t([
@@ -9123,7 +9118,9 @@ var __decorateClass$s = (decorators, target, key, kind) => {
9123
9118
  };
9124
9119
  class BaseElement2DForeground extends BaseElement2DFill {
9125
9120
  setProperties(properties) {
9126
- return super._setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeForeground(properties));
9121
+ return super._setProperties(
9122
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeForeground(properties)
9123
+ );
9127
9124
  }
9128
9125
  }
9129
9126
  __decorateClass$s([
@@ -9141,7 +9138,9 @@ var __decorateClass$r = (decorators, target, key, kind) => {
9141
9138
  };
9142
9139
  class BaseElement2DOutline extends BaseElement2DFill {
9143
9140
  setProperties(properties) {
9144
- return super._setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeOutline(properties));
9141
+ return super._setProperties(
9142
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeOutline(properties)
9143
+ );
9145
9144
  }
9146
9145
  _updateProperty(key, value, oldValue, declaration) {
9147
9146
  super._updateProperty(key, value, oldValue, declaration);
@@ -9191,7 +9190,9 @@ class BaseElement2DShadow extends CoreObject {
9191
9190
  this.parent = parent;
9192
9191
  }
9193
9192
  setProperties(properties) {
9194
- return super.setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShadow(properties));
9193
+ return super.setProperties(
9194
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShadow(properties)
9195
+ );
9195
9196
  }
9196
9197
  _updateProperty(key, value, oldValue, declaration) {
9197
9198
  super._updateProperty(key, value, oldValue, declaration);
@@ -9250,7 +9251,9 @@ class BaseElement2DShape extends CoreObject {
9250
9251
  }
9251
9252
  _path2DSet = new modernPath2d.Path2DSet();
9252
9253
  setProperties(properties) {
9253
- return super.setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShape(properties));
9254
+ return super.setProperties(
9255
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeShape(properties)
9256
+ );
9254
9257
  }
9255
9258
  _updateProperty(key, value, oldValue, declaration) {
9256
9259
  super._updateProperty(key, value, oldValue, declaration);
@@ -9359,7 +9362,9 @@ class BaseElement2DText extends CoreObject {
9359
9362
  baseText = new modernText.Text();
9360
9363
  measureResult;
9361
9364
  setProperties(properties) {
9362
- return super.setProperties(modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeText(properties));
9365
+ return super.setProperties(
9366
+ modernIdoc.isNone(properties) ? void 0 : modernIdoc.normalizeText(properties)
9367
+ );
9363
9368
  }
9364
9369
  _updateProperty(key, value, oldValue, declaration) {
9365
9370
  super._updateProperty(key, value, oldValue, declaration);
@@ -9544,49 +9549,49 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
9544
9549
  return this._background;
9545
9550
  }
9546
9551
  set background(value) {
9547
- this._background.setProperties(value);
9552
+ this._background.resetProperties().setProperties(value);
9548
9553
  }
9549
9554
  _shape = new BaseElement2DShape(this);
9550
9555
  get shape() {
9551
9556
  return this._shape;
9552
9557
  }
9553
9558
  set shape(value) {
9554
- this._shape.setProperties(value);
9559
+ this._shape.resetProperties().setProperties(value);
9555
9560
  }
9556
9561
  _fill = new BaseElement2DFill(this);
9557
9562
  get fill() {
9558
9563
  return this._fill;
9559
9564
  }
9560
9565
  set fill(value) {
9561
- this._fill.setProperties(value);
9566
+ this._fill.resetProperties().setProperties(value);
9562
9567
  }
9563
9568
  _outline = new BaseElement2DOutline(this);
9564
9569
  get outline() {
9565
9570
  return this._outline;
9566
9571
  }
9567
9572
  set outline(value) {
9568
- this._outline.setProperties(value);
9573
+ this._outline.resetProperties().setProperties(value);
9569
9574
  }
9570
9575
  _foreground = new BaseElement2DForeground(this);
9571
9576
  get foreground() {
9572
9577
  return this._foreground;
9573
9578
  }
9574
9579
  set foreground(value) {
9575
- this._foreground.setProperties(value);
9580
+ this._foreground.resetProperties().setProperties(value);
9576
9581
  }
9577
9582
  _text = new BaseElement2DText(this);
9578
9583
  get text() {
9579
9584
  return this._text;
9580
9585
  }
9581
9586
  set text(value) {
9582
- this._text.setProperties(value);
9587
+ this._text.resetProperties().setProperties(value);
9583
9588
  }
9584
9589
  _shadow = new BaseElement2DShadow(this);
9585
9590
  get shadow() {
9586
9591
  return this._shadow;
9587
9592
  }
9588
9593
  set shadow(value) {
9589
- this._shadow.setProperties(value);
9594
+ this._shadow.resetProperties().setProperties(value);
9590
9595
  }
9591
9596
  constructor(properties, nodes = []) {
9592
9597
  super();
@@ -10696,7 +10701,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10696
10701
  }
10697
10702
  }
10698
10703
  _getSubTexts() {
10699
- return this.getChildren("front").filter((node) => node instanceof exports.Text2D);
10704
+ return this.children.front.filter((node) => node instanceof exports.Text2D);
10700
10705
  }
10701
10706
  _updateSubTexts() {
10702
10707
  const subTexts = this._getSubTexts();
@@ -10732,7 +10737,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10732
10737
  }
10733
10738
  _updateSplit() {
10734
10739
  if (this._subTextsCount) {
10735
- this.getChildren("front").forEach((child) => this.removeChild(child));
10740
+ this.children.front.forEach((child) => this.removeChild(child));
10736
10741
  this._subTextsCount = 0;
10737
10742
  }
10738
10743
  if (this.split) {
@@ -10766,7 +10771,7 @@ exports.Text2D = class Text2D extends TextureRect2D {
10766
10771
  }
10767
10772
  _drawContent() {
10768
10773
  if (!this.split) {
10769
- const onText2DRender = this.getChildren()?.find((child) => "onText2DRender" in child)?.onText2DRender;
10774
+ const onText2DRender = this.children?.find((child) => "onText2DRender" in child)?.onText2DRender;
10770
10775
  if (onText2DRender) {
10771
10776
  onText2DRender();
10772
10777
  } else {
@@ -11025,7 +11030,7 @@ exports.Animation = class Animation extends exports.TimelineNode {
11025
11030
  let targets;
11026
11031
  switch (this.effectMode) {
11027
11032
  case "sibling":
11028
- targets = this.getParent()?.getChildren(true).filter((val) => val instanceof exports.CanvasItem) ?? [];
11033
+ targets = this.getParent()?.children.internal.filter((val) => val instanceof exports.CanvasItem) ?? [];
11029
11034
  break;
11030
11035
  case "parent":
11031
11036
  default: