modern-canvas 0.8.9 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +192 -336
- package/dist/index.d.cts +176 -204
- package/dist/index.d.mts +176 -204
- package/dist/index.d.ts +176 -204
- package/dist/index.js +31 -31
- package/dist/index.mjs +193 -337
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineProperty,
|
|
1
|
+
import { defineProperty, Observable, Reactivable, parseColor, property, RawWeakMap as RawWeakMap$1, isGradient, isColorFillObject, clearUndef, idGenerator, normalizeFill, isNone, normalizeBackground, normalizeForeground, normalizeOutline, normalizeShadow, normalizeShape, getDefaultStyle, normalizeText, normalizeTextContent } from 'modern-idoc';
|
|
2
2
|
import { extend } from 'colord';
|
|
3
3
|
import namesPlugin from 'colord/plugins/names';
|
|
4
4
|
import { Path2D, Path2DSet, svgToDom, svgToPath2DSet, Matrix3 as Matrix3$1, BoundingBox } from 'modern-path2d';
|
|
@@ -478,7 +478,7 @@ const TOUCH_TO_POINTER = {
|
|
|
478
478
|
touchmove: "pointermove",
|
|
479
479
|
touchcancel: "pointercancel"
|
|
480
480
|
};
|
|
481
|
-
class Input extends
|
|
481
|
+
class Input extends Observable {
|
|
482
482
|
/**
|
|
483
483
|
* Current event
|
|
484
484
|
*/
|
|
@@ -868,167 +868,14 @@ class Input extends EventEmitter {
|
|
|
868
868
|
}
|
|
869
869
|
|
|
870
870
|
let IID = 0;
|
|
871
|
-
class CoreObject extends
|
|
871
|
+
class CoreObject extends Reactivable {
|
|
872
872
|
instanceId = ++IID;
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
_updatedProperties = /* @__PURE__ */ new Map();
|
|
876
|
-
_changedProperties = /* @__PURE__ */ new Set();
|
|
877
|
-
_updatingPromise = Promise.resolve();
|
|
878
|
-
_updating = false;
|
|
879
|
-
useCustomPropertyAccessor(accessor) {
|
|
880
|
-
this._propertyAccessor = accessor;
|
|
881
|
-
this.getPropertyDeclarations().forEach((declaration, key) => {
|
|
882
|
-
const newValue = accessor.get(key, () => void 0);
|
|
883
|
-
const oldValue = this._properties.get(key);
|
|
884
|
-
if (newValue === void 0) {
|
|
885
|
-
if (oldValue !== void 0) {
|
|
886
|
-
accessor.set(key, oldValue);
|
|
887
|
-
}
|
|
888
|
-
} else if (newValue !== oldValue) {
|
|
889
|
-
if (declaration.alias && declaration.alias !== key) {
|
|
890
|
-
this.setProperty(key, newValue);
|
|
891
|
-
} else {
|
|
892
|
-
this._properties.set(key, newValue);
|
|
893
|
-
}
|
|
894
|
-
this._updateProperty(key, newValue, oldValue, declaration);
|
|
895
|
-
this.emit("updateProperty", key, newValue, oldValue, declaration);
|
|
896
|
-
}
|
|
897
|
-
});
|
|
898
|
-
return this;
|
|
899
|
-
}
|
|
900
|
-
getter(key, context) {
|
|
901
|
-
if (context?.declaration.protected) {
|
|
902
|
-
return this[context.internalKey];
|
|
903
|
-
} else {
|
|
904
|
-
return this._propertyAccessor ? this._propertyAccessor.get(key, () => this._properties.get(key)) : this._properties.get(key);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
setter(key, value, context) {
|
|
908
|
-
if (context?.declaration.protected) {
|
|
909
|
-
this[context.internalKey] = value;
|
|
910
|
-
} else {
|
|
911
|
-
if (this._propertyAccessor) {
|
|
912
|
-
this._propertyAccessor.set(key, value);
|
|
913
|
-
}
|
|
914
|
-
this._properties.set(key, value);
|
|
915
|
-
}
|
|
873
|
+
_nextTick() {
|
|
874
|
+
return nextTick();
|
|
916
875
|
}
|
|
917
876
|
equal(target) {
|
|
918
877
|
return Boolean(target && this.instanceId === target.instanceId);
|
|
919
878
|
}
|
|
920
|
-
async _enqueueUpdate() {
|
|
921
|
-
this._updating = true;
|
|
922
|
-
try {
|
|
923
|
-
await this._updatingPromise;
|
|
924
|
-
} catch (e) {
|
|
925
|
-
Promise.reject(e);
|
|
926
|
-
}
|
|
927
|
-
await nextTick();
|
|
928
|
-
if (!this._updating)
|
|
929
|
-
return;
|
|
930
|
-
this.update();
|
|
931
|
-
this._updating = false;
|
|
932
|
-
}
|
|
933
|
-
update() {
|
|
934
|
-
this._update(this._updatedProperties);
|
|
935
|
-
this._updatedProperties = /* @__PURE__ */ new Map();
|
|
936
|
-
}
|
|
937
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
938
|
-
_update(changed) {
|
|
939
|
-
}
|
|
940
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
941
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
942
|
-
}
|
|
943
|
-
isDirty(key) {
|
|
944
|
-
return this._updatedProperties.has(key);
|
|
945
|
-
}
|
|
946
|
-
getPropertyDeclarations() {
|
|
947
|
-
return getDeclarations(this.constructor);
|
|
948
|
-
}
|
|
949
|
-
getPropertyDeclaration(key) {
|
|
950
|
-
return this.getPropertyDeclarations().get(key);
|
|
951
|
-
}
|
|
952
|
-
getProperty(key) {
|
|
953
|
-
return this[key];
|
|
954
|
-
}
|
|
955
|
-
setProperty(key, value) {
|
|
956
|
-
this[key] = value;
|
|
957
|
-
return this;
|
|
958
|
-
}
|
|
959
|
-
getProperties(keys) {
|
|
960
|
-
const properties = {};
|
|
961
|
-
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
962
|
-
if (!property.protected && !property.alias && (!keys || keys.includes(name))) {
|
|
963
|
-
properties[name] = this.getProperty(name);
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
return properties;
|
|
967
|
-
}
|
|
968
|
-
setProperties(properties) {
|
|
969
|
-
if (properties && typeof properties === "object") {
|
|
970
|
-
for (const [name] of this.getPropertyDeclarations()) {
|
|
971
|
-
if (name in properties) {
|
|
972
|
-
this.setProperty(name, properties[name]);
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
return this;
|
|
977
|
-
}
|
|
978
|
-
resetProperties() {
|
|
979
|
-
for (const [name, property] of this.getPropertyDeclarations()) {
|
|
980
|
-
this.setProperty(
|
|
981
|
-
name,
|
|
982
|
-
typeof property.fallback === "function" ? property.fallback() : property.fallback
|
|
983
|
-
);
|
|
984
|
-
}
|
|
985
|
-
return this;
|
|
986
|
-
}
|
|
987
|
-
onUpdateProperty(key, newValue, oldValue, declaration) {
|
|
988
|
-
this.requestUpdate(key, newValue, oldValue, declaration);
|
|
989
|
-
}
|
|
990
|
-
requestUpdate(key, newValue, oldValue, declaration) {
|
|
991
|
-
if (key !== void 0) {
|
|
992
|
-
if (!Object.is(newValue, oldValue)) {
|
|
993
|
-
this._updatedProperties.set(key, oldValue);
|
|
994
|
-
this._changedProperties.add(key);
|
|
995
|
-
declaration ??= this.getPropertyDeclaration(key);
|
|
996
|
-
this._updateProperty(key, newValue, oldValue, declaration);
|
|
997
|
-
this.emit("updateProperty", key, newValue, oldValue, declaration);
|
|
998
|
-
} else {
|
|
999
|
-
return;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
if (!this._updating) {
|
|
1003
|
-
this._updatingPromise = this._enqueueUpdate();
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
toJSON() {
|
|
1007
|
-
const json = {};
|
|
1008
|
-
this._properties.forEach((value, key) => {
|
|
1009
|
-
if (value === void 0) {
|
|
1010
|
-
return;
|
|
1011
|
-
}
|
|
1012
|
-
if (value && typeof value === "object") {
|
|
1013
|
-
if ("toJSON" in value && typeof value.toJSON === "function") {
|
|
1014
|
-
json[key] = value.toJSON();
|
|
1015
|
-
} else if (Array.isArray(value)) {
|
|
1016
|
-
json[key] = [...value];
|
|
1017
|
-
} else {
|
|
1018
|
-
json[key] = { ...value };
|
|
1019
|
-
}
|
|
1020
|
-
} else {
|
|
1021
|
-
json[key] = value;
|
|
1022
|
-
}
|
|
1023
|
-
});
|
|
1024
|
-
return json;
|
|
1025
|
-
}
|
|
1026
|
-
clone() {
|
|
1027
|
-
return new this.constructor(this.toJSON());
|
|
1028
|
-
}
|
|
1029
|
-
free() {
|
|
1030
|
-
this.removeAllListeners();
|
|
1031
|
-
}
|
|
1032
879
|
}
|
|
1033
880
|
|
|
1034
881
|
class RefCounted extends CoreObject {
|
|
@@ -1126,7 +973,7 @@ class Color {
|
|
|
1126
973
|
}
|
|
1127
974
|
}
|
|
1128
975
|
|
|
1129
|
-
class Vector extends
|
|
976
|
+
class Vector extends Observable {
|
|
1130
977
|
constructor(dim) {
|
|
1131
978
|
super();
|
|
1132
979
|
this.dim = dim;
|
|
@@ -1278,7 +1125,7 @@ class Vector extends EventEmitter {
|
|
|
1278
1125
|
}
|
|
1279
1126
|
}
|
|
1280
1127
|
|
|
1281
|
-
class Matrix extends
|
|
1128
|
+
class Matrix extends Observable {
|
|
1282
1129
|
constructor(rows, cols, array) {
|
|
1283
1130
|
super();
|
|
1284
1131
|
this.rows = rows;
|
|
@@ -2245,6 +2092,7 @@ var __decorateClass$Z = (decorators, target, key, kind) => {
|
|
|
2245
2092
|
class MainLoop extends CoreObject {
|
|
2246
2093
|
_starting = false;
|
|
2247
2094
|
_nextDeltaTime = 0;
|
|
2095
|
+
_startedProcess;
|
|
2248
2096
|
get starting() {
|
|
2249
2097
|
return this._starting;
|
|
2250
2098
|
}
|
|
@@ -2258,7 +2106,10 @@ class MainLoop extends CoreObject {
|
|
|
2258
2106
|
start(process) {
|
|
2259
2107
|
if (!this._starting) {
|
|
2260
2108
|
this._starting = true;
|
|
2261
|
-
this.
|
|
2109
|
+
if (this._startedProcess) {
|
|
2110
|
+
this.off("process", this._startedProcess);
|
|
2111
|
+
}
|
|
2112
|
+
this._startedProcess = process;
|
|
2262
2113
|
this.on("process", process);
|
|
2263
2114
|
Ticker.on(this._onNextTick, { sort: 0 });
|
|
2264
2115
|
}
|
|
@@ -2277,8 +2128,8 @@ class MainLoop extends CoreObject {
|
|
|
2277
2128
|
this.emit("process", delta);
|
|
2278
2129
|
}
|
|
2279
2130
|
}
|
|
2280
|
-
|
|
2281
|
-
super.
|
|
2131
|
+
destroy() {
|
|
2132
|
+
super.destroy();
|
|
2282
2133
|
this.stop();
|
|
2283
2134
|
}
|
|
2284
2135
|
}
|
|
@@ -2377,7 +2228,7 @@ class WebGLModule {
|
|
|
2377
2228
|
}
|
|
2378
2229
|
reset() {
|
|
2379
2230
|
}
|
|
2380
|
-
|
|
2231
|
+
destroy() {
|
|
2381
2232
|
}
|
|
2382
2233
|
}
|
|
2383
2234
|
|
|
@@ -3554,8 +3405,8 @@ ${gl.getShaderInfoLog(shader)}`);
|
|
|
3554
3405
|
viewMatrix: [1, 0, 0, 0, 1, 0, 0, 0, 1]
|
|
3555
3406
|
};
|
|
3556
3407
|
}
|
|
3557
|
-
|
|
3558
|
-
super.
|
|
3408
|
+
destroy() {
|
|
3409
|
+
super.destroy();
|
|
3559
3410
|
this.bind(null);
|
|
3560
3411
|
}
|
|
3561
3412
|
}
|
|
@@ -4329,8 +4180,8 @@ class WebGLRenderer extends Renderer {
|
|
|
4329
4180
|
flush() {
|
|
4330
4181
|
this._modules.forEach((module) => module.flush());
|
|
4331
4182
|
}
|
|
4332
|
-
|
|
4333
|
-
this._modules.forEach((module) => module.
|
|
4183
|
+
destroy() {
|
|
4184
|
+
this._modules.forEach((module) => module.destroy());
|
|
4334
4185
|
this.view?.removeEventListener("webglcontextlost", this._onContextLost, false);
|
|
4335
4186
|
this.view?.removeEventListener("webglcontextrestored", this._onContextRestored, false);
|
|
4336
4187
|
this.extensions.loseContext?.loseContext();
|
|
@@ -4487,8 +4338,8 @@ class IndexBuffer extends Resource {
|
|
|
4487
4338
|
return renderer.buffer.create(this._glBufferOptions());
|
|
4488
4339
|
});
|
|
4489
4340
|
}
|
|
4490
|
-
_updateProperty(key, value, oldValue
|
|
4491
|
-
super._updateProperty(key, value, oldValue
|
|
4341
|
+
_updateProperty(key, value, oldValue) {
|
|
4342
|
+
super._updateProperty(key, value, oldValue);
|
|
4492
4343
|
switch (key) {
|
|
4493
4344
|
case "data":
|
|
4494
4345
|
case "dynamic":
|
|
@@ -4509,10 +4360,10 @@ class IndexBuffer extends Resource {
|
|
|
4509
4360
|
}
|
|
4510
4361
|
}
|
|
4511
4362
|
__decorateClass$Y([
|
|
4512
|
-
property({
|
|
4363
|
+
property({ internal: true, fallback: null })
|
|
4513
4364
|
], IndexBuffer.prototype, "data");
|
|
4514
4365
|
__decorateClass$Y([
|
|
4515
|
-
property({
|
|
4366
|
+
property({ internal: true, fallback: false })
|
|
4516
4367
|
], IndexBuffer.prototype, "dynamic");
|
|
4517
4368
|
|
|
4518
4369
|
var __defProp$O = Object.defineProperty;
|
|
@@ -4544,8 +4395,8 @@ class VertexBuffer extends Resource {
|
|
|
4544
4395
|
return renderer.buffer.create(this._glBufferOptions());
|
|
4545
4396
|
});
|
|
4546
4397
|
}
|
|
4547
|
-
_updateProperty(key, value, oldValue
|
|
4548
|
-
super._updateProperty(key, value, oldValue
|
|
4398
|
+
_updateProperty(key, value, oldValue) {
|
|
4399
|
+
super._updateProperty(key, value, oldValue);
|
|
4549
4400
|
switch (key) {
|
|
4550
4401
|
case "data":
|
|
4551
4402
|
case "dynamic":
|
|
@@ -4566,10 +4417,10 @@ class VertexBuffer extends Resource {
|
|
|
4566
4417
|
}
|
|
4567
4418
|
}
|
|
4568
4419
|
__decorateClass$X([
|
|
4569
|
-
property({
|
|
4420
|
+
property({ internal: true, default: null })
|
|
4570
4421
|
], VertexBuffer.prototype, "data");
|
|
4571
4422
|
__decorateClass$X([
|
|
4572
|
-
property({
|
|
4423
|
+
property({ internal: true, fallback: false })
|
|
4573
4424
|
], VertexBuffer.prototype, "dynamic");
|
|
4574
4425
|
|
|
4575
4426
|
var __defProp$N = Object.defineProperty;
|
|
@@ -4590,8 +4441,8 @@ class VertexAttribute extends Resource {
|
|
|
4590
4441
|
...options
|
|
4591
4442
|
});
|
|
4592
4443
|
}
|
|
4593
|
-
_updateProperty(key, value, oldValue
|
|
4594
|
-
super._updateProperty(key, value, oldValue
|
|
4444
|
+
_updateProperty(key, value, oldValue) {
|
|
4445
|
+
super._updateProperty(key, value, oldValue);
|
|
4595
4446
|
switch (key) {
|
|
4596
4447
|
case "buffer":
|
|
4597
4448
|
case "size":
|
|
@@ -4939,8 +4790,8 @@ class Texture2D extends Resource {
|
|
|
4939
4790
|
return renderer.texture.create(this._glTextureOptions(renderer, options));
|
|
4940
4791
|
});
|
|
4941
4792
|
}
|
|
4942
|
-
_updateProperty(key, value, oldValue
|
|
4943
|
-
super._updateProperty(key, value, oldValue
|
|
4793
|
+
_updateProperty(key, value, oldValue) {
|
|
4794
|
+
super._updateProperty(key, value, oldValue);
|
|
4944
4795
|
switch (key) {
|
|
4945
4796
|
case "width":
|
|
4946
4797
|
case "height":
|
|
@@ -5000,7 +4851,7 @@ class Texture2D extends Resource {
|
|
|
5000
4851
|
inactivate(renderer) {
|
|
5001
4852
|
renderer.texture.unbind(this._glTexture(renderer));
|
|
5002
4853
|
}
|
|
5003
|
-
|
|
4854
|
+
destroy() {
|
|
5004
4855
|
if (SUPPORTS_IMAGE_BITMAP && this.source instanceof ImageBitmap) {
|
|
5005
4856
|
this.source.close();
|
|
5006
4857
|
}
|
|
@@ -5044,9 +4895,9 @@ class AnimatedTexture extends Resource {
|
|
|
5044
4895
|
this.duration = this.frames.reduce((duration, frame) => frame.duration + duration, 0);
|
|
5045
4896
|
return this;
|
|
5046
4897
|
}
|
|
5047
|
-
|
|
4898
|
+
destroy() {
|
|
5048
4899
|
this.frames.forEach((frame) => {
|
|
5049
|
-
frame.texture.
|
|
4900
|
+
frame.texture.destroy();
|
|
5050
4901
|
});
|
|
5051
4902
|
}
|
|
5052
4903
|
}
|
|
@@ -5064,7 +4915,7 @@ class CanvasTexture extends Texture2D {
|
|
|
5064
4915
|
constructor(source = document.createElement("canvas")) {
|
|
5065
4916
|
super(source);
|
|
5066
4917
|
}
|
|
5067
|
-
_updateProperty(key, value, oldValue
|
|
4918
|
+
_updateProperty(key, value, oldValue) {
|
|
5068
4919
|
switch (key) {
|
|
5069
4920
|
case "width":
|
|
5070
4921
|
this.source.width = Math.max(1, Math.ceil(value * this.pixelRatio));
|
|
@@ -5073,7 +4924,7 @@ class CanvasTexture extends Texture2D {
|
|
|
5073
4924
|
this.source.height = Math.max(1, Math.ceil(value * this.pixelRatio));
|
|
5074
4925
|
break;
|
|
5075
4926
|
}
|
|
5076
|
-
super._updateProperty(key, value, oldValue
|
|
4927
|
+
super._updateProperty(key, value, oldValue);
|
|
5077
4928
|
}
|
|
5078
4929
|
}
|
|
5079
4930
|
__decorateClass$U([
|
|
@@ -5281,7 +5132,7 @@ class PixelsTexture extends Texture2D {
|
|
|
5281
5132
|
}
|
|
5282
5133
|
super(source);
|
|
5283
5134
|
}
|
|
5284
|
-
_updateProperty(key, value, oldValue
|
|
5135
|
+
_updateProperty(key, value, oldValue) {
|
|
5285
5136
|
switch (key) {
|
|
5286
5137
|
case "width":
|
|
5287
5138
|
this.source.width = Math.round(this.width * this.pixelRatio);
|
|
@@ -5294,7 +5145,7 @@ class PixelsTexture extends Texture2D {
|
|
|
5294
5145
|
this.source.height = Math.round(this.height * this.pixelRatio);
|
|
5295
5146
|
break;
|
|
5296
5147
|
}
|
|
5297
|
-
super._updateProperty(key, value, oldValue
|
|
5148
|
+
super._updateProperty(key, value, oldValue);
|
|
5298
5149
|
}
|
|
5299
5150
|
}
|
|
5300
5151
|
|
|
@@ -5396,8 +5247,8 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
|
|
|
5396
5247
|
}
|
|
5397
5248
|
this._setupAutoUpdate();
|
|
5398
5249
|
}
|
|
5399
|
-
_updateProperty(key, value, oldValue
|
|
5400
|
-
super._updateProperty(key, value, oldValue
|
|
5250
|
+
_updateProperty(key, value, oldValue) {
|
|
5251
|
+
super._updateProperty(key, value, oldValue);
|
|
5401
5252
|
switch (key) {
|
|
5402
5253
|
case "fps":
|
|
5403
5254
|
this._spf = value ? Math.floor(1e3 / value) : 0;
|
|
@@ -5532,7 +5383,7 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
|
|
|
5532
5383
|
}
|
|
5533
5384
|
return this._sourceLoad;
|
|
5534
5385
|
}
|
|
5535
|
-
|
|
5386
|
+
destroy() {
|
|
5536
5387
|
this._setupAutoUpdate();
|
|
5537
5388
|
const source = this.source;
|
|
5538
5389
|
if (source) {
|
|
@@ -5549,10 +5400,10 @@ const _VideoTexture = class _VideoTexture extends Texture2D {
|
|
|
5549
5400
|
}
|
|
5550
5401
|
};
|
|
5551
5402
|
__decorateClass$T([
|
|
5552
|
-
property({
|
|
5403
|
+
property({ internal: true, fallback: true })
|
|
5553
5404
|
], _VideoTexture.prototype, "autoUpdate");
|
|
5554
5405
|
__decorateClass$T([
|
|
5555
|
-
property({
|
|
5406
|
+
property({ internal: true, fallback: 0 })
|
|
5556
5407
|
], _VideoTexture.prototype, "fps");
|
|
5557
5408
|
let VideoTexture = _VideoTexture;
|
|
5558
5409
|
|
|
@@ -5746,23 +5597,19 @@ class CanvasContext extends Path2D {
|
|
|
5746
5597
|
}
|
|
5747
5598
|
}
|
|
5748
5599
|
|
|
5749
|
-
class Children
|
|
5600
|
+
class Children {
|
|
5750
5601
|
front = [];
|
|
5602
|
+
default = [];
|
|
5751
5603
|
back = [];
|
|
5752
5604
|
get internal() {
|
|
5753
|
-
return
|
|
5754
|
-
...this.front,
|
|
5755
|
-
...this,
|
|
5756
|
-
...this.back
|
|
5757
|
-
];
|
|
5605
|
+
return this.getInternal();
|
|
5758
5606
|
}
|
|
5759
5607
|
constructor(...items) {
|
|
5760
|
-
super();
|
|
5761
5608
|
this.set(items);
|
|
5762
5609
|
}
|
|
5763
5610
|
set(items) {
|
|
5764
5611
|
this.front.length = 0;
|
|
5765
|
-
this.length = 0;
|
|
5612
|
+
this.default.length = 0;
|
|
5766
5613
|
this.back.length = 0;
|
|
5767
5614
|
items.forEach((item) => {
|
|
5768
5615
|
switch (item.internalMode) {
|
|
@@ -5770,7 +5617,7 @@ class Children extends Array {
|
|
|
5770
5617
|
this.front.push(item);
|
|
5771
5618
|
break;
|
|
5772
5619
|
case "default":
|
|
5773
|
-
this.push(item);
|
|
5620
|
+
this.default.push(item);
|
|
5774
5621
|
break;
|
|
5775
5622
|
case "back":
|
|
5776
5623
|
this.back.push(item);
|
|
@@ -5780,19 +5627,27 @@ class Children extends Array {
|
|
|
5780
5627
|
return this;
|
|
5781
5628
|
}
|
|
5782
5629
|
getInternal(includeInternal) {
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5630
|
+
if (includeInternal) {
|
|
5631
|
+
switch (includeInternal) {
|
|
5632
|
+
case "front":
|
|
5633
|
+
return this.front;
|
|
5634
|
+
case "default":
|
|
5635
|
+
return this.default;
|
|
5636
|
+
case "back":
|
|
5637
|
+
return this.back;
|
|
5638
|
+
default:
|
|
5639
|
+
throw new Error(`Unknown internal mode: ${includeInternal}`);
|
|
5640
|
+
}
|
|
5641
|
+
} else {
|
|
5642
|
+
return [
|
|
5643
|
+
...this.front,
|
|
5644
|
+
...this.default,
|
|
5645
|
+
...this.back
|
|
5646
|
+
];
|
|
5792
5647
|
}
|
|
5793
5648
|
}
|
|
5794
5649
|
toJSON() {
|
|
5795
|
-
return [...this];
|
|
5650
|
+
return [...this.default];
|
|
5796
5651
|
}
|
|
5797
5652
|
}
|
|
5798
5653
|
|
|
@@ -5933,13 +5788,16 @@ let Node = class extends CoreObject {
|
|
|
5933
5788
|
/** Children */
|
|
5934
5789
|
_children = new Children();
|
|
5935
5790
|
get children() {
|
|
5936
|
-
return this._children;
|
|
5791
|
+
return this._children.default;
|
|
5937
5792
|
}
|
|
5938
5793
|
set children(value) {
|
|
5939
|
-
|
|
5794
|
+
this._children.set(value);
|
|
5795
|
+
}
|
|
5796
|
+
getChildren(internalMode = "default") {
|
|
5797
|
+
return this._children.getInternal(internalMode === true ? void 0 : internalMode);
|
|
5940
5798
|
}
|
|
5941
5799
|
getChild(index = 0) {
|
|
5942
|
-
return this.
|
|
5800
|
+
return this.children[index];
|
|
5943
5801
|
}
|
|
5944
5802
|
get siblingIndex() {
|
|
5945
5803
|
return this.getIndex();
|
|
@@ -6003,9 +5861,6 @@ let Node = class extends CoreObject {
|
|
|
6003
5861
|
return false;
|
|
6004
5862
|
}
|
|
6005
5863
|
}
|
|
6006
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
6007
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
6008
|
-
}
|
|
6009
5864
|
_onTreeEnter(tree) {
|
|
6010
5865
|
this._treeEnter(tree);
|
|
6011
5866
|
this.emit("treeEntered", tree);
|
|
@@ -6105,7 +5960,7 @@ let Node = class extends CoreObject {
|
|
|
6105
5960
|
}
|
|
6106
5961
|
}
|
|
6107
5962
|
getIndex() {
|
|
6108
|
-
return this._parent?.
|
|
5963
|
+
return this._parent?.getChildren(this.internalMode).indexOf(this) ?? 0;
|
|
6109
5964
|
}
|
|
6110
5965
|
getNode(path) {
|
|
6111
5966
|
return this._children.internal.find((child) => child.name === path);
|
|
@@ -6181,7 +6036,7 @@ let Node = class extends CoreObject {
|
|
|
6181
6036
|
this._children.front.push(node);
|
|
6182
6037
|
break;
|
|
6183
6038
|
case "default":
|
|
6184
|
-
this._children.push(node);
|
|
6039
|
+
this._children.default.push(node);
|
|
6185
6040
|
break;
|
|
6186
6041
|
case "back":
|
|
6187
6042
|
this._children.back.push(node);
|
|
@@ -6225,24 +6080,24 @@ let Node = class extends CoreObject {
|
|
|
6225
6080
|
removeChild(child) {
|
|
6226
6081
|
const index = child.getIndex();
|
|
6227
6082
|
if (this.equal(child.parent) && index > -1) {
|
|
6228
|
-
this.
|
|
6083
|
+
this.getChildren(child.internalMode).splice(index, 1);
|
|
6229
6084
|
child.setParent(void 0);
|
|
6230
6085
|
this.emit("removeChild", child, index);
|
|
6231
6086
|
}
|
|
6232
6087
|
return child;
|
|
6233
6088
|
}
|
|
6234
6089
|
removeChildren() {
|
|
6235
|
-
this.
|
|
6090
|
+
this.children.forEach((child) => this.removeChild(child));
|
|
6236
6091
|
}
|
|
6237
6092
|
remove() {
|
|
6238
6093
|
this._parent?.removeChild(this);
|
|
6239
6094
|
}
|
|
6240
6095
|
forEachChild(callbackfn) {
|
|
6241
|
-
this.
|
|
6096
|
+
this.children.forEach(callbackfn);
|
|
6242
6097
|
return this;
|
|
6243
6098
|
}
|
|
6244
6099
|
forEachDescendant(callbackfn) {
|
|
6245
|
-
this.
|
|
6100
|
+
this.children.forEach((child) => {
|
|
6246
6101
|
callbackfn(child);
|
|
6247
6102
|
child.forEachDescendant(callbackfn);
|
|
6248
6103
|
});
|
|
@@ -6280,6 +6135,10 @@ let Node = class extends CoreObject {
|
|
|
6280
6135
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
6281
6136
|
_render(renderer) {
|
|
6282
6137
|
}
|
|
6138
|
+
destroy() {
|
|
6139
|
+
super.destroy();
|
|
6140
|
+
this._children.internal.forEach((node) => this.removeChild(node));
|
|
6141
|
+
}
|
|
6283
6142
|
clone() {
|
|
6284
6143
|
return new this.constructor(
|
|
6285
6144
|
this.toJSON(),
|
|
@@ -6289,7 +6148,7 @@ let Node = class extends CoreObject {
|
|
|
6289
6148
|
toJSON() {
|
|
6290
6149
|
return clearUndef({
|
|
6291
6150
|
...super.toJSON(),
|
|
6292
|
-
children: this.
|
|
6151
|
+
children: this.children.length ? [...this.children.map((child) => child.toJSON())] : void 0,
|
|
6293
6152
|
meta: {
|
|
6294
6153
|
...this.meta,
|
|
6295
6154
|
inCanvasIs: this.is
|
|
@@ -6318,19 +6177,19 @@ __decorateClass$S([
|
|
|
6318
6177
|
property({ default: () => ({}) })
|
|
6319
6178
|
], Node.prototype, "meta", 2);
|
|
6320
6179
|
__decorateClass$S([
|
|
6321
|
-
property({
|
|
6180
|
+
property({ internal: true, fallback: "inherit" })
|
|
6322
6181
|
], Node.prototype, "processMode", 2);
|
|
6323
6182
|
__decorateClass$S([
|
|
6324
|
-
property({
|
|
6183
|
+
property({ internal: true, fallback: "default" })
|
|
6325
6184
|
], Node.prototype, "processSortMode", 2);
|
|
6326
6185
|
__decorateClass$S([
|
|
6327
|
-
property({
|
|
6186
|
+
property({ internal: true, fallback: "inherit" })
|
|
6328
6187
|
], Node.prototype, "renderMode", 2);
|
|
6329
6188
|
__decorateClass$S([
|
|
6330
|
-
property({
|
|
6189
|
+
property({ internal: true, fallback: "inherit" })
|
|
6331
6190
|
], Node.prototype, "inputMode", 2);
|
|
6332
6191
|
__decorateClass$S([
|
|
6333
|
-
property({
|
|
6192
|
+
property({ internal: true, fallback: "default" })
|
|
6334
6193
|
], Node.prototype, "internalMode", 2);
|
|
6335
6194
|
__decorateClass$S([
|
|
6336
6195
|
property({ protected: true })
|
|
@@ -6416,7 +6275,7 @@ __decorateClass$R([
|
|
|
6416
6275
|
property({ fallback: false })
|
|
6417
6276
|
], TimelineNode.prototype, "paused", 2);
|
|
6418
6277
|
__decorateClass$R([
|
|
6419
|
-
property({
|
|
6278
|
+
property({ internal: true, fallback: false })
|
|
6420
6279
|
], TimelineNode.prototype, "insideTimeRange", 2);
|
|
6421
6280
|
TimelineNode = __decorateClass$R([
|
|
6422
6281
|
customNode("TimelineNode")
|
|
@@ -6457,8 +6316,8 @@ let CanvasItem = class extends TimelineNode {
|
|
|
6457
6316
|
super();
|
|
6458
6317
|
this.setProperties(properties).append(nodes);
|
|
6459
6318
|
}
|
|
6460
|
-
_updateProperty(key, value, oldValue
|
|
6461
|
-
super._updateProperty(key, value, oldValue
|
|
6319
|
+
_updateProperty(key, value, oldValue) {
|
|
6320
|
+
super._updateProperty(key, value, oldValue);
|
|
6462
6321
|
switch (key) {
|
|
6463
6322
|
case "modulate":
|
|
6464
6323
|
this._modulate.value = value;
|
|
@@ -6588,10 +6447,10 @@ __decorateClass$Q([
|
|
|
6588
6447
|
property()
|
|
6589
6448
|
], CanvasItem.prototype, "blendMode", 2);
|
|
6590
6449
|
__decorateClass$Q([
|
|
6591
|
-
property({
|
|
6450
|
+
property({ internal: true, fallback: true })
|
|
6592
6451
|
], CanvasItem.prototype, "visible", 2);
|
|
6593
6452
|
__decorateClass$Q([
|
|
6594
|
-
property({
|
|
6453
|
+
property({ internal: true, fallback: 1 })
|
|
6595
6454
|
], CanvasItem.prototype, "opacity", 2);
|
|
6596
6455
|
CanvasItem = __decorateClass$Q([
|
|
6597
6456
|
customNode("CanvasItem")
|
|
@@ -6657,8 +6516,8 @@ let Viewport = class extends Node {
|
|
|
6657
6516
|
);
|
|
6658
6517
|
});
|
|
6659
6518
|
}
|
|
6660
|
-
_updateProperty(key, value, oldValue
|
|
6661
|
-
super._updateProperty(key, value, oldValue
|
|
6519
|
+
_updateProperty(key, value, oldValue) {
|
|
6520
|
+
super._updateProperty(key, value, oldValue);
|
|
6662
6521
|
switch (key) {
|
|
6663
6522
|
case "x":
|
|
6664
6523
|
case "y":
|
|
@@ -6797,8 +6656,8 @@ let Effect = class extends TimelineNode {
|
|
|
6797
6656
|
this._onNodeProcessed = this._onNodeProcessed.bind(this);
|
|
6798
6657
|
this.setProperties(properties).append(children);
|
|
6799
6658
|
}
|
|
6800
|
-
_updateProperty(key, value, oldValue
|
|
6801
|
-
super._updateProperty(key, value, oldValue
|
|
6659
|
+
_updateProperty(key, value, oldValue) {
|
|
6660
|
+
super._updateProperty(key, value, oldValue);
|
|
6802
6661
|
switch (key) {
|
|
6803
6662
|
case "glsl": {
|
|
6804
6663
|
const material = new EffectMaterial(value);
|
|
@@ -6887,7 +6746,7 @@ let Effect = class extends TimelineNode {
|
|
|
6887
6746
|
calls.splice(start, 0, renderStack.createCall(this));
|
|
6888
6747
|
}
|
|
6889
6748
|
_processChildren() {
|
|
6890
|
-
if (this.
|
|
6749
|
+
if (this.children.length) {
|
|
6891
6750
|
super.emit("process");
|
|
6892
6751
|
this._tree?.renderStack.push(this);
|
|
6893
6752
|
}
|
|
@@ -7167,8 +7026,8 @@ class SceneTree extends MainLoop {
|
|
|
7167
7026
|
super();
|
|
7168
7027
|
this.timeline = timeline.setTree(this);
|
|
7169
7028
|
}
|
|
7170
|
-
_updateProperty(key, value, oldValue
|
|
7171
|
-
super._updateProperty(key, value, oldValue
|
|
7029
|
+
_updateProperty(key, value, oldValue) {
|
|
7030
|
+
super._updateProperty(key, value, oldValue);
|
|
7172
7031
|
switch (key) {
|
|
7173
7032
|
case "backgroundColor":
|
|
7174
7033
|
this._backgroundColor.value = value;
|
|
@@ -7213,20 +7072,20 @@ class SceneTree extends MainLoop {
|
|
|
7213
7072
|
QuadUvGeometry.draw(renderer);
|
|
7214
7073
|
renderer.texture.unbind(texture);
|
|
7215
7074
|
}
|
|
7216
|
-
|
|
7217
|
-
super.
|
|
7218
|
-
this.root.
|
|
7075
|
+
destroy() {
|
|
7076
|
+
super.destroy();
|
|
7077
|
+
this.root.destroy();
|
|
7219
7078
|
this.input.removeEventListeners();
|
|
7220
7079
|
}
|
|
7221
7080
|
}
|
|
7222
7081
|
__decorateClass$L([
|
|
7223
|
-
property({
|
|
7082
|
+
property({ internal: true, fallback: false })
|
|
7224
7083
|
], SceneTree.prototype, "processPaused");
|
|
7225
7084
|
__decorateClass$L([
|
|
7226
7085
|
property()
|
|
7227
7086
|
], SceneTree.prototype, "backgroundColor");
|
|
7228
7087
|
__decorateClass$L([
|
|
7229
|
-
property({
|
|
7088
|
+
property({ internal: true, fallback: false })
|
|
7230
7089
|
], SceneTree.prototype, "debug");
|
|
7231
7090
|
|
|
7232
7091
|
var __getOwnPropDesc$C = Object.getOwnPropertyDescriptor;
|
|
@@ -7275,8 +7134,8 @@ let Node2D = class extends CanvasItem {
|
|
|
7275
7134
|
super();
|
|
7276
7135
|
this.setProperties(properties).append(nodes);
|
|
7277
7136
|
}
|
|
7278
|
-
_updateProperty(key, value, oldValue
|
|
7279
|
-
super._updateProperty(key, value, oldValue
|
|
7137
|
+
_updateProperty(key, value, oldValue) {
|
|
7138
|
+
super._updateProperty(key, value, oldValue);
|
|
7280
7139
|
switch (key) {
|
|
7281
7140
|
case "rotation":
|
|
7282
7141
|
this.updateGlobalTransform();
|
|
@@ -7363,10 +7222,10 @@ let Node2D = class extends CanvasItem {
|
|
|
7363
7222
|
}
|
|
7364
7223
|
};
|
|
7365
7224
|
__decorateClass$J([
|
|
7366
|
-
property({
|
|
7225
|
+
property({ internal: true, fallback: 0 })
|
|
7367
7226
|
], Node2D.prototype, "rotation", 2);
|
|
7368
7227
|
__decorateClass$J([
|
|
7369
|
-
property({
|
|
7228
|
+
property({ internal: true, fallback: 0 })
|
|
7370
7229
|
], Node2D.prototype, "globalRotation", 2);
|
|
7371
7230
|
Node2D = __decorateClass$J([
|
|
7372
7231
|
customNode("Node2D")
|
|
@@ -7493,10 +7352,10 @@ let Camera2D = class extends Node2D {
|
|
|
7493
7352
|
}
|
|
7494
7353
|
};
|
|
7495
7354
|
__decorateClass$I([
|
|
7496
|
-
property({
|
|
7355
|
+
property({ internal: true, fallback: false })
|
|
7497
7356
|
], Camera2D.prototype, "spaceKey", 2);
|
|
7498
7357
|
__decorateClass$I([
|
|
7499
|
-
property({
|
|
7358
|
+
property({ internal: true, fallback: false })
|
|
7500
7359
|
], Camera2D.prototype, "grabbing", 2);
|
|
7501
7360
|
Camera2D = __decorateClass$I([
|
|
7502
7361
|
customNode("Camera2D", {
|
|
@@ -8882,8 +8741,8 @@ void main() {
|
|
|
8882
8741
|
this.setProperties(properties).append(children);
|
|
8883
8742
|
this._generateKernels();
|
|
8884
8743
|
}
|
|
8885
|
-
_updateProperty(key, value, oldValue
|
|
8886
|
-
super._updateProperty(key, value, oldValue
|
|
8744
|
+
_updateProperty(key, value, oldValue) {
|
|
8745
|
+
super._updateProperty(key, value, oldValue);
|
|
8887
8746
|
switch (key) {
|
|
8888
8747
|
case "quality":
|
|
8889
8748
|
case "strength":
|
|
@@ -8960,8 +8819,8 @@ let MaskEffect = class extends Effect {
|
|
|
8960
8819
|
this.texture = await assets.texture.load(this.src);
|
|
8961
8820
|
}
|
|
8962
8821
|
}
|
|
8963
|
-
_updateProperty(key, value, oldValue
|
|
8964
|
-
super._updateProperty(key, value, oldValue
|
|
8822
|
+
_updateProperty(key, value, oldValue) {
|
|
8823
|
+
super._updateProperty(key, value, oldValue);
|
|
8965
8824
|
switch (key) {
|
|
8966
8825
|
case "src":
|
|
8967
8826
|
this.load();
|
|
@@ -9438,8 +9297,8 @@ class BaseElement2DFill extends CoreObject {
|
|
|
9438
9297
|
isNone(properties) ? void 0 : normalizeFill(properties)
|
|
9439
9298
|
);
|
|
9440
9299
|
}
|
|
9441
|
-
_updateProperty(key, value, oldValue
|
|
9442
|
-
super._updateProperty(key, value, oldValue
|
|
9300
|
+
_updateProperty(key, value, oldValue) {
|
|
9301
|
+
super._updateProperty(key, value, oldValue);
|
|
9443
9302
|
switch (key) {
|
|
9444
9303
|
case "color":
|
|
9445
9304
|
case "cropRect":
|
|
@@ -9546,8 +9405,8 @@ class BaseElement2DBackground extends BaseElement2DFill {
|
|
|
9546
9405
|
isNone(properties) ? void 0 : normalizeBackground(properties)
|
|
9547
9406
|
);
|
|
9548
9407
|
}
|
|
9549
|
-
_updateProperty(key, value, oldValue
|
|
9550
|
-
super._updateProperty(key, value, oldValue
|
|
9408
|
+
_updateProperty(key, value, oldValue) {
|
|
9409
|
+
super._updateProperty(key, value, oldValue);
|
|
9551
9410
|
switch (key) {
|
|
9552
9411
|
case "fillWithShape":
|
|
9553
9412
|
this.parent.requestRedraw();
|
|
@@ -9574,8 +9433,8 @@ class BaseElement2DForeground extends BaseElement2DFill {
|
|
|
9574
9433
|
isNone(properties) ? void 0 : normalizeForeground(properties)
|
|
9575
9434
|
);
|
|
9576
9435
|
}
|
|
9577
|
-
_updateProperty(key, value, oldValue
|
|
9578
|
-
super._updateProperty(key, value, oldValue
|
|
9436
|
+
_updateProperty(key, value, oldValue) {
|
|
9437
|
+
super._updateProperty(key, value, oldValue);
|
|
9579
9438
|
switch (key) {
|
|
9580
9439
|
case "fillWithShape":
|
|
9581
9440
|
this.parent.requestRedraw();
|
|
@@ -9602,8 +9461,8 @@ class BaseElement2DOutline extends BaseElement2DFill {
|
|
|
9602
9461
|
isNone(properties) ? void 0 : normalizeOutline(properties)
|
|
9603
9462
|
);
|
|
9604
9463
|
}
|
|
9605
|
-
_updateProperty(key, value, oldValue
|
|
9606
|
-
super._updateProperty(key, value, oldValue
|
|
9464
|
+
_updateProperty(key, value, oldValue) {
|
|
9465
|
+
super._updateProperty(key, value, oldValue);
|
|
9607
9466
|
switch (key) {
|
|
9608
9467
|
case "width":
|
|
9609
9468
|
case "style":
|
|
@@ -9671,8 +9530,8 @@ class BaseElement2DShadow extends CoreObject {
|
|
|
9671
9530
|
isNone(properties) ? void 0 : normalizeShadow(properties)
|
|
9672
9531
|
);
|
|
9673
9532
|
}
|
|
9674
|
-
_updateProperty(key, value, oldValue
|
|
9675
|
-
super._updateProperty(key, value, oldValue
|
|
9533
|
+
_updateProperty(key, value, oldValue) {
|
|
9534
|
+
super._updateProperty(key, value, oldValue);
|
|
9676
9535
|
switch (key) {
|
|
9677
9536
|
case "color":
|
|
9678
9537
|
case "blur":
|
|
@@ -9735,8 +9594,8 @@ class BaseElement2DShape extends CoreObject {
|
|
|
9735
9594
|
isNone(properties) ? void 0 : normalizeShape(properties)
|
|
9736
9595
|
);
|
|
9737
9596
|
}
|
|
9738
|
-
_updateProperty(key, value, oldValue
|
|
9739
|
-
super._updateProperty(key, value, oldValue
|
|
9597
|
+
_updateProperty(key, value, oldValue) {
|
|
9598
|
+
super._updateProperty(key, value, oldValue);
|
|
9740
9599
|
switch (key) {
|
|
9741
9600
|
case "svg":
|
|
9742
9601
|
case "paths":
|
|
@@ -9842,7 +9701,7 @@ class BaseElement2DText extends CoreObject {
|
|
|
9842
9701
|
case "effects":
|
|
9843
9702
|
case "fill":
|
|
9844
9703
|
case "outline":
|
|
9845
|
-
this.
|
|
9704
|
+
this.setProperty(args[0], args[1]);
|
|
9846
9705
|
break;
|
|
9847
9706
|
}
|
|
9848
9707
|
this._updateProperty(...args);
|
|
@@ -9856,8 +9715,8 @@ class BaseElement2DText extends CoreObject {
|
|
|
9856
9715
|
isNone(properties) ? void 0 : normalizeText(properties)
|
|
9857
9716
|
);
|
|
9858
9717
|
}
|
|
9859
|
-
_updateProperty(key, value, oldValue
|
|
9860
|
-
super._updateProperty(key, value, oldValue
|
|
9718
|
+
_updateProperty(key, value, oldValue) {
|
|
9719
|
+
super._updateProperty(key, value, oldValue);
|
|
9861
9720
|
switch (key) {
|
|
9862
9721
|
case "enabled":
|
|
9863
9722
|
case "effects":
|
|
@@ -10049,10 +9908,10 @@ __decorateClass$m([
|
|
|
10049
9908
|
property({ alias: "base.outline" })
|
|
10050
9909
|
], BaseElement2DText.prototype, "outline");
|
|
10051
9910
|
__decorateClass$m([
|
|
10052
|
-
property({
|
|
9911
|
+
property({ internal: true, alias: "base.measureDom" })
|
|
10053
9912
|
], BaseElement2DText.prototype, "measureDom");
|
|
10054
9913
|
__decorateClass$m([
|
|
10055
|
-
property({
|
|
9914
|
+
property({ internal: true, alias: "base.fonts" })
|
|
10056
9915
|
], BaseElement2DText.prototype, "fonts");
|
|
10057
9916
|
|
|
10058
9917
|
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
|
@@ -10073,8 +9932,8 @@ let BaseElement2D = class extends Node2D {
|
|
|
10073
9932
|
}
|
|
10074
9933
|
set style(style) {
|
|
10075
9934
|
const cb = (...args) => {
|
|
10076
|
-
this.emit("updateStyleProperty",
|
|
10077
|
-
this._updateStyleProperty(args[0], args[1], args[2]
|
|
9935
|
+
this.emit("updateStyleProperty", args[0], args[1], args[2]);
|
|
9936
|
+
this._updateStyleProperty(args[0], args[1], args[2]);
|
|
10078
9937
|
};
|
|
10079
9938
|
style.on("updateProperty", cb);
|
|
10080
9939
|
this._style?.off("updateProperty", cb);
|
|
@@ -10160,7 +10019,7 @@ let BaseElement2D = class extends Node2D {
|
|
|
10160
10019
|
}
|
|
10161
10020
|
return this;
|
|
10162
10021
|
}
|
|
10163
|
-
_updateStyleProperty(key, value, oldValue
|
|
10022
|
+
_updateStyleProperty(key, value, oldValue) {
|
|
10164
10023
|
switch (key) {
|
|
10165
10024
|
case "rotate":
|
|
10166
10025
|
this.rotation = this.style.rotate * DEG_TO_RAD;
|
|
@@ -10413,7 +10272,7 @@ let BaseElement2D = class extends Node2D {
|
|
|
10413
10272
|
return this.style.pointerEvents !== "none";
|
|
10414
10273
|
}
|
|
10415
10274
|
input(event, key) {
|
|
10416
|
-
const array = this.
|
|
10275
|
+
const array = this.getChildren(true);
|
|
10417
10276
|
for (let i = array.length - 1; i >= 0; i--) {
|
|
10418
10277
|
array[i].input(event, key);
|
|
10419
10278
|
}
|
|
@@ -10510,8 +10369,8 @@ let Element2D = class extends BaseElement2D {
|
|
|
10510
10369
|
}
|
|
10511
10370
|
set style(style) {
|
|
10512
10371
|
const cb = (...args) => {
|
|
10513
|
-
this.emit("updateStyleProperty",
|
|
10514
|
-
this._updateStyleProperty(args[0], args[1], args[2]
|
|
10372
|
+
this.emit("updateStyleProperty", args[0], args[1], args[2]);
|
|
10373
|
+
this._updateStyleProperty(args[0], args[1], args[2]);
|
|
10515
10374
|
};
|
|
10516
10375
|
style.on("updateProperty", cb);
|
|
10517
10376
|
this._style?.off("updateProperty", cb);
|
|
@@ -10522,8 +10381,8 @@ let Element2D = class extends BaseElement2D {
|
|
|
10522
10381
|
this.style = new Element2DStyle();
|
|
10523
10382
|
this.setProperties(properties).append(nodes);
|
|
10524
10383
|
}
|
|
10525
|
-
_updateStyleProperty(key, value, oldValue
|
|
10526
|
-
super._updateStyleProperty(key, value, oldValue
|
|
10384
|
+
_updateStyleProperty(key, value, oldValue) {
|
|
10385
|
+
super._updateStyleProperty(key, value, oldValue);
|
|
10527
10386
|
switch (key) {
|
|
10528
10387
|
case "left":
|
|
10529
10388
|
this.position.x = Number(value);
|
|
@@ -10703,7 +10562,7 @@ class FlexLayout {
|
|
|
10703
10562
|
return this._node.getComputedLayout();
|
|
10704
10563
|
}
|
|
10705
10564
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
10706
|
-
updateStyleProperty(key, value, oldValue
|
|
10565
|
+
updateStyleProperty(key, value, oldValue) {
|
|
10707
10566
|
switch (key) {
|
|
10708
10567
|
case "alignContent":
|
|
10709
10568
|
this._node.setAlignContent(
|
|
@@ -10873,8 +10732,8 @@ let FlexElement2D = class extends BaseElement2D {
|
|
|
10873
10732
|
}
|
|
10874
10733
|
set style(style) {
|
|
10875
10734
|
const cb = (...args) => {
|
|
10876
|
-
this.emit("updateStyleProperty",
|
|
10877
|
-
this._updateStyleProperty(args[0], args[1], args[2]
|
|
10735
|
+
this.emit("updateStyleProperty", args[0], args[1], args[2]);
|
|
10736
|
+
this._updateStyleProperty(args[0], args[1], args[2]);
|
|
10878
10737
|
};
|
|
10879
10738
|
style.on("updateProperty", cb);
|
|
10880
10739
|
this._style?.off("updateProperty", cb);
|
|
@@ -10913,9 +10772,9 @@ let FlexElement2D = class extends BaseElement2D {
|
|
|
10913
10772
|
oldParent._layout._node.removeChild(this._layout._node);
|
|
10914
10773
|
}
|
|
10915
10774
|
}
|
|
10916
|
-
_updateStyleProperty(key, value, oldValue
|
|
10917
|
-
super._updateStyleProperty(key, value, oldValue
|
|
10918
|
-
this._layout.updateStyleProperty(key, value, oldValue
|
|
10775
|
+
_updateStyleProperty(key, value, oldValue) {
|
|
10776
|
+
super._updateStyleProperty(key, value, oldValue);
|
|
10777
|
+
this._layout.updateStyleProperty(key, value, oldValue);
|
|
10919
10778
|
if (this._layout._node.isDirty()) {
|
|
10920
10779
|
this.requestRelayout();
|
|
10921
10780
|
}
|
|
@@ -10977,8 +10836,8 @@ let Image2D = class extends Element2D {
|
|
|
10977
10836
|
this.setProperties(properties);
|
|
10978
10837
|
this.append(children);
|
|
10979
10838
|
}
|
|
10980
|
-
_updateProperty(key, value, oldValue
|
|
10981
|
-
super._updateProperty(key, value, oldValue
|
|
10839
|
+
_updateProperty(key, value, oldValue) {
|
|
10840
|
+
super._updateProperty(key, value, oldValue);
|
|
10982
10841
|
switch (key) {
|
|
10983
10842
|
case "src":
|
|
10984
10843
|
this._wait = this._load(value);
|
|
@@ -11139,8 +10998,8 @@ let Lottie2D = class extends TextureRect2D {
|
|
|
11139
10998
|
this.setProperties(properties);
|
|
11140
10999
|
this.append(children);
|
|
11141
11000
|
}
|
|
11142
|
-
_updateProperty(key, value, oldValue
|
|
11143
|
-
super._updateProperty(key, value, oldValue
|
|
11001
|
+
_updateProperty(key, value, oldValue) {
|
|
11002
|
+
super._updateProperty(key, value, oldValue);
|
|
11144
11003
|
switch (key) {
|
|
11145
11004
|
case "src":
|
|
11146
11005
|
this._load();
|
|
@@ -11192,8 +11051,8 @@ class TransformRect2D extends Element2D {
|
|
|
11192
11051
|
super();
|
|
11193
11052
|
this.setProperties(properties).append(nodes);
|
|
11194
11053
|
}
|
|
11195
|
-
_updateStyleProperty(key, value, oldValue
|
|
11196
|
-
super._updateStyleProperty(key, value, oldValue
|
|
11054
|
+
_updateStyleProperty(key, value, oldValue) {
|
|
11055
|
+
super._updateStyleProperty(key, value, oldValue);
|
|
11197
11056
|
switch (key) {
|
|
11198
11057
|
case "width":
|
|
11199
11058
|
case "height":
|
|
@@ -11254,8 +11113,8 @@ let Video2D = class extends TextureRect2D {
|
|
|
11254
11113
|
this.setProperties(properties);
|
|
11255
11114
|
this.append(children);
|
|
11256
11115
|
}
|
|
11257
|
-
_updateProperty(key, value, oldValue
|
|
11258
|
-
super._updateProperty(key, value, oldValue
|
|
11116
|
+
_updateProperty(key, value, oldValue) {
|
|
11117
|
+
super._updateProperty(key, value, oldValue);
|
|
11259
11118
|
switch (key) {
|
|
11260
11119
|
case "src":
|
|
11261
11120
|
this._wait = this._load(value);
|
|
@@ -11390,8 +11249,8 @@ let Animation = class extends TimelineNode {
|
|
|
11390
11249
|
this.commitStyles();
|
|
11391
11250
|
}
|
|
11392
11251
|
}
|
|
11393
|
-
_updateProperty(key, value, oldValue
|
|
11394
|
-
super._updateProperty(key, value, oldValue
|
|
11252
|
+
_updateProperty(key, value, oldValue) {
|
|
11253
|
+
super._updateProperty(key, value, oldValue);
|
|
11395
11254
|
switch (key) {
|
|
11396
11255
|
case "effectMode":
|
|
11397
11256
|
case "keyframes":
|
|
@@ -11403,7 +11262,7 @@ let Animation = class extends TimelineNode {
|
|
|
11403
11262
|
let targets;
|
|
11404
11263
|
switch (this.effectMode) {
|
|
11405
11264
|
case "sibling":
|
|
11406
|
-
targets = this.getParent()?.
|
|
11265
|
+
targets = this.getParent()?.getChildren(true).filter((val) => val instanceof CanvasItem) ?? [];
|
|
11407
11266
|
break;
|
|
11408
11267
|
case "parent":
|
|
11409
11268
|
default:
|
|
@@ -11648,7 +11507,7 @@ Animation = __decorateClass$e([
|
|
|
11648
11507
|
})
|
|
11649
11508
|
], Animation);
|
|
11650
11509
|
|
|
11651
|
-
class HTMLAudioContext extends
|
|
11510
|
+
class HTMLAudioContext extends Observable {
|
|
11652
11511
|
static _instance;
|
|
11653
11512
|
static get instance() {
|
|
11654
11513
|
if (!this._instance) {
|
|
@@ -11687,12 +11546,9 @@ class HTMLAudioContext extends EventEmitter {
|
|
|
11687
11546
|
this.refreshPaused();
|
|
11688
11547
|
return this.paused;
|
|
11689
11548
|
}
|
|
11690
|
-
free() {
|
|
11691
|
-
this.removeAllListeners();
|
|
11692
|
-
}
|
|
11693
11549
|
}
|
|
11694
11550
|
|
|
11695
|
-
class HTMLSound extends
|
|
11551
|
+
class HTMLSound extends Observable {
|
|
11696
11552
|
static PADDING = 0.1;
|
|
11697
11553
|
_source = null;
|
|
11698
11554
|
_audio = null;
|
|
@@ -11898,9 +11754,9 @@ class HTMLSound extends EventEmitter {
|
|
|
11898
11754
|
this.emit("progress", 1, this._duration);
|
|
11899
11755
|
this.emit("end", this);
|
|
11900
11756
|
}
|
|
11901
|
-
|
|
11757
|
+
destroy() {
|
|
11902
11758
|
Ticker.off(this._onUpdate);
|
|
11903
|
-
|
|
11759
|
+
super.destroy();
|
|
11904
11760
|
const source = this._source;
|
|
11905
11761
|
if (source) {
|
|
11906
11762
|
source.onended = null;
|
|
@@ -11963,7 +11819,7 @@ class HTMLAudio {
|
|
|
11963
11819
|
}
|
|
11964
11820
|
}
|
|
11965
11821
|
|
|
11966
|
-
class AudioPipeline extends
|
|
11822
|
+
class AudioPipeline extends Observable {
|
|
11967
11823
|
constructor(_input, _output) {
|
|
11968
11824
|
super();
|
|
11969
11825
|
this._input = _input;
|
|
@@ -12187,7 +12043,7 @@ class WebAudioContext extends AudioPipeline {
|
|
|
12187
12043
|
}
|
|
12188
12044
|
}
|
|
12189
12045
|
|
|
12190
|
-
class WebSound extends
|
|
12046
|
+
class WebSound extends Observable {
|
|
12191
12047
|
_audio = null;
|
|
12192
12048
|
_sourceNode = null;
|
|
12193
12049
|
_gain = null;
|
|
@@ -12419,8 +12275,8 @@ class WebSound extends EventEmitter {
|
|
|
12419
12275
|
Ticker.on(this._updateListener);
|
|
12420
12276
|
}
|
|
12421
12277
|
}
|
|
12422
|
-
|
|
12423
|
-
|
|
12278
|
+
destroy() {
|
|
12279
|
+
super.destroy();
|
|
12424
12280
|
this._stop();
|
|
12425
12281
|
this._gain?.disconnect();
|
|
12426
12282
|
this._gain = null;
|
|
@@ -12616,8 +12472,8 @@ let Audio = class extends TimelineNode {
|
|
|
12616
12472
|
super();
|
|
12617
12473
|
this.src = src;
|
|
12618
12474
|
}
|
|
12619
|
-
_updateProperty(key, value, oldValue
|
|
12620
|
-
super._updateProperty(key, value, oldValue
|
|
12475
|
+
_updateProperty(key, value, oldValue) {
|
|
12476
|
+
super._updateProperty(key, value, oldValue);
|
|
12621
12477
|
switch (key) {
|
|
12622
12478
|
case "paused":
|
|
12623
12479
|
this.refreshPaused();
|
|
@@ -12704,7 +12560,7 @@ let Audio = class extends TimelineNode {
|
|
|
12704
12560
|
this._recycleSound(sound);
|
|
12705
12561
|
};
|
|
12706
12562
|
_recycleSound(sound) {
|
|
12707
|
-
sound.
|
|
12563
|
+
sound.destroy();
|
|
12708
12564
|
if (!Audio._soundPool.includes(sound)) {
|
|
12709
12565
|
Audio._soundPool.push(sound);
|
|
12710
12566
|
}
|
|
@@ -12764,8 +12620,8 @@ let AudioWaveform = class extends Element2D {
|
|
|
12764
12620
|
super();
|
|
12765
12621
|
this.setProperties(options);
|
|
12766
12622
|
}
|
|
12767
|
-
_updateProperty(key, value, oldValue
|
|
12768
|
-
super._updateProperty(key, value, oldValue
|
|
12623
|
+
_updateProperty(key, value, oldValue) {
|
|
12624
|
+
super._updateProperty(key, value, oldValue);
|
|
12769
12625
|
switch (key) {
|
|
12770
12626
|
case "src":
|
|
12771
12627
|
this._loadSrc(value);
|
|
@@ -12848,10 +12704,10 @@ __decorateClass$c([
|
|
|
12848
12704
|
property()
|
|
12849
12705
|
], AudioWaveform.prototype, "src", 2);
|
|
12850
12706
|
__decorateClass$c([
|
|
12851
|
-
property()
|
|
12707
|
+
property({ fallback: 0 })
|
|
12852
12708
|
], AudioWaveform.prototype, "gap", 2);
|
|
12853
12709
|
__decorateClass$c([
|
|
12854
|
-
property()
|
|
12710
|
+
property({ fallback: "#000000" })
|
|
12855
12711
|
], AudioWaveform.prototype, "color", 2);
|
|
12856
12712
|
AudioWaveform = __decorateClass$c([
|
|
12857
12713
|
customNode("AudioWaveform")
|
|
@@ -12891,8 +12747,8 @@ let Control = class extends Element2D {
|
|
|
12891
12747
|
super._input(event, key);
|
|
12892
12748
|
this._guiInput(event, key);
|
|
12893
12749
|
}
|
|
12894
|
-
_updateStyleProperty(key, value, oldValue
|
|
12895
|
-
super._updateStyleProperty(key, value, oldValue
|
|
12750
|
+
_updateStyleProperty(key, value, oldValue) {
|
|
12751
|
+
super._updateStyleProperty(key, value, oldValue);
|
|
12896
12752
|
switch (key) {
|
|
12897
12753
|
case "width":
|
|
12898
12754
|
case "height":
|
|
@@ -12925,8 +12781,8 @@ let Range = class extends Control {
|
|
|
12925
12781
|
super();
|
|
12926
12782
|
this.setProperties(properties).append(children);
|
|
12927
12783
|
}
|
|
12928
|
-
_updateProperty(key, value, oldValue
|
|
12929
|
-
super._updateProperty(key, value, oldValue
|
|
12784
|
+
_updateProperty(key, value, oldValue) {
|
|
12785
|
+
super._updateProperty(key, value, oldValue);
|
|
12930
12786
|
switch (key) {
|
|
12931
12787
|
case "allowGreater":
|
|
12932
12788
|
case "allowLesser":
|
|
@@ -12982,8 +12838,8 @@ let Ruler = class extends Control {
|
|
|
12982
12838
|
this.setProperties(properties);
|
|
12983
12839
|
this.append(children);
|
|
12984
12840
|
}
|
|
12985
|
-
_updateProperty(key, value, oldValue
|
|
12986
|
-
super._updateProperty(key, value, oldValue
|
|
12841
|
+
_updateProperty(key, value, oldValue) {
|
|
12842
|
+
super._updateProperty(key, value, oldValue);
|
|
12987
12843
|
switch (key) {
|
|
12988
12844
|
case "offsetX":
|
|
12989
12845
|
case "offsetY":
|
|
@@ -12998,8 +12854,8 @@ let Ruler = class extends Control {
|
|
|
12998
12854
|
break;
|
|
12999
12855
|
}
|
|
13000
12856
|
}
|
|
13001
|
-
_updateStyleProperty(key, value, oldValue
|
|
13002
|
-
super._updateStyleProperty(key, value, oldValue
|
|
12857
|
+
_updateStyleProperty(key, value, oldValue) {
|
|
12858
|
+
super._updateStyleProperty(key, value, oldValue);
|
|
13003
12859
|
switch (key) {
|
|
13004
12860
|
case "width":
|
|
13005
12861
|
case "height":
|
|
@@ -13166,8 +13022,8 @@ let ScrollBar = class extends Range {
|
|
|
13166
13022
|
super();
|
|
13167
13023
|
this.setProperties(properties).append(children);
|
|
13168
13024
|
}
|
|
13169
|
-
_updateStyleProperty(key, value, oldValue
|
|
13170
|
-
super._updateStyleProperty(key, value, oldValue
|
|
13025
|
+
_updateStyleProperty(key, value, oldValue) {
|
|
13026
|
+
super._updateStyleProperty(key, value, oldValue);
|
|
13171
13027
|
switch (key) {
|
|
13172
13028
|
case "width":
|
|
13173
13029
|
case "height":
|
|
@@ -13286,8 +13142,8 @@ let Scaler = class extends Node {
|
|
|
13286
13142
|
this.setProperties(properties);
|
|
13287
13143
|
this.append(children);
|
|
13288
13144
|
}
|
|
13289
|
-
_updateProperty(key, value, oldValue
|
|
13290
|
-
super._updateProperty(key, value, oldValue
|
|
13145
|
+
_updateProperty(key, value, oldValue) {
|
|
13146
|
+
super._updateProperty(key, value, oldValue);
|
|
13291
13147
|
switch (key) {
|
|
13292
13148
|
case "translateY":
|
|
13293
13149
|
case "translateX":
|
|
@@ -13935,8 +13791,8 @@ class Assets {
|
|
|
13935
13791
|
_handled = /* @__PURE__ */ new Map();
|
|
13936
13792
|
_gc = SUPPORTS_WEAK_REF ? new FinalizationRegistry((id) => {
|
|
13937
13793
|
const ref = this.get(id);
|
|
13938
|
-
if (ref && "
|
|
13939
|
-
ref.
|
|
13794
|
+
if (ref && "destroy" in ref) {
|
|
13795
|
+
ref.destroy();
|
|
13940
13796
|
}
|
|
13941
13797
|
this._handled.delete(id);
|
|
13942
13798
|
}) : void 0;
|
|
@@ -14055,8 +13911,8 @@ class Assets {
|
|
|
14055
13911
|
gc() {
|
|
14056
13912
|
this._handled.forEach((_, id) => {
|
|
14057
13913
|
const ref = this.get(id);
|
|
14058
|
-
if (ref && "
|
|
14059
|
-
ref.
|
|
13914
|
+
if (ref && "destroy" in ref) {
|
|
13915
|
+
ref.destroy();
|
|
14060
13916
|
}
|
|
14061
13917
|
});
|
|
14062
13918
|
this._handled.clear();
|
|
@@ -14153,8 +14009,8 @@ let CanvasItemEditor = class extends Control {
|
|
|
14153
14009
|
this._onPointerup = this._onPointerup.bind(this);
|
|
14154
14010
|
this.append(this.ruler);
|
|
14155
14011
|
}
|
|
14156
|
-
_updateStyleProperty(key, value, oldValue
|
|
14157
|
-
super._updateStyleProperty(key, value, oldValue
|
|
14012
|
+
_updateStyleProperty(key, value, oldValue) {
|
|
14013
|
+
super._updateStyleProperty(key, value, oldValue);
|
|
14158
14014
|
switch (key) {
|
|
14159
14015
|
case "width":
|
|
14160
14016
|
this.drawboard.style.left = (this.size.width - this.drawboard.size.width) / 2;
|
|
@@ -14420,10 +14276,10 @@ class Engine extends SceneTree {
|
|
|
14420
14276
|
this._render(this.renderer);
|
|
14421
14277
|
});
|
|
14422
14278
|
}
|
|
14423
|
-
|
|
14424
|
-
super.
|
|
14279
|
+
destroy() {
|
|
14280
|
+
super.destroy();
|
|
14425
14281
|
this.enableAutoResize(false);
|
|
14426
|
-
this.renderer.
|
|
14282
|
+
this.renderer.destroy();
|
|
14427
14283
|
}
|
|
14428
14284
|
toPixels() {
|
|
14429
14285
|
return this.renderer.toPixels();
|