@sepveneto/dao 0.1.7 → 0.1.9
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 +116 -34
- 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/renderer/RenderPipe.d.ts +6 -0
- package/dist/renderer/texture/TextureSource.d.ts +1 -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/dist/scene/graphics/GraphicsPipe.d.ts +3 -1
- package/dist/scene/sprite/SpritePipe.d.ts +6 -1
- package/dist/scene/text/TextPipe.d.ts +2 -1
- 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;
|
|
@@ -905,13 +952,30 @@ var _SpritePipe, SpritePipe = class {
|
|
|
905
952
|
this._renderer = n;
|
|
906
953
|
}
|
|
907
954
|
addRenderable(n, j) {
|
|
908
|
-
this.
|
|
955
|
+
let M = this._getRuntimeSprite(n);
|
|
956
|
+
n.didViewUpdate && this._updateBatchableSprite(n, M), this._renderer.renderPipes.batch.addToBatch(M, j);
|
|
957
|
+
}
|
|
958
|
+
_updateBatchableSprite(n, j) {
|
|
959
|
+
j.texture = n._texture, j.bounds = n.bounds;
|
|
960
|
+
}
|
|
961
|
+
validateRenderable(n) {
|
|
962
|
+
return this._getRuntimeSprite(n).texture._source.uid !== n._texture._source.uid;
|
|
963
|
+
}
|
|
964
|
+
_getRuntimeSprite(n) {
|
|
965
|
+
return n._runtimeData[this._renderer.uid] || this._initCacheSprite(n);
|
|
966
|
+
}
|
|
967
|
+
_initCacheSprite(n) {
|
|
968
|
+
let j = {
|
|
909
969
|
renderable: n,
|
|
910
970
|
texture: n.texture,
|
|
911
971
|
transform: n.relativeGroupTransform,
|
|
912
972
|
bounds: n.bounds,
|
|
913
|
-
roundPixels: this._renderer._roundPixels | n._roundPixels
|
|
914
|
-
|
|
973
|
+
roundPixels: this._renderer._roundPixels | n._roundPixels,
|
|
974
|
+
destroy: function() {
|
|
975
|
+
this.renderable = null, this.texture = null, this.transform = null, this.bounds = null;
|
|
976
|
+
}
|
|
977
|
+
};
|
|
978
|
+
return n._runtimeData[this._renderer.uid] = j, j;
|
|
915
979
|
}
|
|
916
980
|
destroy() {
|
|
917
981
|
this._renderer = null;
|
|
@@ -962,13 +1026,13 @@ var _TextPipe, TextPipe = class {
|
|
|
962
1026
|
_TextPipe = TextPipe, _TextPipe.desc = { name: "text" };
|
|
963
1027
|
var ViewContainer = class extends Container {
|
|
964
1028
|
constructor(...n) {
|
|
965
|
-
super(...n), this._runtimeData = Object.create(null), this._roundPixels = 0, this._bounds = new Bounds(0, 1, 0, 0);
|
|
1029
|
+
super(...n), this._runtimeData = Object.create(null), this._roundPixels = 0, this._bounds = new Bounds(0, 1, 0, 0), this._boundsDirty = !0;
|
|
966
1030
|
}
|
|
967
1031
|
get bounds() {
|
|
968
|
-
return this.updateBounds(), this._bounds;
|
|
1032
|
+
return this._boundsDirty ? (this.updateBounds(), this._boundsDirty = !1, this._bounds) : this._bounds;
|
|
969
1033
|
}
|
|
970
1034
|
onViewUpdate() {
|
|
971
|
-
if (this.didViewUpdate) return;
|
|
1035
|
+
if (this._didViewChangeTick++, this._boundsDirty = !0, this.didViewUpdate) return;
|
|
972
1036
|
this.didViewUpdate = !0;
|
|
973
1037
|
let n = this.renderGroup || this.parentRenderGroup;
|
|
974
1038
|
n && n.onChildViewUpdate(this);
|
|
@@ -1210,7 +1274,7 @@ var ShapePath = class {
|
|
|
1210
1274
|
}
|
|
1211
1275
|
}, _GraphicsContext, GraphicsContext = class n {
|
|
1212
1276
|
constructor() {
|
|
1213
|
-
this._activePath = new GraphicsPath(), this._bounds = new Bounds(), this.instructions = [];
|
|
1277
|
+
this._activePath = new GraphicsPath(), this._bounds = new Bounds(), this._boundsDirty = !0, this.instructions = [];
|
|
1214
1278
|
}
|
|
1215
1279
|
setStrokeStyle(j) {
|
|
1216
1280
|
this._strokeStyle = toStrokeStyle(j, n.defaultStrokeStyle);
|
|
@@ -1218,7 +1282,9 @@ var ShapePath = class {
|
|
|
1218
1282
|
clear() {
|
|
1219
1283
|
return this._activePath.clear(), this.instructions.length = 0, this.onUpdate(), this;
|
|
1220
1284
|
}
|
|
1221
|
-
onUpdate() {
|
|
1285
|
+
onUpdate() {
|
|
1286
|
+
this._boundsDirty = !0;
|
|
1287
|
+
}
|
|
1222
1288
|
moveTo(n, j) {
|
|
1223
1289
|
return this._activePath.moveTo(n, j), this;
|
|
1224
1290
|
}
|
|
@@ -1264,6 +1330,8 @@ var ShapePath = class {
|
|
|
1264
1330
|
this._activePath.clear(), this._activePath.moveTo(n, j);
|
|
1265
1331
|
}
|
|
1266
1332
|
get bounds() {
|
|
1333
|
+
if (!this._boundsDirty) return this._bounds;
|
|
1334
|
+
this._boundsDirty = !1;
|
|
1267
1335
|
let n = this._bounds;
|
|
1268
1336
|
n.clear();
|
|
1269
1337
|
for (let j = 0; j < this.instructions.length; ++j) {
|
|
@@ -1278,7 +1346,7 @@ var ShapePath = class {
|
|
|
1278
1346
|
n.addFrame(F.minX - P, F.minY - P, F.maxX + P, F.maxY + P);
|
|
1279
1347
|
}
|
|
1280
1348
|
}
|
|
1281
|
-
return n;
|
|
1349
|
+
return n.isValid || n.set(0, 0, 0, 0), n;
|
|
1282
1350
|
}
|
|
1283
1351
|
clone() {
|
|
1284
1352
|
let j = new n();
|
|
@@ -1308,7 +1376,13 @@ var Graphics = class extends ViewContainer {
|
|
|
1308
1376
|
super({
|
|
1309
1377
|
label: "Graphics",
|
|
1310
1378
|
...M
|
|
1311
|
-
}), this.renderPipeId = "graphics", j ? this.context = j : this.context = new GraphicsContext();
|
|
1379
|
+
}), this.renderPipeId = "graphics", j ? this.context = j : this.context = new GraphicsContext(), this.didViewUpdate = !0;
|
|
1380
|
+
}
|
|
1381
|
+
get context() {
|
|
1382
|
+
return this._context;
|
|
1383
|
+
}
|
|
1384
|
+
set context(n) {
|
|
1385
|
+
n !== this._context && (this._context = n, this.onViewUpdate());
|
|
1312
1386
|
}
|
|
1313
1387
|
setStrokeStyle(...n) {
|
|
1314
1388
|
return this._callContextMethod("setStrokeStyle", n);
|
|
@@ -1342,7 +1416,7 @@ var Graphics = class extends ViewContainer {
|
|
|
1342
1416
|
}
|
|
1343
1417
|
updateBounds() {}
|
|
1344
1418
|
get bounds() {
|
|
1345
|
-
return this.
|
|
1419
|
+
return this._context.bounds;
|
|
1346
1420
|
}
|
|
1347
1421
|
clear() {
|
|
1348
1422
|
return this._callContextMethod("clear", []);
|
|
@@ -1354,6 +1428,9 @@ var Graphics = class extends ViewContainer {
|
|
|
1354
1428
|
addRenderable(n, j) {
|
|
1355
1429
|
this._renderer.renderPipes.batch.break(j), j.add(n);
|
|
1356
1430
|
}
|
|
1431
|
+
validateRenderable(n) {
|
|
1432
|
+
return !1;
|
|
1433
|
+
}
|
|
1357
1434
|
execute(n) {
|
|
1358
1435
|
let j = this._renderer, M = j.canvasContext, N = M.activeConext, P = j.roundPixels, F = (n.groupColorAlpha >>> 24 & 255) / 255;
|
|
1359
1436
|
if (!(F <= 0)) {
|
|
@@ -1743,7 +1820,7 @@ function drawLetterSpacing(n, j, M, N, P, F = !1, I = 0) {
|
|
|
1743
1820
|
}
|
|
1744
1821
|
var _TextureSource, TextureSource = class n extends eventemitter3_default {
|
|
1745
1822
|
constructor(j) {
|
|
1746
|
-
super(), this._resolution = 1, this.pixelWidth = 1, this.pixelHeight = 1, this.width = 1, this.height = 1;
|
|
1823
|
+
super(), this.uid = uid("textureSource"), this._resolution = 1, this.pixelWidth = 1, this.pixelHeight = 1, this.width = 1, this.height = 1;
|
|
1747
1824
|
let M = {
|
|
1748
1825
|
...n.defaultOptions,
|
|
1749
1826
|
...j
|
|
@@ -1930,7 +2007,9 @@ var RenderTexture = class n extends Texture {
|
|
|
1930
2007
|
constructor(n) {
|
|
1931
2008
|
var j;
|
|
1932
2009
|
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(
|
|
2010
|
+
super(L), this.renderPipeId = "text", this._didTextUpdate = !0, this._resolution = null, this._autoResolution = !0, this._anchor = new ObservablePoint({ _onUpdate: () => {
|
|
2011
|
+
this.onViewUpdate();
|
|
2012
|
+
} }, 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
2013
|
}
|
|
1935
2014
|
set resolution(n) {
|
|
1936
2015
|
this._autoResolution = n === null, this._resolution = n, this.onViewUpdate();
|
|
@@ -2439,7 +2518,7 @@ var AssetsClass = class {
|
|
|
2439
2518
|
this._initialized || this.init();
|
|
2440
2519
|
let M = n.map((n) => ({
|
|
2441
2520
|
...n,
|
|
2442
|
-
src:
|
|
2521
|
+
src: toAbsolutePath(n.src, this.basePath)
|
|
2443
2522
|
}));
|
|
2444
2523
|
return await this._mapLoadToResolve(M, j);
|
|
2445
2524
|
}
|
|
@@ -2457,6 +2536,9 @@ var AssetsClass = class {
|
|
|
2457
2536
|
}
|
|
2458
2537
|
};
|
|
2459
2538
|
const Assets = new AssetsClass();
|
|
2539
|
+
function toAbsolutePath(n, j) {
|
|
2540
|
+
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}`;
|
|
2541
|
+
}
|
|
2460
2542
|
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
2543
|
|
|
2462
2544
|
//# sourceMappingURL=dao.js.map
|