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 +156 -151
- package/dist/index.d.cts +19 -14
- package/dist/index.d.mts +19 -14
- package/dist/index.d.ts +19 -14
- package/dist/index.js +35 -35
- package/dist/index.mjs +156 -151
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -537,6 +537,12 @@ class CoreObject extends EventEmitter {
|
|
|
537
537
|
}
|
|
538
538
|
return this;
|
|
539
539
|
}
|
|
540
|
+
resetProperties() {
|
|
541
|
+
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
542
|
+
this.setProperty(name, property.default);
|
|
543
|
+
}
|
|
544
|
+
return this;
|
|
545
|
+
}
|
|
540
546
|
requestUpdate(key, oldValue, declaration) {
|
|
541
547
|
if (key !== void 0) {
|
|
542
548
|
const newValue = this[key];
|
|
@@ -559,8 +565,12 @@ class CoreObject extends EventEmitter {
|
|
|
559
565
|
const properties = this.getProperties(Array.from(this._changedProperties));
|
|
560
566
|
for (const key in properties) {
|
|
561
567
|
const value = properties[key];
|
|
562
|
-
if (value && typeof value === "object"
|
|
563
|
-
|
|
568
|
+
if (value && typeof value === "object") {
|
|
569
|
+
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
570
|
+
json[key] = value.toJSON();
|
|
571
|
+
} else {
|
|
572
|
+
json[key] = { ...value };
|
|
573
|
+
}
|
|
564
574
|
} else {
|
|
565
575
|
json[key] = value;
|
|
566
576
|
}
|
|
@@ -5155,7 +5165,8 @@ class GradientTexture extends Texture2D {
|
|
|
5155
5165
|
if (!ctx) {
|
|
5156
5166
|
throw new Error("Failed to parse linear gradient, get canvas context is null.");
|
|
5157
5167
|
}
|
|
5158
|
-
|
|
5168
|
+
let { angle, stops } = linearGradient;
|
|
5169
|
+
angle -= Math.PI / 2;
|
|
5159
5170
|
const halfWidth = width / 2;
|
|
5160
5171
|
const halfHeight = height / 2;
|
|
5161
5172
|
const length = Math.sqrt(width * width + height * height) / 2;
|
|
@@ -5592,6 +5603,56 @@ class ViewportTexture extends PixelsTexture {
|
|
|
5592
5603
|
//
|
|
5593
5604
|
}
|
|
5594
5605
|
|
|
5606
|
+
class Children extends Array {
|
|
5607
|
+
front = [];
|
|
5608
|
+
back = [];
|
|
5609
|
+
get internal() {
|
|
5610
|
+
return [
|
|
5611
|
+
...this.front,
|
|
5612
|
+
...this,
|
|
5613
|
+
...this.back
|
|
5614
|
+
];
|
|
5615
|
+
}
|
|
5616
|
+
constructor(...items) {
|
|
5617
|
+
super();
|
|
5618
|
+
this.set(items);
|
|
5619
|
+
}
|
|
5620
|
+
set(items) {
|
|
5621
|
+
this.front.length = 0;
|
|
5622
|
+
this.length = 0;
|
|
5623
|
+
this.back.length = 0;
|
|
5624
|
+
items.forEach((item) => {
|
|
5625
|
+
switch (item.internalMode) {
|
|
5626
|
+
case "front":
|
|
5627
|
+
this.front.push(item);
|
|
5628
|
+
break;
|
|
5629
|
+
case "default":
|
|
5630
|
+
this.push(item);
|
|
5631
|
+
break;
|
|
5632
|
+
case "back":
|
|
5633
|
+
this.back.push(item);
|
|
5634
|
+
break;
|
|
5635
|
+
}
|
|
5636
|
+
});
|
|
5637
|
+
return this;
|
|
5638
|
+
}
|
|
5639
|
+
getInternal(includeInternal) {
|
|
5640
|
+
switch (includeInternal) {
|
|
5641
|
+
case "front":
|
|
5642
|
+
return this.front;
|
|
5643
|
+
case "default":
|
|
5644
|
+
return this;
|
|
5645
|
+
case "back":
|
|
5646
|
+
return this.back;
|
|
5647
|
+
default:
|
|
5648
|
+
throw new Error(`Unknown internal mode: ${includeInternal}`);
|
|
5649
|
+
}
|
|
5650
|
+
}
|
|
5651
|
+
toJSON() {
|
|
5652
|
+
return [...this];
|
|
5653
|
+
}
|
|
5654
|
+
}
|
|
5655
|
+
|
|
5595
5656
|
var __defProp$J = Object.defineProperty;
|
|
5596
5657
|
var __getOwnPropDesc$I = Object.getOwnPropertyDescriptor;
|
|
5597
5658
|
var __decorateClass$R = (decorators, target, key, kind) => {
|
|
@@ -5633,7 +5694,7 @@ let Node = class extends CoreObject {
|
|
|
5633
5694
|
} = properties;
|
|
5634
5695
|
if (meta) {
|
|
5635
5696
|
for (const key in meta) {
|
|
5636
|
-
this.
|
|
5697
|
+
this.meta[key] = meta[key];
|
|
5637
5698
|
}
|
|
5638
5699
|
}
|
|
5639
5700
|
super.setProperties(restProperties);
|
|
@@ -5678,8 +5739,9 @@ let Node = class extends CoreObject {
|
|
|
5678
5739
|
if (tree) {
|
|
5679
5740
|
this.emit("treeEnter", tree);
|
|
5680
5741
|
}
|
|
5681
|
-
|
|
5682
|
-
|
|
5742
|
+
const children = this._children.internal;
|
|
5743
|
+
for (let len = children.length, i = 0; i < len; i++) {
|
|
5744
|
+
const node = children[i];
|
|
5683
5745
|
!tree && this.emit("childExitingTree", node);
|
|
5684
5746
|
node.setTree(tree);
|
|
5685
5747
|
tree && this.emit("childEnteredTree", node);
|
|
@@ -5703,7 +5765,7 @@ let Node = class extends CoreObject {
|
|
|
5703
5765
|
this.setParent(parent);
|
|
5704
5766
|
}
|
|
5705
5767
|
hasParent() {
|
|
5706
|
-
return
|
|
5768
|
+
return Boolean(this._parent);
|
|
5707
5769
|
}
|
|
5708
5770
|
getParent() {
|
|
5709
5771
|
return this._parent;
|
|
@@ -5723,7 +5785,13 @@ let Node = class extends CoreObject {
|
|
|
5723
5785
|
return this;
|
|
5724
5786
|
}
|
|
5725
5787
|
/** Children */
|
|
5726
|
-
_children =
|
|
5788
|
+
_children = new Children();
|
|
5789
|
+
get children() {
|
|
5790
|
+
return this._children;
|
|
5791
|
+
}
|
|
5792
|
+
set children(value) {
|
|
5793
|
+
value instanceof Children ? this._children = value : this._children.set(value);
|
|
5794
|
+
}
|
|
5727
5795
|
get siblingIndex() {
|
|
5728
5796
|
return this.getIndex();
|
|
5729
5797
|
}
|
|
@@ -5731,35 +5799,18 @@ let Node = class extends CoreObject {
|
|
|
5731
5799
|
this._parent?.moveChild(this, toIndex);
|
|
5732
5800
|
}
|
|
5733
5801
|
get previousSibling() {
|
|
5734
|
-
return this._parent?.
|
|
5802
|
+
return this._parent?.children[this.getIndex() - 1];
|
|
5735
5803
|
}
|
|
5736
5804
|
get nextSibling() {
|
|
5737
|
-
return this._parent?.
|
|
5805
|
+
return this._parent?.children[this.getIndex() + 1];
|
|
5738
5806
|
}
|
|
5739
5807
|
get firstSibling() {
|
|
5740
|
-
return this._parent?.
|
|
5808
|
+
return this._parent?.children[0];
|
|
5741
5809
|
}
|
|
5742
5810
|
get lastSibling() {
|
|
5743
|
-
const children = this._parent?.
|
|
5811
|
+
const children = this._parent?.children;
|
|
5744
5812
|
return children ? children[children.length - 1] : void 0;
|
|
5745
5813
|
}
|
|
5746
|
-
/** Meta */
|
|
5747
|
-
_meta = /* @__PURE__ */ new Map();
|
|
5748
|
-
hasMeta(name) {
|
|
5749
|
-
return this._meta.has(name);
|
|
5750
|
-
}
|
|
5751
|
-
getMeta(name, defaultVal) {
|
|
5752
|
-
return this._meta.get(name) ?? defaultVal;
|
|
5753
|
-
}
|
|
5754
|
-
setMeta(name, value) {
|
|
5755
|
-
this._meta.set(name, value);
|
|
5756
|
-
}
|
|
5757
|
-
deleteMeta(name) {
|
|
5758
|
-
this._meta.delete(name);
|
|
5759
|
-
}
|
|
5760
|
-
clearMeta() {
|
|
5761
|
-
this._meta.clear();
|
|
5762
|
-
}
|
|
5763
5814
|
canProcess() {
|
|
5764
5815
|
if (!this._tree)
|
|
5765
5816
|
return false;
|
|
@@ -5820,8 +5871,7 @@ let Node = class extends CoreObject {
|
|
|
5820
5871
|
const canProcess = this.canProcess();
|
|
5821
5872
|
const childrenInBefore = [];
|
|
5822
5873
|
const childrenInAfter = [];
|
|
5823
|
-
|
|
5824
|
-
const child = this._children[i];
|
|
5874
|
+
this._children.internal.forEach((child) => {
|
|
5825
5875
|
switch (child.processSortMode) {
|
|
5826
5876
|
case "default":
|
|
5827
5877
|
childrenInAfter.push(child);
|
|
@@ -5830,7 +5880,7 @@ let Node = class extends CoreObject {
|
|
|
5830
5880
|
childrenInBefore.push(child);
|
|
5831
5881
|
break;
|
|
5832
5882
|
}
|
|
5833
|
-
}
|
|
5883
|
+
});
|
|
5834
5884
|
childrenInBefore.forEach((child) => {
|
|
5835
5885
|
child.emit("process", delta);
|
|
5836
5886
|
});
|
|
@@ -5881,27 +5931,14 @@ let Node = class extends CoreObject {
|
|
|
5881
5931
|
}
|
|
5882
5932
|
}
|
|
5883
5933
|
input(event, key) {
|
|
5884
|
-
|
|
5885
|
-
this._children[i].input(event, key);
|
|
5886
|
-
}
|
|
5934
|
+
this._children.internal.forEach((child) => child.input(event, key));
|
|
5887
5935
|
this._input(event, key);
|
|
5888
5936
|
}
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
switch (includeInternal) {
|
|
5892
|
-
case true:
|
|
5893
|
-
return this._children;
|
|
5894
|
-
case false:
|
|
5895
|
-
return this._children.filter((child) => child.internalMode === "default");
|
|
5896
|
-
default:
|
|
5897
|
-
return this._children.filter((child) => child.internalMode === includeInternal);
|
|
5898
|
-
}
|
|
5899
|
-
}
|
|
5900
|
-
getIndex(includeInternal = false) {
|
|
5901
|
-
return this._parent?.getChildren(includeInternal).indexOf(this) ?? 0;
|
|
5937
|
+
getIndex() {
|
|
5938
|
+
return this._parent?.children.getInternal(this.internalMode).indexOf(this) ?? 0;
|
|
5902
5939
|
}
|
|
5903
5940
|
getNode(path) {
|
|
5904
|
-
return this._children.find((child) => child.name === path);
|
|
5941
|
+
return this._children.internal.find((child) => child.name === path);
|
|
5905
5942
|
}
|
|
5906
5943
|
removeNode(path) {
|
|
5907
5944
|
this.getNode(path)?.remove();
|
|
@@ -5911,7 +5948,7 @@ let Node = class extends CoreObject {
|
|
|
5911
5948
|
return this;
|
|
5912
5949
|
}
|
|
5913
5950
|
sibling.internalMode = this.internalMode;
|
|
5914
|
-
this._parent.moveChild(sibling, this.getIndex(
|
|
5951
|
+
this._parent.moveChild(sibling, this.getIndex() + 1);
|
|
5915
5952
|
return this;
|
|
5916
5953
|
}
|
|
5917
5954
|
prepend(...nodes) {
|
|
@@ -5944,7 +5981,7 @@ let Node = class extends CoreObject {
|
|
|
5944
5981
|
_nodes = nodes;
|
|
5945
5982
|
}
|
|
5946
5983
|
_nodes.forEach((node) => {
|
|
5947
|
-
this._parent?.moveChild(node, this.getIndex(
|
|
5984
|
+
this._parent?.moveChild(node, this.getIndex());
|
|
5948
5985
|
});
|
|
5949
5986
|
}
|
|
5950
5987
|
after(...nodes) {
|
|
@@ -5955,128 +5992,83 @@ let Node = class extends CoreObject {
|
|
|
5955
5992
|
_nodes = nodes;
|
|
5956
5993
|
}
|
|
5957
5994
|
_nodes.forEach((node) => {
|
|
5958
|
-
this._parent?.moveChild(node, this.getIndex(
|
|
5995
|
+
this._parent?.moveChild(node, this.getIndex() + 1);
|
|
5959
5996
|
});
|
|
5960
5997
|
}
|
|
5961
5998
|
insertBefore(node, child) {
|
|
5962
5999
|
if (!child.hasParent() || !this.is(child.parent)) {
|
|
5963
6000
|
return node;
|
|
5964
6001
|
}
|
|
5965
|
-
this.moveChild(node, child.getIndex(
|
|
6002
|
+
this.moveChild(node, child.getIndex());
|
|
5966
6003
|
return node;
|
|
5967
6004
|
}
|
|
5968
6005
|
appendChild(node, internalMode = node.internalMode) {
|
|
5969
6006
|
if (this.is(node) || node.hasParent()) {
|
|
5970
6007
|
return node;
|
|
5971
6008
|
}
|
|
5972
|
-
let index = -1;
|
|
5973
6009
|
switch (internalMode) {
|
|
5974
|
-
case "
|
|
5975
|
-
|
|
5976
|
-
if (index > -1) {
|
|
5977
|
-
index += 1;
|
|
5978
|
-
} else {
|
|
5979
|
-
index = this._children.findIndex((node2) => node2.internalMode === "back");
|
|
5980
|
-
}
|
|
6010
|
+
case "front":
|
|
6011
|
+
this._children.front.push(node);
|
|
5981
6012
|
break;
|
|
5982
|
-
case "
|
|
5983
|
-
|
|
5984
|
-
if (index > -1) {
|
|
5985
|
-
index += 1;
|
|
5986
|
-
} else {
|
|
5987
|
-
index = this._children.findIndex((node2) => node2.internalMode === "default");
|
|
5988
|
-
}
|
|
5989
|
-
if (index > -1) {
|
|
5990
|
-
index += 1;
|
|
5991
|
-
} else {
|
|
5992
|
-
index = this._children.findIndex((node2) => node2.internalMode === "back");
|
|
5993
|
-
}
|
|
6013
|
+
case "default":
|
|
6014
|
+
this._children.push(node);
|
|
5994
6015
|
break;
|
|
5995
|
-
}
|
|
5996
6016
|
case "back":
|
|
5997
|
-
this._children.push(node);
|
|
6017
|
+
this._children.back.push(node);
|
|
5998
6018
|
break;
|
|
5999
6019
|
}
|
|
6000
|
-
if (index > -1) {
|
|
6001
|
-
this._children.splice(index, 0, node);
|
|
6002
|
-
} else {
|
|
6003
|
-
this._children.push(node);
|
|
6004
|
-
}
|
|
6005
6020
|
node.internalMode = internalMode;
|
|
6006
6021
|
node.setParent(this);
|
|
6007
6022
|
this.emit("appendChild", node);
|
|
6008
6023
|
return node;
|
|
6009
6024
|
}
|
|
6010
|
-
moveChild(
|
|
6011
|
-
if (this.is(
|
|
6025
|
+
moveChild(node, toIndex, internalMode = node.internalMode) {
|
|
6026
|
+
if (this.is(node) || node.hasParent() && !this.is(node.parent)) {
|
|
6012
6027
|
return this;
|
|
6013
6028
|
}
|
|
6014
|
-
|
|
6015
|
-
const
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
case "back":
|
|
6021
|
-
return _child.internalMode === "back";
|
|
6022
|
-
case "front":
|
|
6023
|
-
default:
|
|
6024
|
-
return true;
|
|
6029
|
+
const fromArray = this._children.getInternal(node.internalMode);
|
|
6030
|
+
const fromIndex = fromArray.indexOf(node);
|
|
6031
|
+
const toArray = this._children.getInternal(internalMode);
|
|
6032
|
+
if (node.internalMode !== internalMode || toIndex !== fromIndex) {
|
|
6033
|
+
if (fromIndex > -1) {
|
|
6034
|
+
fromArray.splice(fromIndex, 1);
|
|
6025
6035
|
}
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
switch (internalMode) {
|
|
6030
|
-
case "front":
|
|
6031
|
-
return _child.internalMode !== "front";
|
|
6032
|
-
case "default":
|
|
6033
|
-
return _child.internalMode === "back";
|
|
6034
|
-
case "back":
|
|
6035
|
-
default:
|
|
6036
|
-
return false;
|
|
6037
|
-
}
|
|
6038
|
-
});
|
|
6039
|
-
maxIndex = maxIndex > -1 ? minIndex + maxIndex : Math.max(0, this._children.length);
|
|
6040
|
-
const newIndex = clamp(minIndex, toIndex > -1 ? toIndex : maxIndex, maxIndex);
|
|
6041
|
-
if (newIndex !== oldIndex) {
|
|
6042
|
-
if (oldIndex > -1) {
|
|
6043
|
-
this._children.splice(oldIndex, 1);
|
|
6044
|
-
}
|
|
6045
|
-
child.setParent(this);
|
|
6046
|
-
if (newIndex > -1 && newIndex < this._children.length) {
|
|
6047
|
-
this._children.splice(newIndex, 0, child);
|
|
6036
|
+
node.setParent(this);
|
|
6037
|
+
if (toIndex > -1 && toIndex < toArray.length) {
|
|
6038
|
+
toArray.splice(toIndex, 0, node);
|
|
6048
6039
|
} else {
|
|
6049
|
-
|
|
6040
|
+
toArray.push(node);
|
|
6050
6041
|
}
|
|
6051
|
-
if (
|
|
6052
|
-
this.emit("moveChild",
|
|
6042
|
+
if (fromIndex > -1) {
|
|
6043
|
+
this.emit("moveChild", node, toIndex, fromIndex);
|
|
6053
6044
|
} else {
|
|
6054
|
-
this.emit("appendChild",
|
|
6045
|
+
this.emit("appendChild", node);
|
|
6055
6046
|
}
|
|
6056
6047
|
}
|
|
6048
|
+
node.internalMode = internalMode;
|
|
6057
6049
|
return this;
|
|
6058
6050
|
}
|
|
6059
6051
|
removeChild(child) {
|
|
6060
|
-
const index = child.getIndex(
|
|
6052
|
+
const index = child.getIndex();
|
|
6061
6053
|
if (this.is(child.parent) && index > -1) {
|
|
6062
|
-
this._children.splice(index, 1);
|
|
6054
|
+
this._children.internal.splice(index, 1);
|
|
6063
6055
|
child.setParent(void 0);
|
|
6064
6056
|
this.emit("removeChild", child, index);
|
|
6065
6057
|
}
|
|
6066
6058
|
return child;
|
|
6067
6059
|
}
|
|
6068
6060
|
removeChildren() {
|
|
6069
|
-
this.
|
|
6061
|
+
this._children.forEach((child) => this.removeChild(child));
|
|
6070
6062
|
}
|
|
6071
6063
|
remove() {
|
|
6072
6064
|
this._parent?.removeChild(this);
|
|
6073
6065
|
}
|
|
6074
6066
|
forEachChild(callbackfn) {
|
|
6075
|
-
this.
|
|
6067
|
+
this._children.forEach(callbackfn);
|
|
6076
6068
|
return this;
|
|
6077
6069
|
}
|
|
6078
6070
|
forEachDescendant(callbackfn) {
|
|
6079
|
-
this.
|
|
6071
|
+
this._children.forEach((child) => {
|
|
6080
6072
|
callbackfn(child);
|
|
6081
6073
|
child.forEachDescendant(callbackfn);
|
|
6082
6074
|
});
|
|
@@ -6109,18 +6101,14 @@ let Node = class extends CoreObject {
|
|
|
6109
6101
|
clone() {
|
|
6110
6102
|
return new this.constructor(
|
|
6111
6103
|
this.toJSON().props,
|
|
6112
|
-
this.
|
|
6104
|
+
this._children.internal
|
|
6113
6105
|
);
|
|
6114
6106
|
}
|
|
6115
6107
|
toJSON() {
|
|
6116
6108
|
return {
|
|
6117
6109
|
tag: this.tag,
|
|
6118
|
-
props:
|
|
6119
|
-
|
|
6120
|
-
...super.toJSON()
|
|
6121
|
-
},
|
|
6122
|
-
meta: Object.fromEntries(this._meta.entries()),
|
|
6123
|
-
children: this.getChildren().map((child) => child.toJSON())
|
|
6110
|
+
props: super.toJSON(),
|
|
6111
|
+
children: [...this._children.map((child) => child.toJSON())]
|
|
6124
6112
|
};
|
|
6125
6113
|
}
|
|
6126
6114
|
static parse(JSON) {
|
|
@@ -6135,7 +6123,7 @@ let Node = class extends CoreObject {
|
|
|
6135
6123
|
}
|
|
6136
6124
|
};
|
|
6137
6125
|
__decorateClass$R([
|
|
6138
|
-
|
|
6126
|
+
property()
|
|
6139
6127
|
], Node.prototype, "name", 2);
|
|
6140
6128
|
__decorateClass$R([
|
|
6141
6129
|
property()
|
|
@@ -6152,6 +6140,9 @@ __decorateClass$R([
|
|
|
6152
6140
|
__decorateClass$R([
|
|
6153
6141
|
property({ default: "default" })
|
|
6154
6142
|
], Node.prototype, "internalMode", 2);
|
|
6143
|
+
__decorateClass$R([
|
|
6144
|
+
property({ default: {} })
|
|
6145
|
+
], Node.prototype, "meta", 2);
|
|
6155
6146
|
Node = __decorateClass$R([
|
|
6156
6147
|
customNode("Node")
|
|
6157
6148
|
], Node);
|
|
@@ -7667,7 +7658,7 @@ class SceneTree extends MainLoop {
|
|
|
7667
7658
|
}
|
|
7668
7659
|
free() {
|
|
7669
7660
|
super.free();
|
|
7670
|
-
this.root.
|
|
7661
|
+
this.root.children.internal.forEach((node) => this.root.removeChild(node));
|
|
7671
7662
|
this.input.removeEventListeners();
|
|
7672
7663
|
}
|
|
7673
7664
|
}
|
|
@@ -8968,7 +8959,9 @@ class BaseElement2DFill extends CoreObject {
|
|
|
8968
8959
|
return super.setProperties(properties);
|
|
8969
8960
|
}
|
|
8970
8961
|
setProperties(properties) {
|
|
8971
|
-
return this._setProperties(
|
|
8962
|
+
return this._setProperties(
|
|
8963
|
+
isNone(properties) ? void 0 : normalizeFill(properties)
|
|
8964
|
+
);
|
|
8972
8965
|
}
|
|
8973
8966
|
_updateProperty(key, value, oldValue, declaration) {
|
|
8974
8967
|
super._updateProperty(key, value, oldValue, declaration);
|
|
@@ -9099,7 +9092,9 @@ var __decorateClass$t = (decorators, target, key, kind) => {
|
|
|
9099
9092
|
};
|
|
9100
9093
|
class BaseElement2DBackground extends BaseElement2DFill {
|
|
9101
9094
|
setProperties(properties) {
|
|
9102
|
-
return super._setProperties(
|
|
9095
|
+
return super._setProperties(
|
|
9096
|
+
isNone(properties) ? void 0 : normalizeBackground(properties)
|
|
9097
|
+
);
|
|
9103
9098
|
}
|
|
9104
9099
|
}
|
|
9105
9100
|
__decorateClass$t([
|
|
@@ -9117,7 +9112,9 @@ var __decorateClass$s = (decorators, target, key, kind) => {
|
|
|
9117
9112
|
};
|
|
9118
9113
|
class BaseElement2DForeground extends BaseElement2DFill {
|
|
9119
9114
|
setProperties(properties) {
|
|
9120
|
-
return super._setProperties(
|
|
9115
|
+
return super._setProperties(
|
|
9116
|
+
isNone(properties) ? void 0 : normalizeForeground(properties)
|
|
9117
|
+
);
|
|
9121
9118
|
}
|
|
9122
9119
|
}
|
|
9123
9120
|
__decorateClass$s([
|
|
@@ -9135,7 +9132,9 @@ var __decorateClass$r = (decorators, target, key, kind) => {
|
|
|
9135
9132
|
};
|
|
9136
9133
|
class BaseElement2DOutline extends BaseElement2DFill {
|
|
9137
9134
|
setProperties(properties) {
|
|
9138
|
-
return super._setProperties(
|
|
9135
|
+
return super._setProperties(
|
|
9136
|
+
isNone(properties) ? void 0 : normalizeOutline(properties)
|
|
9137
|
+
);
|
|
9139
9138
|
}
|
|
9140
9139
|
_updateProperty(key, value, oldValue, declaration) {
|
|
9141
9140
|
super._updateProperty(key, value, oldValue, declaration);
|
|
@@ -9185,7 +9184,9 @@ class BaseElement2DShadow extends CoreObject {
|
|
|
9185
9184
|
this.parent = parent;
|
|
9186
9185
|
}
|
|
9187
9186
|
setProperties(properties) {
|
|
9188
|
-
return super.setProperties(
|
|
9187
|
+
return super.setProperties(
|
|
9188
|
+
isNone(properties) ? void 0 : normalizeShadow(properties)
|
|
9189
|
+
);
|
|
9189
9190
|
}
|
|
9190
9191
|
_updateProperty(key, value, oldValue, declaration) {
|
|
9191
9192
|
super._updateProperty(key, value, oldValue, declaration);
|
|
@@ -9244,7 +9245,9 @@ class BaseElement2DShape extends CoreObject {
|
|
|
9244
9245
|
}
|
|
9245
9246
|
_path2DSet = new Path2DSet();
|
|
9246
9247
|
setProperties(properties) {
|
|
9247
|
-
return super.setProperties(
|
|
9248
|
+
return super.setProperties(
|
|
9249
|
+
isNone(properties) ? void 0 : normalizeShape(properties)
|
|
9250
|
+
);
|
|
9248
9251
|
}
|
|
9249
9252
|
_updateProperty(key, value, oldValue, declaration) {
|
|
9250
9253
|
super._updateProperty(key, value, oldValue, declaration);
|
|
@@ -9353,7 +9356,9 @@ class BaseElement2DText extends CoreObject {
|
|
|
9353
9356
|
baseText = new Text();
|
|
9354
9357
|
measureResult;
|
|
9355
9358
|
setProperties(properties) {
|
|
9356
|
-
return super.setProperties(
|
|
9359
|
+
return super.setProperties(
|
|
9360
|
+
isNone(properties) ? void 0 : normalizeText(properties)
|
|
9361
|
+
);
|
|
9357
9362
|
}
|
|
9358
9363
|
_updateProperty(key, value, oldValue, declaration) {
|
|
9359
9364
|
super._updateProperty(key, value, oldValue, declaration);
|
|
@@ -9538,49 +9543,49 @@ let BaseElement2D = class extends Node2D {
|
|
|
9538
9543
|
return this._background;
|
|
9539
9544
|
}
|
|
9540
9545
|
set background(value) {
|
|
9541
|
-
this._background.setProperties(value);
|
|
9546
|
+
this._background.resetProperties().setProperties(value);
|
|
9542
9547
|
}
|
|
9543
9548
|
_shape = new BaseElement2DShape(this);
|
|
9544
9549
|
get shape() {
|
|
9545
9550
|
return this._shape;
|
|
9546
9551
|
}
|
|
9547
9552
|
set shape(value) {
|
|
9548
|
-
this._shape.setProperties(value);
|
|
9553
|
+
this._shape.resetProperties().setProperties(value);
|
|
9549
9554
|
}
|
|
9550
9555
|
_fill = new BaseElement2DFill(this);
|
|
9551
9556
|
get fill() {
|
|
9552
9557
|
return this._fill;
|
|
9553
9558
|
}
|
|
9554
9559
|
set fill(value) {
|
|
9555
|
-
this._fill.setProperties(value);
|
|
9560
|
+
this._fill.resetProperties().setProperties(value);
|
|
9556
9561
|
}
|
|
9557
9562
|
_outline = new BaseElement2DOutline(this);
|
|
9558
9563
|
get outline() {
|
|
9559
9564
|
return this._outline;
|
|
9560
9565
|
}
|
|
9561
9566
|
set outline(value) {
|
|
9562
|
-
this._outline.setProperties(value);
|
|
9567
|
+
this._outline.resetProperties().setProperties(value);
|
|
9563
9568
|
}
|
|
9564
9569
|
_foreground = new BaseElement2DForeground(this);
|
|
9565
9570
|
get foreground() {
|
|
9566
9571
|
return this._foreground;
|
|
9567
9572
|
}
|
|
9568
9573
|
set foreground(value) {
|
|
9569
|
-
this._foreground.setProperties(value);
|
|
9574
|
+
this._foreground.resetProperties().setProperties(value);
|
|
9570
9575
|
}
|
|
9571
9576
|
_text = new BaseElement2DText(this);
|
|
9572
9577
|
get text() {
|
|
9573
9578
|
return this._text;
|
|
9574
9579
|
}
|
|
9575
9580
|
set text(value) {
|
|
9576
|
-
this._text.setProperties(value);
|
|
9581
|
+
this._text.resetProperties().setProperties(value);
|
|
9577
9582
|
}
|
|
9578
9583
|
_shadow = new BaseElement2DShadow(this);
|
|
9579
9584
|
get shadow() {
|
|
9580
9585
|
return this._shadow;
|
|
9581
9586
|
}
|
|
9582
9587
|
set shadow(value) {
|
|
9583
|
-
this._shadow.setProperties(value);
|
|
9588
|
+
this._shadow.resetProperties().setProperties(value);
|
|
9584
9589
|
}
|
|
9585
9590
|
constructor(properties, nodes = []) {
|
|
9586
9591
|
super();
|
|
@@ -10690,7 +10695,7 @@ let Text2D = class extends TextureRect2D {
|
|
|
10690
10695
|
}
|
|
10691
10696
|
}
|
|
10692
10697
|
_getSubTexts() {
|
|
10693
|
-
return this.
|
|
10698
|
+
return this.children.front.filter((node) => node instanceof Text2D);
|
|
10694
10699
|
}
|
|
10695
10700
|
_updateSubTexts() {
|
|
10696
10701
|
const subTexts = this._getSubTexts();
|
|
@@ -10726,7 +10731,7 @@ let Text2D = class extends TextureRect2D {
|
|
|
10726
10731
|
}
|
|
10727
10732
|
_updateSplit() {
|
|
10728
10733
|
if (this._subTextsCount) {
|
|
10729
|
-
this.
|
|
10734
|
+
this.children.front.forEach((child) => this.removeChild(child));
|
|
10730
10735
|
this._subTextsCount = 0;
|
|
10731
10736
|
}
|
|
10732
10737
|
if (this.split) {
|
|
@@ -10760,7 +10765,7 @@ let Text2D = class extends TextureRect2D {
|
|
|
10760
10765
|
}
|
|
10761
10766
|
_drawContent() {
|
|
10762
10767
|
if (!this.split) {
|
|
10763
|
-
const onText2DRender = this.
|
|
10768
|
+
const onText2DRender = this.children?.find((child) => "onText2DRender" in child)?.onText2DRender;
|
|
10764
10769
|
if (onText2DRender) {
|
|
10765
10770
|
onText2DRender();
|
|
10766
10771
|
} else {
|
|
@@ -11019,7 +11024,7 @@ let Animation = class extends TimelineNode {
|
|
|
11019
11024
|
let targets;
|
|
11020
11025
|
switch (this.effectMode) {
|
|
11021
11026
|
case "sibling":
|
|
11022
|
-
targets = this.getParent()?.
|
|
11027
|
+
targets = this.getParent()?.children.internal.filter((val) => val instanceof CanvasItem) ?? [];
|
|
11023
11028
|
break;
|
|
11024
11029
|
case "parent":
|
|
11025
11030
|
default:
|