@sepveneto/dao 0.1.7 → 0.1.8
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/README.md +4 -2
- package/dist/dao.cjs +1 -1
- package/dist/dao.cjs.map +1 -1
- package/dist/dao.js +92 -30
- package/dist/dao.js.map +1 -1
- package/dist/maths/Bounds.d.ts +1 -0
- package/dist/maths/Matrix.d.ts +6 -3
- package/dist/maths/Point.d.ts +2 -2
- package/dist/maths/index.d.ts +4 -0
- package/dist/scene/ViewContainer.d.ts +1 -0
- package/dist/scene/container/Container.d.ts +13 -9
- package/dist/scene/container/RenderGroup.d.ts +6 -0
- package/dist/scene/container/__tests__/Container.test.d.ts +1 -0
- package/dist/scene/container/__tests__/DummyEffect.d.ts +12 -0
- package/dist/scene/container/__tests__/DummyView.d.ts +26 -0
- package/dist/scene/container/__tests__/RenderGroupSystem.test.d.ts +1 -0
- package/dist/scene/container/__tests__/getLocalBounds..test.d.ts +1 -0
- package/dist/scene/container/__tests__/toGlobal.test.d.ts +1 -0
- package/dist/scene/container/__tests__/toLocal.test.d.ts +1 -0
- package/dist/scene/container/mixins/measureMixin.d.ts +5 -1
- package/dist/scene/container/mixins/onRenderMixin.d.ts +9 -0
- package/dist/scene/graphics/Graphics.d.ts +3 -1
- package/dist/scene/graphics/GraphicsContext.d.ts +1 -0
- package/package.json +1 -1
package/dist/dao.js
CHANGED
|
@@ -20,6 +20,16 @@ var Matrix = class n {
|
|
|
20
20
|
let { x: j, y: M } = n;
|
|
21
21
|
return new Vector2(j * this.a + M * this.c + this.tx, j * this.b + M * this.d + this.ty);
|
|
22
22
|
}
|
|
23
|
+
translate(n, j) {
|
|
24
|
+
return this.tx += n, this.ty += j, this;
|
|
25
|
+
}
|
|
26
|
+
rotate(n) {
|
|
27
|
+
let j = Math.cos(n), M = Math.sin(n), N = this.a, P = this.c, F = this.tx;
|
|
28
|
+
return this.a = N * j - this.b * M, this.b = N * M + this.b * j, this.c = P * j - this.d * M, this.d = P * M + this.d * j, this.tx = F * j - this.ty * M, this.ty = F * M + this.ty * j, this;
|
|
29
|
+
}
|
|
30
|
+
scale(n, j) {
|
|
31
|
+
return this.a *= n, this.d *= j, this.c *= n, this.b *= j, this.tx *= n, this.ty *= j, this;
|
|
32
|
+
}
|
|
23
33
|
appendFrom(n, j) {
|
|
24
34
|
let M = n.a, N = n.b, P = n.c, F = n.d, I = n.tx, L = n.ty, R = j.a, z = j.b, B = j.c, V = j.d, H = j.tx, U = j.ty;
|
|
25
35
|
this.a = M * R + N * B, this.b = M * z + N * V, this.c = P * R + F * B, this.d = P * z + F * V, this.tx = I * R + L * B + H, this.ty = I * z + L * V + U;
|
|
@@ -216,7 +226,7 @@ var FederatedEvent = class {
|
|
|
216
226
|
return N && N[0];
|
|
217
227
|
}
|
|
218
228
|
_interactivePrune(n) {
|
|
219
|
-
return !n || !n.visible || n.eventMode === "none";
|
|
229
|
+
return !n || !n.visible || !n.renderable || !n.measurable || n.eventMode === "none";
|
|
220
230
|
}
|
|
221
231
|
hitTestMoveRecursive(n, j, M) {
|
|
222
232
|
let N = !1;
|
|
@@ -287,7 +297,7 @@ var InstructionSet = class {
|
|
|
287
297
|
this.worldTransform = new Matrix(), this.localTransform = new Matrix(), this.root = null, this.instructionSet = new InstructionSet(), this.structureDidChange = !0, this.renderGroupParent = null, this.renderGroupChildren = [], this.childrenToUpdate = Object.create(null), this.childrenRenderablesToUpdate = {
|
|
288
298
|
list: [],
|
|
289
299
|
index: 0
|
|
290
|
-
}, this.init(n);
|
|
300
|
+
}, this._onRenderContainers = [], this.init(n);
|
|
291
301
|
}
|
|
292
302
|
init(n) {
|
|
293
303
|
this.root = n;
|
|
@@ -295,7 +305,11 @@ var InstructionSet = class {
|
|
|
295
305
|
for (let n = 0; n < j.length; ++n) this.addChild(j[n]);
|
|
296
306
|
}
|
|
297
307
|
addChild(n) {
|
|
298
|
-
this.structureDidChange = !0, n.parentRenderGroup = this, n.parent === this.root ? n.relativeRenderGroupDepth = 1 : n.relativeRenderGroupDepth = n.parent.relativeRenderGroupDepth + 1, n.didChange = !0, this.onChildUpdate(n)
|
|
308
|
+
if (this.structureDidChange = !0, n.parentRenderGroup = this, n.parent === this.root ? n.relativeRenderGroupDepth = 1 : n.relativeRenderGroupDepth = n.parent.relativeRenderGroupDepth + 1, n.didChange = !0, this.onChildUpdate(n), n.renderGroup) {
|
|
309
|
+
this.addRenderGroupChild(n.renderGroup);
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
n._onRender && this.addOnRender(n);
|
|
299
313
|
let j = n.children;
|
|
300
314
|
for (let n = 0; n < j.length; ++n) this.addChild(j[n]);
|
|
301
315
|
}
|
|
@@ -310,10 +324,22 @@ var InstructionSet = class {
|
|
|
310
324
|
removeChildren(n) {
|
|
311
325
|
for (let j = 0; j < n.length; ++j) this.removeChild(n[j]);
|
|
312
326
|
}
|
|
327
|
+
addRenderGroupChild(n) {
|
|
328
|
+
n.renderGroupParent && n.renderGroupParent._removeRenderGroupChild(n), n.renderGroupParent = this, this.renderGroupChildren.push(n);
|
|
329
|
+
}
|
|
313
330
|
_removeRenderGroupChild(n) {
|
|
314
331
|
let j = this.renderGroupChildren.indexOf(n);
|
|
315
332
|
j > -1 && this.renderGroupChildren.splice(j, 1), n.renderGroupParent = null;
|
|
316
333
|
}
|
|
334
|
+
addOnRender(n) {
|
|
335
|
+
this._onRenderContainers.push(n);
|
|
336
|
+
}
|
|
337
|
+
removeOnRender(n) {
|
|
338
|
+
this._onRenderContainers.splice(this._onRenderContainers.indexOf(n), 1);
|
|
339
|
+
}
|
|
340
|
+
runOnRender(n) {
|
|
341
|
+
for (let j = 0; j < this._onRenderContainers.length; ++j) this._onRenderContainers[j]._onRender(n);
|
|
342
|
+
}
|
|
317
343
|
onChildViewUpdate(n) {
|
|
318
344
|
this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++] = n;
|
|
319
345
|
}
|
|
@@ -328,7 +354,7 @@ var InstructionSet = class {
|
|
|
328
354
|
n.globalDisplayStatus < 7 || (this.instructionSet.renderPipes[n.renderPipeId].updateRenderable(n), n.didViewUpdate = !1);
|
|
329
355
|
}
|
|
330
356
|
destroy() {
|
|
331
|
-
this.root = null, this.childrenRenderablesToUpdate = null, this.childrenToUpdate = null, this.renderGroupChildren = null, this.instructionSet = null;
|
|
357
|
+
this.root = null, this.childrenRenderablesToUpdate = null, this.childrenToUpdate = null, this._onRenderContainers = null, this.renderGroupChildren = null, this.instructionSet = null;
|
|
332
358
|
}
|
|
333
359
|
}, uidCache = { default: -1 };
|
|
334
360
|
function uid(n = "default") {
|
|
@@ -468,6 +494,9 @@ var eventemitter3_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJS
|
|
|
468
494
|
clear() {
|
|
469
495
|
this.minX = Infinity, this.minY = Infinity, this.maxX = -Infinity, this.maxY = -Infinity;
|
|
470
496
|
}
|
|
497
|
+
pad(n, j = n) {
|
|
498
|
+
return this.minX -= n, this.maxX += n, this.minY -= j, this.maxY += j, this;
|
|
499
|
+
}
|
|
471
500
|
get width() {
|
|
472
501
|
return this.maxX - this.minX;
|
|
473
502
|
}
|
|
@@ -512,7 +541,7 @@ var eventemitter3_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJS
|
|
|
512
541
|
get rectangle() {
|
|
513
542
|
this._rectangle || (this._rectangle = new Rectangle());
|
|
514
543
|
let n = this._rectangle;
|
|
515
|
-
return n.x = this.minX, n.y = this.minY, n.width = this.maxX - this.minX, n.height = this.maxY - this.minY, n;
|
|
544
|
+
return this.minX > this.maxX || this.minY > this.maxY ? (n.x = 0, n.y = 0, n.width = 0, n.height = 0) : (n.x = this.minX, n.y = this.minY, n.width = this.maxX - this.minX, n.height = this.maxY - this.minY), n;
|
|
516
545
|
}
|
|
517
546
|
addBoundsMask(n) {
|
|
518
547
|
this.minX = this.minX > n.minX ? this.minX : n.minX, this.minY = this.minY > n.minY ? this.minY : n.minY, this.maxX = this.maxX < n.maxX ? this.maxX : n.maxX, this.maxY = this.maxY < n.maxY ? this.maxY : n.maxY;
|
|
@@ -585,7 +614,6 @@ const effectMixin = {
|
|
|
585
614
|
sortDirty: !1
|
|
586
615
|
}, measureMixin = {
|
|
587
616
|
_localBoundsCacheData: null,
|
|
588
|
-
_localBounds: null,
|
|
589
617
|
_setWidth(n, j) {
|
|
590
618
|
let M = Math.sign(this.scale.x) || 1;
|
|
591
619
|
j === 0 ? this.scale.x = M : this.scale.x = n / j * M;
|
|
@@ -595,9 +623,25 @@ const effectMixin = {
|
|
|
595
623
|
j === 0 ? this.scale.y = M : this.scale.y = n / j * M;
|
|
596
624
|
},
|
|
597
625
|
getLocalBounds() {
|
|
598
|
-
|
|
626
|
+
this._localBoundsCacheData || (this._localBoundsCacheData = {
|
|
627
|
+
data: [],
|
|
628
|
+
index: 1,
|
|
629
|
+
didChange: !1,
|
|
630
|
+
localBounds: new Bounds()
|
|
631
|
+
});
|
|
632
|
+
let n = this._localBoundsCacheData;
|
|
633
|
+
return n.index = 1, n.didChange = !1, n.data[0] !== this._didViewChangeTick && (n.didChange = !0, n.data[0] = this._didViewChangeTick), checkChildrenDidChange(this, n), n.didChange && getLocalBounds(this, n.localBounds), n.localBounds;
|
|
599
634
|
}
|
|
600
|
-
}
|
|
635
|
+
};
|
|
636
|
+
function checkChildrenDidChange(n, j) {
|
|
637
|
+
let M = n.children;
|
|
638
|
+
for (let n = 0; n < M.length; ++n) {
|
|
639
|
+
let N = M[n], P = N.uid, F = (N._didViewChangeTick & 65535) << 16 | N._didContainerChangeTick & 65535, I = j.index;
|
|
640
|
+
(j.data[I] !== P || j.data[I + 1] !== F) && (j.data[I] = P, j.data[I + 1] = F, j.didChange = !0), j.index += 2, N.children.length && checkChildrenDidChange(N, j);
|
|
641
|
+
}
|
|
642
|
+
return j.didChange;
|
|
643
|
+
}
|
|
644
|
+
const childrenHelperMixin = { removeChildren(n = 0, j) {
|
|
601
645
|
let M = j == null ? this.children.length : j, N = M - n, P = [];
|
|
602
646
|
if (N > 0 && N <= M) {
|
|
603
647
|
for (let j = M - 1; j >= n; --j) {
|
|
@@ -606,7 +650,7 @@ const effectMixin = {
|
|
|
606
650
|
}
|
|
607
651
|
removeItems(this.children, n, M);
|
|
608
652
|
let j = this.renderGroup || this.parentRenderGroup;
|
|
609
|
-
return j && j.removeChildren(P), P;
|
|
653
|
+
return j && j.removeChildren(P), P.length > 0 && this._didViewChangeTick++, P;
|
|
610
654
|
} else if (N === 0 && this.children.length === 0) return P;
|
|
611
655
|
throw Error("removeChildren: numeric values are outside the acceptable range.");
|
|
612
656
|
} };
|
|
@@ -621,11 +665,12 @@ function removeItems(n, j, M) {
|
|
|
621
665
|
const UPDATE_COLOR = 1, UPDATE_BLEND = 2, UPDATE_VISIBLE = 4, UPDATE_TRANSFORM = 8;
|
|
622
666
|
var defaultSkew = new ObservablePoint(null), defaultOrigin = new ObservablePoint(null), defaultScale = new ObservablePoint(null, 1, 1), defaultPivot = new ObservablePoint(null), Container = class extends eventemitter3_default {
|
|
623
667
|
constructor(n = {}) {
|
|
624
|
-
|
|
668
|
+
var j, M;
|
|
669
|
+
super(), this.uid = uid("renderable"), this.destroyed = !1, this.renderGroup = null, this.parentRenderGroup = null, this.parent = null, this.eventMode = "passive", this.hitArea = null, this._position = new ObservablePoint(this, 0, 0), this.includeInBuild = !0, this.didChange = !1, this.didViewUpdate = !1, this.isSimple = !0, this.measurable = !0, this.relativeRenderGroupDepth = 0, this._didViewChangeTick = 0, this._didContainerChangeTick = 0, this._localTransformUpdateTick = 0, this._updateFlags = 15, this.localDisplayStatus = 7, this.globalDisplayStatus = 7, this.children = [], this.localTransform = new Matrix(), this.relativeGroupTransform = new Matrix(), this.groupTransform = this.relativeGroupTransform, this._rotation = 0, this._cx = 1, this._sx = 0, this._cy = 0, this._sy = 1, this._skew = defaultSkew, this._scale = defaultScale, this._origin = defaultOrigin, this._pivot = defaultPivot, this.localAlpha = 1, this.groupColor = 16777215, this.localColor = 16777215, this.groupAlpha = 1, this.groupColorAlpha = 4294967295, assignWithIgnore(this, n, {
|
|
625
670
|
children: !0,
|
|
626
671
|
parent: !0,
|
|
627
672
|
effects: !0
|
|
628
|
-
}), this.effects = [];
|
|
673
|
+
}), (j = n.children) == null || j.forEach((n) => this.addChild(n)), (M = n.parent) == null || M.addChild(this), this.effects = [];
|
|
629
674
|
}
|
|
630
675
|
get renderable() {
|
|
631
676
|
return !!(this.localDisplayStatus & 1);
|
|
@@ -639,7 +684,7 @@ var defaultSkew = new ObservablePoint(null), defaultOrigin = new ObservablePoint
|
|
|
639
684
|
}
|
|
640
685
|
set visible(n) {
|
|
641
686
|
let j = n ? 2 : 0;
|
|
642
|
-
(this.localDisplayStatus & 2) !== j && (this.parentRenderGroup && (this.parentRenderGroup.structureDidChange = !0), this._updateFlags |= 4, this.localDisplayStatus ^= 2, this._onUpdate());
|
|
687
|
+
(this.localDisplayStatus & 2) !== j && (this.parentRenderGroup && (this.parentRenderGroup.structureDidChange = !0), this._updateFlags |= 4, this.localDisplayStatus ^= 2, this._onUpdate(), this.emit("visibleChanged", n));
|
|
643
688
|
}
|
|
644
689
|
get isRenderGroup() {
|
|
645
690
|
return !!this.renderGroup;
|
|
@@ -660,10 +705,12 @@ var defaultSkew = new ObservablePoint(null), defaultOrigin = new ObservablePoint
|
|
|
660
705
|
this.sortDirty && (this.sortDirty = !1, this.children.sort(sortChildren));
|
|
661
706
|
}
|
|
662
707
|
depthOfChildModified() {
|
|
663
|
-
this.parent && (this.parent.sortableChildren = !0, this.parent.sortDirty = !0), this.parentRenderGroup;
|
|
708
|
+
this.parent && (this.parent.sortableChildren = !0, this.parent.sortDirty = !0), this.parentRenderGroup && (this.parentRenderGroup.structureDidChange = !0);
|
|
664
709
|
}
|
|
665
710
|
enableRenderGroup() {
|
|
666
|
-
|
|
711
|
+
if (this.renderGroup) return;
|
|
712
|
+
let n = this.parentRenderGroup;
|
|
713
|
+
n == null || n.removeChild(this), this.renderGroup = new RenderGroup(this), this.groupTransform = new Matrix(), n == null || n.addChild(this), this._updateIsSimple();
|
|
667
714
|
}
|
|
668
715
|
disableRenderGroup() {
|
|
669
716
|
if (!this.renderGroup) return;
|
|
@@ -696,7 +743,7 @@ var defaultSkew = new ObservablePoint(null), defaultOrigin = new ObservablePoint
|
|
|
696
743
|
this._cx = Math.cos(n + j.y), this._sx = Math.sin(n + j.y), this._cy = -Math.sin(n - j.x), this._sy = Math.cos(n - j.x);
|
|
697
744
|
}
|
|
698
745
|
updateLocalTransform() {
|
|
699
|
-
let n = this.
|
|
746
|
+
let n = this._didContainerChangeTick;
|
|
700
747
|
if (this._localTransformUpdateTick === n) return;
|
|
701
748
|
this._localTransformUpdateTick = n, this._updateSkew();
|
|
702
749
|
let j = this.position, M = this.localTransform, N = this._scale.x, P = this._scale.y, F = -this._origin.x, I = -this._origin.y, L = this._pivot.x, R = this._pivot.y;
|
|
@@ -768,7 +815,7 @@ var defaultSkew = new ObservablePoint(null), defaultOrigin = new ObservablePoint
|
|
|
768
815
|
return this._origin === defaultOrigin && (this._origin = new ObservablePoint(this, 0, 0)), this._origin;
|
|
769
816
|
}
|
|
770
817
|
set origin(n) {
|
|
771
|
-
this._origin === defaultOrigin && (this._origin = new ObservablePoint(this, 0, 0)), this._origin.copyFrom(n);
|
|
818
|
+
this._origin === defaultOrigin && (this._origin = new ObservablePoint(this, 0, 0)), typeof n == "number" ? this._origin.set(n) : this._origin.copyFrom(n);
|
|
772
819
|
}
|
|
773
820
|
get width() {
|
|
774
821
|
return Math.abs(this.scale.x * this.getLocalBounds().width);
|
|
@@ -784,7 +831,7 @@ var defaultSkew = new ObservablePoint(null), defaultOrigin = new ObservablePoint
|
|
|
784
831
|
return n[0];
|
|
785
832
|
}
|
|
786
833
|
let j = n[0], M = this.renderGroup || this.parentRenderGroup;
|
|
787
|
-
return j.parent === this ? (this.children.splice(this.children.indexOf(j), 1), this.children.push(j), M && (M.structureDidChange = !0), j) : (this.sortableChildren && (this.sortDirty = !0), j.parent && j.parent.removeChild(j), this.children.push(j), this.sortableChildren && (this.sortDirty = !0), j.parent = this, j.didChange = !0, j._updateFlags = 7, M && M.addChild(j), j._zIndex != 0 && j.depthOfChildModified(), j);
|
|
834
|
+
return j.parent === this ? (this.children.splice(this.children.indexOf(j), 1), this.children.push(j), M && (M.structureDidChange = !0), j) : (this.sortableChildren && (this.sortDirty = !0), j.parent && j.parent.removeChild(j), this.children.push(j), this.sortableChildren && (this.sortDirty = !0), j.parent = this, j.didChange = !0, j._updateFlags = 7, M && M.addChild(j), this._didViewChangeTick++, j._zIndex != 0 && j.depthOfChildModified(), j);
|
|
788
835
|
}
|
|
789
836
|
removeChild(...n) {
|
|
790
837
|
if (n.length > 1) {
|
|
@@ -794,10 +841,10 @@ var defaultSkew = new ObservablePoint(null), defaultOrigin = new ObservablePoint
|
|
|
794
841
|
let j = n[0];
|
|
795
842
|
if (!j) return j;
|
|
796
843
|
let M = this.children.indexOf(j);
|
|
797
|
-
return M > -1 && (this.children.splice(M, 1), j.parent = null), j;
|
|
844
|
+
return M > -1 && (this._didViewChangeTick++, this.children.splice(M, 1), this.renderGroup ? this.renderGroup.removeChild(j) : this.parentRenderGroup && this.parentRenderGroup.removeChild(j), j.parent = null), j;
|
|
798
845
|
}
|
|
799
846
|
_onUpdate(n) {
|
|
800
|
-
n && n === this._skew && this._updateSkew(), this.
|
|
847
|
+
n && n === this._skew && this._updateSkew(), this._didContainerChangeTick++, !this.didChange && (this.didChange = !0, this.parentRenderGroup && this.parentRenderGroup.onChildUpdate(this));
|
|
801
848
|
}
|
|
802
849
|
toGlobal(n, j) {
|
|
803
850
|
return this.getGlobalTransform(j).apply(n);
|
|
@@ -881,7 +928,7 @@ var _RenderGroupSystem, RenderGroupSystem = class {
|
|
|
881
928
|
}
|
|
882
929
|
_updateRenderGroup(n) {
|
|
883
930
|
let j = this.renderer, M = j.renderPipes;
|
|
884
|
-
n.instructionSet.renderPipes = M, n.structureDidChange ? clearList(n.childrenRenderablesToUpdate.list, 0) : validateRenderables(n, M), updateRenderGroupTransform(n), n.structureDidChange && (n.structureDidChange = !1, this._buildInstructions(n, j)), n.childrenRenderablesToUpdate.index = 0;
|
|
931
|
+
n.runOnRender(j), n.instructionSet.renderPipes = M, n.structureDidChange ? clearList(n.childrenRenderablesToUpdate.list, 0) : validateRenderables(n, M), updateRenderGroupTransform(n), n.structureDidChange && (n.structureDidChange = !1, this._buildInstructions(n, j)), n.childrenRenderablesToUpdate.index = 0;
|
|
885
932
|
}
|
|
886
933
|
render({ container: n, transform: j }) {
|
|
887
934
|
let M = this.renderer;
|
|
@@ -962,13 +1009,13 @@ var _TextPipe, TextPipe = class {
|
|
|
962
1009
|
_TextPipe = TextPipe, _TextPipe.desc = { name: "text" };
|
|
963
1010
|
var ViewContainer = class extends Container {
|
|
964
1011
|
constructor(...n) {
|
|
965
|
-
super(...n), this._runtimeData = Object.create(null), this._roundPixels = 0, this._bounds = new Bounds(0, 1, 0, 0);
|
|
1012
|
+
super(...n), this._runtimeData = Object.create(null), this._roundPixels = 0, this._bounds = new Bounds(0, 1, 0, 0), this._boundsDirty = !0;
|
|
966
1013
|
}
|
|
967
1014
|
get bounds() {
|
|
968
|
-
return this.updateBounds(), this._bounds;
|
|
1015
|
+
return this._boundsDirty ? (this.updateBounds(), this._boundsDirty = !1, this._bounds) : this._bounds;
|
|
969
1016
|
}
|
|
970
1017
|
onViewUpdate() {
|
|
971
|
-
if (this.didViewUpdate) return;
|
|
1018
|
+
if (this._didViewChangeTick++, this._boundsDirty = !0, this.didViewUpdate) return;
|
|
972
1019
|
this.didViewUpdate = !0;
|
|
973
1020
|
let n = this.renderGroup || this.parentRenderGroup;
|
|
974
1021
|
n && n.onChildViewUpdate(this);
|
|
@@ -1210,7 +1257,7 @@ var ShapePath = class {
|
|
|
1210
1257
|
}
|
|
1211
1258
|
}, _GraphicsContext, GraphicsContext = class n {
|
|
1212
1259
|
constructor() {
|
|
1213
|
-
this._activePath = new GraphicsPath(), this._bounds = new Bounds(), this.instructions = [];
|
|
1260
|
+
this._activePath = new GraphicsPath(), this._bounds = new Bounds(), this._boundsDirty = !0, this.instructions = [];
|
|
1214
1261
|
}
|
|
1215
1262
|
setStrokeStyle(j) {
|
|
1216
1263
|
this._strokeStyle = toStrokeStyle(j, n.defaultStrokeStyle);
|
|
@@ -1218,7 +1265,9 @@ var ShapePath = class {
|
|
|
1218
1265
|
clear() {
|
|
1219
1266
|
return this._activePath.clear(), this.instructions.length = 0, this.onUpdate(), this;
|
|
1220
1267
|
}
|
|
1221
|
-
onUpdate() {
|
|
1268
|
+
onUpdate() {
|
|
1269
|
+
this._boundsDirty = !0;
|
|
1270
|
+
}
|
|
1222
1271
|
moveTo(n, j) {
|
|
1223
1272
|
return this._activePath.moveTo(n, j), this;
|
|
1224
1273
|
}
|
|
@@ -1264,6 +1313,8 @@ var ShapePath = class {
|
|
|
1264
1313
|
this._activePath.clear(), this._activePath.moveTo(n, j);
|
|
1265
1314
|
}
|
|
1266
1315
|
get bounds() {
|
|
1316
|
+
if (!this._boundsDirty) return this._bounds;
|
|
1317
|
+
this._boundsDirty = !1;
|
|
1267
1318
|
let n = this._bounds;
|
|
1268
1319
|
n.clear();
|
|
1269
1320
|
for (let j = 0; j < this.instructions.length; ++j) {
|
|
@@ -1278,7 +1329,7 @@ var ShapePath = class {
|
|
|
1278
1329
|
n.addFrame(F.minX - P, F.minY - P, F.maxX + P, F.maxY + P);
|
|
1279
1330
|
}
|
|
1280
1331
|
}
|
|
1281
|
-
return n;
|
|
1332
|
+
return n.isValid || n.set(0, 0, 0, 0), n;
|
|
1282
1333
|
}
|
|
1283
1334
|
clone() {
|
|
1284
1335
|
let j = new n();
|
|
@@ -1308,7 +1359,13 @@ var Graphics = class extends ViewContainer {
|
|
|
1308
1359
|
super({
|
|
1309
1360
|
label: "Graphics",
|
|
1310
1361
|
...M
|
|
1311
|
-
}), this.renderPipeId = "graphics", j ? this.context = j : this.context = new GraphicsContext();
|
|
1362
|
+
}), this.renderPipeId = "graphics", j ? this.context = j : this.context = new GraphicsContext(), this.didViewUpdate = !0;
|
|
1363
|
+
}
|
|
1364
|
+
get context() {
|
|
1365
|
+
return this._context;
|
|
1366
|
+
}
|
|
1367
|
+
set context(n) {
|
|
1368
|
+
n !== this._context && (this._context = n, this.onViewUpdate());
|
|
1312
1369
|
}
|
|
1313
1370
|
setStrokeStyle(...n) {
|
|
1314
1371
|
return this._callContextMethod("setStrokeStyle", n);
|
|
@@ -1342,7 +1399,7 @@ var Graphics = class extends ViewContainer {
|
|
|
1342
1399
|
}
|
|
1343
1400
|
updateBounds() {}
|
|
1344
1401
|
get bounds() {
|
|
1345
|
-
return this.
|
|
1402
|
+
return this._context.bounds;
|
|
1346
1403
|
}
|
|
1347
1404
|
clear() {
|
|
1348
1405
|
return this._callContextMethod("clear", []);
|
|
@@ -1930,7 +1987,9 @@ var RenderTexture = class n extends Texture {
|
|
|
1930
1987
|
constructor(n) {
|
|
1931
1988
|
var j;
|
|
1932
1989
|
let { text: M, resolution: N, style: P, width: F, height: I, ...L } = n;
|
|
1933
|
-
super(L), this.renderPipeId = "text", this._didTextUpdate = !0, this._resolution = null, this._autoResolution = !0, this._anchor = new ObservablePoint(
|
|
1990
|
+
super(L), this.renderPipeId = "text", this._didTextUpdate = !0, this._resolution = null, this._autoResolution = !0, this._anchor = new ObservablePoint({ _onUpdate: () => {
|
|
1991
|
+
this.onViewUpdate();
|
|
1992
|
+
} }, 0, 0), this.text = (j = n.text) == null ? "" : j, this.style = P, this.resolution = N == null ? null : N, F != null && (this.width = F), I != null && (this.height = I);
|
|
1934
1993
|
}
|
|
1935
1994
|
set resolution(n) {
|
|
1936
1995
|
this._autoResolution = n === null, this._resolution = n, this.onViewUpdate();
|
|
@@ -2439,7 +2498,7 @@ var AssetsClass = class {
|
|
|
2439
2498
|
this._initialized || this.init();
|
|
2440
2499
|
let M = n.map((n) => ({
|
|
2441
2500
|
...n,
|
|
2442
|
-
src:
|
|
2501
|
+
src: toAbsolutePath(n.src, this.basePath)
|
|
2443
2502
|
}));
|
|
2444
2503
|
return await this._mapLoadToResolve(M, j);
|
|
2445
2504
|
}
|
|
@@ -2457,6 +2516,9 @@ var AssetsClass = class {
|
|
|
2457
2516
|
}
|
|
2458
2517
|
};
|
|
2459
2518
|
const Assets = new AssetsClass();
|
|
2519
|
+
function toAbsolutePath(n, j) {
|
|
2520
|
+
return n.startsWith("http") || !j ? n : n.startsWith("/") && j.endsWith("/") ? j + n.slice(1) : n.startsWith("/") && !j.endsWith("/") || !n.startsWith("/") && j.endsWith("/") ? j + n : `${j}/${n}`;
|
|
2521
|
+
}
|
|
2460
2522
|
export { Application, Assets, AssetsClass, CanvasRenderer, Container, Graphics, GraphicsContext, GraphicsPipe, Matrix, PI_2, Rectangle, RenderGroup, RenderTexture, Sprite, Text, TextPipe, Texture, Ticker, TickerListener, UPDATE_BLEND, UPDATE_COLOR, UPDATE_TRANSFORM, UPDATE_VISIBLE, Vector2, ViewContainer, buildShapePath, nextPow2 };
|
|
2461
2523
|
|
|
2462
2524
|
//# sourceMappingURL=dao.js.map
|