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