@sepveneto/dao 0.1.9 → 0.2.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/app/Application.d.ts +2 -2
- package/dist/assets/Assets.d.ts +4 -4
- package/dist/assets/loader/Loader.d.ts +2 -2
- package/dist/dao.cjs +1 -1
- package/dist/dao.cjs.map +1 -1
- package/dist/dao.js +1941 -1686
- package/dist/dao.js.map +1 -1
- package/dist/events/FederatedEvent.d.ts +2 -2
- package/dist/events/FederatedEventMap.d.ts +2 -2
- package/dist/main.d.ts +5 -5
- package/dist/maths/Bounds.d.ts +6 -3
- package/dist/maths/Matrix.d.ts +6 -10
- package/dist/maths/Point.d.ts +1 -1
- package/dist/maths/getLocalBounds.d.ts +4 -0
- package/dist/maths/index.d.ts +2 -2
- package/dist/maths/shapes/Polygon.d.ts +5 -2
- package/dist/maths/shapes/Rectangle.d.ts +3 -1
- package/dist/maths/utils.d.ts +17 -0
- package/dist/renderer/CanvasPool.d.ts +2 -2
- package/dist/renderer/RenderPipe.d.ts +1 -1
- package/dist/renderer/index.d.ts +15 -15
- package/dist/renderer/texture/RenderTexture.d.ts +1 -1
- package/dist/renderer/texture/Texture.d.ts +1 -1
- package/dist/renderer/texture/TextureSource.d.ts +3 -3
- package/dist/scene/ViewContainer.d.ts +3 -3
- package/dist/scene/batcher/Batcher.d.ts +1 -1
- package/dist/scene/batcher/BatcherPipe.d.ts +6 -6
- package/dist/scene/container/Container.d.ts +20 -20
- package/dist/scene/container/RenderGroup.d.ts +3 -3
- package/dist/scene/container/__tests__/DummyEffect.d.ts +1 -1
- package/dist/scene/container/__tests__/DummyView.d.ts +1 -1
- package/dist/scene/container/mixins/childrenHelperMixin.d.ts +1 -1
- package/dist/scene/container/mixins/effectMixin.d.ts +3 -3
- package/dist/scene/container/mixins/measureMixin.d.ts +1 -1
- package/dist/scene/graphics/Graphics.d.ts +7 -2
- package/dist/scene/graphics/GraphicsContext.d.ts +18 -32
- package/dist/scene/graphics/GraphicsPipe.d.ts +2 -2
- package/dist/scene/graphics/__tests__/Graphics.Bounds.test.d.ts +1 -0
- package/dist/scene/graphics/__tests__/Graphics.test.d.ts +1 -0
- package/dist/scene/graphics/__tests__/bounds.test.d.ts +1 -0
- package/dist/scene/graphics/path/GraphicsPath.d.ts +2 -2
- package/dist/scene/graphics/path/ShapePath.d.ts +5 -3
- package/dist/scene/graphics/utils/FillTypes.d.ts +28 -0
- package/dist/scene/graphics/utils/convertInputToStyle.d.ts +15 -0
- package/dist/scene/graphics/utils/getMaxMiterRatio.d.ts +11 -0
- package/dist/scene/index.d.ts +1 -1
- package/dist/scene/mask/StencilMask.d.ts +2 -2
- package/dist/scene/mask/StencilMaskPipe.d.ts +1 -1
- package/dist/scene/sprite/Sprite.d.ts +2 -2
- package/dist/scene/sprite/SpritePipe.d.ts +1 -1
- package/dist/scene/text/Text.d.ts +4 -4
- package/dist/scene/text/TextPipe.d.ts +3 -3
- package/dist/scene/text/TextStyle.d.ts +3 -3
- package/dist/scene/text/TextSystem.d.ts +1 -1
- package/dist/scene/text/utils.d.ts +18 -18
- package/dist/system/CanvasContextSystem.d.ts +1 -1
- package/dist/system/EventSystem.d.ts +10 -5
- package/dist/system/ExtractSystem.d.ts +2 -2
- package/dist/system/ViewSystem.d.ts +2 -2
- package/dist/ticker/Ticker.d.ts +243 -243
- package/dist/ticker/TickerListener.d.ts +5 -5
- package/dist/utils/color.d.ts +8 -0
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/pool/Pool.d.ts +17 -0
- package/dist/utils/pool/PoolGroup.d.ts +6 -0
- package/package.json +20 -26
package/dist/dao.js
CHANGED
|
@@ -1,513 +1,384 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
|
|
3
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
4
|
+
get: ((e) => i[e]).bind(null, d),
|
|
5
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
5
6
|
});
|
|
6
|
-
return
|
|
7
|
-
},
|
|
8
|
-
value:
|
|
7
|
+
return e;
|
|
8
|
+
}, c = (/* @__PURE__ */ ((n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, "default", {
|
|
9
|
+
value: n,
|
|
9
10
|
enumerable: !0
|
|
10
|
-
}) :
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
}) : a, n)))((/* @__PURE__ */ o(((e, t) => {
|
|
12
|
+
var n = Object.prototype.hasOwnProperty, r = "~";
|
|
13
|
+
function i() {}
|
|
14
|
+
Object.create && (i.prototype = Object.create(null), new i().__proto__ || (r = !1));
|
|
15
|
+
function a(e, t, n) {
|
|
16
|
+
this.fn = e, this.context = t, this.once = n || !1;
|
|
17
|
+
}
|
|
18
|
+
function o(e, t, n, i, o) {
|
|
19
|
+
if (typeof n != "function") throw TypeError("The listener must be a function");
|
|
20
|
+
var s = new a(n, i || e, o), c = r ? r + t : t;
|
|
21
|
+
return e._events[c] ? e._events[c].fn ? e._events[c] = [e._events[c], s] : e._events[c].push(s) : (e._events[c] = s, e._eventsCount++), e;
|
|
22
|
+
}
|
|
23
|
+
function s(e, t) {
|
|
24
|
+
--e._eventsCount === 0 ? e._events = new i() : delete e._events[t];
|
|
25
|
+
}
|
|
26
|
+
function c() {
|
|
27
|
+
this._events = new i(), this._eventsCount = 0;
|
|
28
|
+
}
|
|
29
|
+
c.prototype.eventNames = function() {
|
|
30
|
+
var e = [], t, i;
|
|
31
|
+
if (this._eventsCount === 0) return e;
|
|
32
|
+
for (i in t = this._events) n.call(t, i) && e.push(r ? i.slice(1) : i);
|
|
33
|
+
return Object.getOwnPropertySymbols ? e.concat(Object.getOwnPropertySymbols(t)) : e;
|
|
34
|
+
}, c.prototype.listeners = function(e) {
|
|
35
|
+
var t = r ? r + e : e, n = this._events[t];
|
|
36
|
+
if (!n) return [];
|
|
37
|
+
if (n.fn) return [n.fn];
|
|
38
|
+
for (var i = 0, a = n.length, o = Array(a); i < a; i++) o[i] = n[i].fn;
|
|
39
|
+
return o;
|
|
40
|
+
}, c.prototype.listenerCount = function(e) {
|
|
41
|
+
var t = r ? r + e : e, n = this._events[t];
|
|
42
|
+
return n ? n.fn ? 1 : n.length : 0;
|
|
43
|
+
}, c.prototype.emit = function(e, t, n, i, a, o) {
|
|
44
|
+
var s = r ? r + e : e;
|
|
45
|
+
if (!this._events[s]) return !1;
|
|
46
|
+
var c = this._events[s], l = arguments.length, u, d;
|
|
47
|
+
if (c.fn) {
|
|
48
|
+
switch (c.once && this.removeListener(e, c.fn, void 0, !0), l) {
|
|
49
|
+
case 1: return c.fn.call(c.context), !0;
|
|
50
|
+
case 2: return c.fn.call(c.context, t), !0;
|
|
51
|
+
case 3: return c.fn.call(c.context, t, n), !0;
|
|
52
|
+
case 4: return c.fn.call(c.context, t, n, i), !0;
|
|
53
|
+
case 5: return c.fn.call(c.context, t, n, i, a), !0;
|
|
54
|
+
case 6: return c.fn.call(c.context, t, n, i, a, o), !0;
|
|
55
|
+
}
|
|
56
|
+
for (d = 1, u = Array(l - 1); d < l; d++) u[d - 1] = arguments[d];
|
|
57
|
+
c.fn.apply(c.context, u);
|
|
58
|
+
} else {
|
|
59
|
+
var f = c.length, p;
|
|
60
|
+
for (d = 0; d < f; d++) switch (c[d].once && this.removeListener(e, c[d].fn, void 0, !0), l) {
|
|
61
|
+
case 1:
|
|
62
|
+
c[d].fn.call(c[d].context);
|
|
63
|
+
break;
|
|
64
|
+
case 2:
|
|
65
|
+
c[d].fn.call(c[d].context, t);
|
|
66
|
+
break;
|
|
67
|
+
case 3:
|
|
68
|
+
c[d].fn.call(c[d].context, t, n);
|
|
69
|
+
break;
|
|
70
|
+
case 4:
|
|
71
|
+
c[d].fn.call(c[d].context, t, n, i);
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
if (!u) for (p = 1, u = Array(l - 1); p < l; p++) u[p - 1] = arguments[p];
|
|
75
|
+
c[d].fn.apply(c[d].context, u);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return !0;
|
|
79
|
+
}, c.prototype.on = function(e, t, n) {
|
|
80
|
+
return o(this, e, t, n, !1);
|
|
81
|
+
}, c.prototype.once = function(e, t, n) {
|
|
82
|
+
return o(this, e, t, n, !0);
|
|
83
|
+
}, c.prototype.removeListener = function(e, t, n, i) {
|
|
84
|
+
var a = r ? r + e : e;
|
|
85
|
+
if (!this._events[a]) return this;
|
|
86
|
+
if (!t) return s(this, a), this;
|
|
87
|
+
var o = this._events[a];
|
|
88
|
+
if (o.fn) o.fn === t && (!i || o.once) && (!n || o.context === n) && s(this, a);
|
|
89
|
+
else {
|
|
90
|
+
for (var c = 0, l = [], u = o.length; c < u; c++) (o[c].fn !== t || i && !o[c].once || n && o[c].context !== n) && l.push(o[c]);
|
|
91
|
+
l.length ? this._events[a] = l.length === 1 ? l[0] : l : s(this, a);
|
|
92
|
+
}
|
|
93
|
+
return this;
|
|
94
|
+
}, c.prototype.removeAllListeners = function(e) {
|
|
95
|
+
var t;
|
|
96
|
+
return e ? (t = r ? r + e : e, this._events[t] && s(this, t)) : (this._events = new i(), this._eventsCount = 0), this;
|
|
97
|
+
}, c.prototype.off = c.prototype.removeListener, c.prototype.addListener = c.prototype.on, c.prefixed = r, c.EventEmitter = c, t !== void 0 && (t.exports = c);
|
|
98
|
+
})))(), 1)).default;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/typeof.js
|
|
101
|
+
function l(e) {
|
|
102
|
+
"@babel/helpers - typeof";
|
|
103
|
+
return l = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
104
|
+
return typeof e;
|
|
105
|
+
} : function(e) {
|
|
106
|
+
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
107
|
+
}, l(e);
|
|
108
|
+
}
|
|
109
|
+
//#endregion
|
|
110
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPrimitive.js
|
|
111
|
+
function u(e, t) {
|
|
112
|
+
if (l(e) != "object" || !e) return e;
|
|
113
|
+
var n = e[Symbol.toPrimitive];
|
|
114
|
+
if (n !== void 0) {
|
|
115
|
+
var r = n.call(e, t || "default");
|
|
116
|
+
if (l(r) != "object") return r;
|
|
117
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
118
|
+
}
|
|
119
|
+
return (t === "string" ? String : Number)(e);
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/toPropertyKey.js
|
|
123
|
+
function d(e) {
|
|
124
|
+
var t = u(e, "string");
|
|
125
|
+
return l(t) == "symbol" ? t : t + "";
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/defineProperty.js
|
|
129
|
+
function f(e, t, n) {
|
|
130
|
+
return (t = d(t)) in e ? Object.defineProperty(e, t, {
|
|
131
|
+
value: n,
|
|
132
|
+
enumerable: !0,
|
|
133
|
+
configurable: !0,
|
|
134
|
+
writable: !0
|
|
135
|
+
}) : e[t] = n, e;
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region lib/scene/batcher/BatcherPipe.ts
|
|
139
|
+
var p = class {
|
|
140
|
+
constructor() {
|
|
141
|
+
f(this, "renderPipeId", "batch"), f(this, "elements", []);
|
|
22
142
|
}
|
|
23
|
-
|
|
24
|
-
|
|
143
|
+
}, m = class {
|
|
144
|
+
constructor(e) {
|
|
145
|
+
f(this, "_renderer", void 0), f(this, "_activeBatch", void 0), this._renderer = e;
|
|
25
146
|
}
|
|
26
|
-
|
|
27
|
-
|
|
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;
|
|
147
|
+
get batch() {
|
|
148
|
+
return this._activeBatch;
|
|
29
149
|
}
|
|
30
|
-
|
|
31
|
-
|
|
150
|
+
buildStart() {
|
|
151
|
+
this._activeBatch = new h();
|
|
32
152
|
}
|
|
33
|
-
|
|
34
|
-
|
|
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;
|
|
153
|
+
buildEnd(e) {
|
|
154
|
+
this.break(e);
|
|
36
155
|
}
|
|
37
|
-
|
|
38
|
-
this.
|
|
156
|
+
break(e) {
|
|
157
|
+
this._activeBatch.build(e);
|
|
39
158
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
159
|
+
addToBatch(e, t) {
|
|
160
|
+
this._activeBatch.add({
|
|
161
|
+
...e,
|
|
162
|
+
getColor: () => e.renderable.groupColorAlpha
|
|
163
|
+
});
|
|
44
164
|
}
|
|
45
|
-
|
|
46
|
-
|
|
165
|
+
execute(e) {
|
|
166
|
+
let t = e.elements;
|
|
167
|
+
if (!t || !t.length) return;
|
|
168
|
+
let n = this._renderer.canvasContext, r = n.activeConext;
|
|
169
|
+
for (let e = 0; e < t.length; e++) {
|
|
170
|
+
let i = t[e], a = i.roundPixels, o = (i.getColor() >>> 24 & 255) / 255;
|
|
171
|
+
if (o <= 0) continue;
|
|
172
|
+
r.globalAlpha = o, n.setContextTransform(i.transform, a === 1);
|
|
173
|
+
let s = i.bounds, c = i.texture, l = c.frame, u = c.source._resolution || 1, d = l.x * u, f = l.y * u, p = l.width * u, m = l.height * u, h = s.minX, g = s.minY, _ = s.maxX - s.minX, v = s.maxY - s.minY, y = h, b = g, x = _, S = v;
|
|
174
|
+
r.drawImage(c.source.resource, d, f, p, m, y, b, x, S);
|
|
175
|
+
}
|
|
47
176
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
177
|
+
destroy() {
|
|
178
|
+
var e;
|
|
179
|
+
this._renderer = null, (e = this._activeBatch) == null || e.destroy(), this._activeBatch = null;
|
|
51
180
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
181
|
+
};
|
|
182
|
+
f(m, "desc", { name: "batch" });
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region lib/scene/batcher/Batcher.ts
|
|
185
|
+
var h = class {
|
|
186
|
+
constructor() {
|
|
187
|
+
f(this, "renderPipeId", "batch"), f(this, "elements", []), f(this, "elementSize", 0);
|
|
55
188
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.type = "rectangle", this.x = n, this.y = j, this.width = M, this.height = N;
|
|
189
|
+
add(e) {
|
|
190
|
+
this.elements[this.elementSize++] = e;
|
|
59
191
|
}
|
|
60
|
-
|
|
61
|
-
let
|
|
62
|
-
|
|
192
|
+
build(e) {
|
|
193
|
+
let t = new p(), n = this.elements;
|
|
194
|
+
if (n[0]) {
|
|
195
|
+
for (let e = 0; e < n.length; e++) {
|
|
196
|
+
let r = n[e];
|
|
197
|
+
this.elements[e] = null, t.elements.push(r);
|
|
198
|
+
}
|
|
199
|
+
e.add(t);
|
|
200
|
+
}
|
|
63
201
|
}
|
|
64
|
-
|
|
65
|
-
|
|
202
|
+
destroy() {
|
|
203
|
+
this.elements = null;
|
|
66
204
|
}
|
|
67
|
-
|
|
68
|
-
|
|
205
|
+
}, g = Math.PI * 2, _ = class e {
|
|
206
|
+
constructor(e = 1, t = 0, n = 0, r = 1, i = 0, a = 0) {
|
|
207
|
+
f(this, "a", void 0), f(this, "b", void 0), f(this, "c", void 0), f(this, "d", void 0), f(this, "tx", void 0), f(this, "ty", void 0), this.a = e, this.b = t, this.c = n, this.d = r, this.tx = i, this.ty = a;
|
|
69
208
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
this.x = n, this.y = j;
|
|
209
|
+
static get IDENTITY() {
|
|
210
|
+
return v.identity();
|
|
73
211
|
}
|
|
74
|
-
|
|
75
|
-
|
|
212
|
+
static append(t, n) {
|
|
213
|
+
return new e(n.a * t.a + n.b * t.c, n.a * t.b + n.b * t.d, n.c * t.a + n.d * t.c, n.c * t.b + n.d * t.d, n.tx * t.a + n.ty * t.c + t.tx, n.tx * t.b + n.ty * t.d + t.ty);
|
|
76
214
|
}
|
|
77
|
-
|
|
78
|
-
return this.
|
|
215
|
+
identity() {
|
|
216
|
+
return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.tx = 0, this.ty = 0, this;
|
|
79
217
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var FederatedEvent = class {
|
|
85
|
-
constructor(n) {
|
|
86
|
-
this.global = new Vector2(), this.screen = new Vector2(), this.system = n;
|
|
218
|
+
apply(e, t) {
|
|
219
|
+
t || (t = new b());
|
|
220
|
+
let { x: n, y: r } = e;
|
|
221
|
+
return t.x = n * this.a + r * this.c + this.tx, t.y = n * this.b + r * this.d + this.ty, t;
|
|
87
222
|
}
|
|
88
|
-
|
|
89
|
-
return
|
|
223
|
+
translate(e, t) {
|
|
224
|
+
return this.tx += e, this.ty += t, this;
|
|
90
225
|
}
|
|
91
|
-
|
|
92
|
-
|
|
226
|
+
rotate(e) {
|
|
227
|
+
let t = Math.cos(e), n = Math.sin(e), r = this.a, i = this.c, a = this.tx;
|
|
228
|
+
return this.a = r * t - this.b * n, this.b = r * n + this.b * t, this.c = i * t - this.d * n, this.d = i * n + this.d * t, this.tx = a * t - this.ty * n, this.ty = a * n + this.ty * t, this;
|
|
93
229
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.domElement = null, this.rootTarget = null, this.resolution = 1, this._allInteractiveElements = [], this._hitElements = [], this._isPointerMoveEvent = !1, this.mappingState = { trackingData: {} }, this.renderer = n, this.resolution = n.resolution, this._rootPointerEvent = new FederatedEvent(null), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerOverOut = this._onPointerOverOut.bind(this), this.init();
|
|
230
|
+
scale(e, t) {
|
|
231
|
+
return this.a *= e, this.d *= t, this.c *= e, this.b *= t, this.tx *= e, this.ty *= t, this;
|
|
97
232
|
}
|
|
98
|
-
|
|
99
|
-
|
|
233
|
+
appendFrom(e, t) {
|
|
234
|
+
let n = e.a, r = e.b, i = e.c, a = e.d, o = e.tx, s = e.ty, c = t.a, l = t.b, u = t.c, d = t.d, f = t.tx, p = t.ty;
|
|
235
|
+
return this.a = n * c + r * u, this.b = n * l + r * d, this.c = i * c + a * u, this.d = i * l + a * d, this.tx = o * c + s * u + f, this.ty = o * l + s * d + p, this;
|
|
100
236
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
pressTargetsByButton: {},
|
|
104
|
-
clicksByButton: {},
|
|
105
|
-
overTargets: null
|
|
106
|
-
}), this.mappingState.trackingData[n];
|
|
237
|
+
set(e, t, n, r, i, a) {
|
|
238
|
+
this.a = e, this.b = t, this.c = n, this.d = r, this.tx = i, this.ty = a;
|
|
107
239
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.
|
|
111
|
-
|
|
112
|
-
setTargetElement(n) {
|
|
113
|
-
this._removeEvents(), this.domElement = n, this._addEvents();
|
|
114
|
-
}
|
|
115
|
-
dispatchEvent(n, j) {
|
|
116
|
-
if (!n.target) return;
|
|
117
|
-
let M = n.composedPath();
|
|
118
|
-
for (let N = 0; N < M.length - 1; ++N) n.currentTarget = M[N], this._notifyTarget(n, j);
|
|
119
|
-
n.currentTarget = n.target, this._notifyTarget(n, j);
|
|
120
|
-
}
|
|
121
|
-
_notifyTarget(n, j) {
|
|
122
|
-
j != null || (j = n.type);
|
|
123
|
-
let M = n.currentTarget._events[j];
|
|
124
|
-
if (M) if ("fn" in M) M.once && n.target.removeListener(j, M.fn, void 0, !0), M.fn.call(M.context, n);
|
|
125
|
-
else for (let N = 0; N < M.length; ++N) {
|
|
126
|
-
let P = M[N];
|
|
127
|
-
P.once && n.target.removeListener(j, P.fn, void 0, !0), P.fn.call(P.context, n);
|
|
128
|
-
}
|
|
240
|
+
applyInverse(e, t) {
|
|
241
|
+
t = t || new b();
|
|
242
|
+
let n = this.a, r = this.b, i = this.c, a = this.d, o = this.tx, s = this.ty, c = 1 / (n * a + i * -r), l = e.x, u = e.y;
|
|
243
|
+
return t.x = a * c * l + -i * c * u + (s * i - o * a) * c, t.y = n * c * u + -r * c * l + (-s * n + o * r) * c, t;
|
|
129
244
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
for (let M = 0; M < PROPAGATION_LIMIT && (n !== this.rootTarget || n.parent); ++M) {
|
|
133
|
-
if (!n.parent) throw Error("Cannot find propagation path to disconnected target");
|
|
134
|
-
j.push(n.parent), n = n.parent;
|
|
135
|
-
}
|
|
136
|
-
return j.reverse(), j;
|
|
245
|
+
copyFrom(e) {
|
|
246
|
+
return this.a = e.a, this.b = e.b, this.c = e.c, this.d = e.d, this.tx = e.tx, this.ty = e.ty, this;
|
|
137
247
|
}
|
|
138
|
-
|
|
139
|
-
let n = this.
|
|
140
|
-
|
|
248
|
+
decompose(e) {
|
|
249
|
+
let t = this.a, n = this.b, r = this.c, i = this.d, a = e.pivot, o = -Math.atan2(-r, i), s = Math.atan2(n, t), c = Math.abs(o + s);
|
|
250
|
+
return c < 1e-5 || Math.abs(g - c) < 1e-5 ? (e.rotation = s, e.skew.x = e.skew.y = 0) : (e.rotation = 0, e.skew.x = o, e.skew.y = s), e.scale.x = Math.sqrt(t * t + n * n), e.scale.y = Math.sqrt(r * r + i * i), e.position.x = this.tx + a.x * t + a.y * r, e.position.y = this.ty + a.x * n + a.y * i, e;
|
|
141
251
|
}
|
|
142
|
-
|
|
143
|
-
let
|
|
144
|
-
|
|
145
|
-
let j = n.style;
|
|
146
|
-
j && (j.touchAction = "none"), globalThis.document.addEventListener("pointermove", this._onPointerMove, !0), n.addEventListener("pointerdown", this._onPointerDown, !0), n.addEventListener("pointerleave", this._onPointerOverOut, !0), n.addEventListener("pointerover", this._onPointerOverOut, !0), globalThis.document.addEventListener("pointerup", this._onPointerUp, !0);
|
|
147
|
-
}
|
|
148
|
-
_onPointerMove(n) {
|
|
149
|
-
var j;
|
|
150
|
-
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
151
|
-
this._isPointerMoveEvent = !0, this._allInteractiveElements.length = 0, this._hitElements.length = 0;
|
|
152
|
-
let M = this._bootstrapEvent(this._rootPointerEvent, n), N = this.createPointEvent(M);
|
|
153
|
-
this._isPointerMoveEvent = !1;
|
|
154
|
-
let P = this.trackingData(n.pointerId), F = findMountedTarget(P.overTargets);
|
|
155
|
-
if (((j = P.overTargets) == null ? void 0 : j.length) > 0 && F !== N.target) {
|
|
156
|
-
let n = this.createPointEvent(M, "pointerout", F);
|
|
157
|
-
this.dispatchEvent(n, "pointerout");
|
|
158
|
-
let j = N.composedPath();
|
|
159
|
-
if (!j.includes(F)) {
|
|
160
|
-
let n = this.createPointEvent(M, "pointerleave", F);
|
|
161
|
-
for (; n.target && !j.includes(n.target);) n.currentTarget = n.target, this._notifyTarget(n), n.target = n.target.parent;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
if (F !== N.target) {
|
|
165
|
-
let n = "pointerover", j = this.clonePointEvent(N, n);
|
|
166
|
-
this.dispatchEvent(j, n);
|
|
167
|
-
let M = F == null ? void 0 : F.parent;
|
|
168
|
-
for (; M && M !== this.rootTarget.parent && M !== N.target;) M = M.parent;
|
|
169
|
-
if (!M || M === this.rootTarget.parent) {
|
|
170
|
-
let n = this.clonePointEvent(N, "pointerenter");
|
|
171
|
-
for (; n.target && n.target !== F && n.target !== this.rootTarget.parent;) n.currentTarget = n.target, this._notifyTarget(n), n.target = n.target.parent;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
this.dispatchEvent(N, "pointermove");
|
|
175
|
-
let I = this._allInteractiveElements;
|
|
176
|
-
for (let n = I.length - 1; n >= 0; --n) N.currentTarget = I[n], this._notifyTarget(N, "globalpointermove");
|
|
177
|
-
this._allInteractiveElements.length = 0, this._hitElements.length = 0, P.overTargets = N.composedPath();
|
|
178
|
-
}
|
|
179
|
-
_onPointerDown(n) {
|
|
180
|
-
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
181
|
-
let j = this._bootstrapEvent(this._rootPointerEvent, n), M = this.createPointEvent(j);
|
|
182
|
-
this.dispatchEvent(M, "pointerdown");
|
|
183
|
-
let N = this.trackingData(n.pointerId);
|
|
184
|
-
N.pressTargetsByButton[n.button] = M.composedPath();
|
|
252
|
+
clone() {
|
|
253
|
+
let t = new e();
|
|
254
|
+
return t.a = this.a, t.b = this.b, t.c = this.c, t.d = this.d, t.tx = this.tx, t.ty = this.ty, t;
|
|
185
255
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
this.dispatchEvent(M, "pointerout");
|
|
256
|
+
}, v = new _(), y = class e {
|
|
257
|
+
constructor(e = 0, t = 0, n = 0, r = 0) {
|
|
258
|
+
f(this, "x", void 0), f(this, "y", void 0), f(this, "width", void 0), f(this, "height", void 0), f(this, "type", "rectangle"), this.x = e, this.y = t, this.width = n, this.height = r;
|
|
190
259
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
n.composedPath && n.composedPath().length > 1 && (j = n.composedPath()[0]);
|
|
195
|
-
let M = this._bootstrapEvent(this._rootPointerEvent, n), N = j === this.domElement ? "" : "outside", P = this.createPointEvent(M);
|
|
196
|
-
this.dispatchEvent(P, `pointerup${N}`);
|
|
260
|
+
getBounds() {
|
|
261
|
+
let t = new e();
|
|
262
|
+
return t.copyFrom(this), t;
|
|
197
263
|
}
|
|
198
|
-
|
|
199
|
-
return
|
|
264
|
+
copyFrom(e) {
|
|
265
|
+
return this.x = e.x, this.y = e.y, this.width = e.width, this.height = e.height, this;
|
|
200
266
|
}
|
|
201
|
-
|
|
202
|
-
|
|
267
|
+
strokeContains(e, t, n, r = .5) {
|
|
268
|
+
let { width: i, height: a } = this;
|
|
269
|
+
if (i <= 0 || a <= 0) return !1;
|
|
270
|
+
let o = this.x, s = this.y, c = n * (1 - r), l = n - c, u = o - c, d = o + i + c, f = s - c, p = s + a + c, m = o + l, h = o + i - l, g = s + l, _ = s + a - l;
|
|
271
|
+
return e >= u && e <= d && t >= f && t <= p && !(e > m && e < h && t > g && t < _);
|
|
203
272
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
let P = new FederatedEvent(this);
|
|
207
|
-
return P.global.copyFrom(n.global), P.screen.copyFrom(n.screen), P.nativeEvent = n.nativeEvent, P.target = (N = M == null ? this.hitTest(P.global.x, P.global.y) : M) == null ? this._hitElements[0] : N, j && (P.type = j), P;
|
|
273
|
+
contains(e, t) {
|
|
274
|
+
return this.width <= 0 || this.height <= 0 ? !1 : e >= this.x && e < this.x + this.width && t >= this.y && t < this.y + this.height;
|
|
208
275
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
276
|
+
}, b = class {
|
|
277
|
+
constructor(e = 0, t = 0) {
|
|
278
|
+
f(this, "x", void 0), f(this, "y", void 0), this.x = e, this.y = t;
|
|
212
279
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
x: 0,
|
|
216
|
-
y: 0,
|
|
217
|
-
width: N.width,
|
|
218
|
-
height: N.height,
|
|
219
|
-
left: 0,
|
|
220
|
-
top: 0
|
|
221
|
-
}, F = 1 / this.resolution;
|
|
222
|
-
return n.x = (j - P.left) * (N.width / P.width) * F, n.y = (M - P.top) * (N.height / P.height) * F, n;
|
|
223
|
-
}
|
|
224
|
-
hitTest(n, j) {
|
|
225
|
-
let M = this._isPointerMoveEvent, N = this[M ? "hitTestMoveRecursive" : "hitTestRecursive"](this.rootTarget, this.rootTarget.eventMode, new Vector2(n, j));
|
|
226
|
-
return N && N[0];
|
|
227
|
-
}
|
|
228
|
-
_interactivePrune(n) {
|
|
229
|
-
return !n || !n.visible || !n.renderable || !n.measurable || n.eventMode === "none";
|
|
230
|
-
}
|
|
231
|
-
hitTestMoveRecursive(n, j, M) {
|
|
232
|
-
let N = !1;
|
|
233
|
-
if (this._interactivePrune(n)) return;
|
|
234
|
-
let P = n.children;
|
|
235
|
-
if (P && P.length > 0) for (let F = P.length - 1; F >= 0; --F) {
|
|
236
|
-
let I = P[F], L = this.hitTestMoveRecursive(I, this._isInteractive(j) ? j : I.eventMode, M);
|
|
237
|
-
if (L) {
|
|
238
|
-
if (L.length > 0 && !L[L.length - 1].parent) continue;
|
|
239
|
-
let j = this._isInteractive(n.eventMode);
|
|
240
|
-
(L.length > 0 || j) && (j && this._allInteractiveElements.push(n), L.push(n)), this._hitElements.length === 0 && (this._hitElements = L), N = !0;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
let F = this._isInteractive(j), I = this._isInteractive(n.eventMode);
|
|
244
|
-
if (I && this._allInteractiveElements.push(n), !(this._hitElements.length > 0)) {
|
|
245
|
-
if (N) return this._hitElements;
|
|
246
|
-
if (F && this.hitTestFn(n, M)) return I ? [n] : [];
|
|
247
|
-
}
|
|
280
|
+
set(e, t) {
|
|
281
|
+
t == null ? this.x = this.y = e : (this.x = e, this.y = t);
|
|
248
282
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
let N = n.children;
|
|
252
|
-
for (let P = N.length - 1; P >= 0; P--) {
|
|
253
|
-
let F = N[P], I = this.hitTestRecursive(F, this._isInteractive(j) ? j : F.eventMode, M);
|
|
254
|
-
if (I) {
|
|
255
|
-
let j = this._isInteractive(n.eventMode);
|
|
256
|
-
return (I.length > 0 || j) && I.push(n), I;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
let P = this._isInteractive(j), F = this._isInteractive(n.eventMode);
|
|
260
|
-
return P && this.hitTestFn(n, M) ? F ? [n] : [] : null;
|
|
261
|
-
}
|
|
262
|
-
hitTestFn(n, j) {
|
|
263
|
-
if (n.hitArea) return !0;
|
|
264
|
-
if (n.containsPoint) {
|
|
265
|
-
let M = n.worldTransform.applyInverse(j);
|
|
266
|
-
return n.containsPoint(M);
|
|
267
|
-
}
|
|
268
|
-
return !1;
|
|
283
|
+
copyFrom(e) {
|
|
284
|
+
return this.set(e.x, e.y), this;
|
|
269
285
|
}
|
|
270
286
|
};
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
if (!n) return;
|
|
274
|
-
let j = n[0];
|
|
275
|
-
for (let M = 1; M < n.length && n[M].parent === j; ++M) j = n[M];
|
|
276
|
-
return j;
|
|
287
|
+
function x(e) {
|
|
288
|
+
return e += +(e === 0), --e, e |= e >>> 1, e |= e >>> 2, e |= e >>> 4, e |= e >>> 8, e |= e >>> 16, e + 1;
|
|
277
289
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
for (let N in j) !M[N] && j[N] !== void 0 && (n[N] = j[N]);
|
|
284
|
-
}
|
|
285
|
-
var InstructionSet = class {
|
|
286
|
-
constructor() {
|
|
287
|
-
this.instructions = [], this.instructionSize = 0;
|
|
288
|
-
}
|
|
289
|
-
reset() {
|
|
290
|
-
this.instructionSize = 0;
|
|
291
|
-
}
|
|
292
|
-
add(n) {
|
|
293
|
-
this.instructions[this.instructionSize++] = n;
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region lib/maths/const.ts
|
|
292
|
+
var S = 180 / Math.PI, ee = Math.PI / 180, C = class {
|
|
293
|
+
constructor(e, t, n) {
|
|
294
|
+
f(this, "_x", void 0), f(this, "_y", void 0), f(this, "_observer", void 0), this._x = t || 0, this._y = n || 0, this._observer = e;
|
|
294
295
|
}
|
|
295
|
-
|
|
296
|
-
|
|
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 = {
|
|
298
|
-
list: [],
|
|
299
|
-
index: 0
|
|
300
|
-
}, this._onRenderContainers = [], this.init(n);
|
|
301
|
-
}
|
|
302
|
-
init(n) {
|
|
303
|
-
this.root = n;
|
|
304
|
-
let j = n.children;
|
|
305
|
-
for (let n = 0; n < j.length; ++n) this.addChild(j[n]);
|
|
306
|
-
}
|
|
307
|
-
addChild(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);
|
|
313
|
-
let j = n.children;
|
|
314
|
-
for (let n = 0; n < j.length; ++n) this.addChild(j[n]);
|
|
296
|
+
set(e = 0, t = e) {
|
|
297
|
+
return (this._x !== e || this._y !== t) && (this._x = e, this._y = t, this._observer._onUpdate(this)), this;
|
|
315
298
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
this._removeRenderGroupChild(n.renderGroup);
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
let j = n.children;
|
|
322
|
-
for (let n = 0; n < j.length; ++n) this.removeChild(j[n]);
|
|
299
|
+
get x() {
|
|
300
|
+
return this._x;
|
|
323
301
|
}
|
|
324
|
-
|
|
325
|
-
|
|
302
|
+
set x(e) {
|
|
303
|
+
this._x !== e && (this._x = e, this._observer._onUpdate(this));
|
|
326
304
|
}
|
|
327
|
-
|
|
328
|
-
|
|
305
|
+
get y() {
|
|
306
|
+
return this._y;
|
|
329
307
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
j > -1 && this.renderGroupChildren.splice(j, 1), n.renderGroupParent = null;
|
|
308
|
+
set y(e) {
|
|
309
|
+
this._y !== e && (this._y = e, this._observer._onUpdate(this));
|
|
333
310
|
}
|
|
334
|
-
|
|
335
|
-
this.
|
|
311
|
+
copyFrom(e) {
|
|
312
|
+
return (this.x !== e.x || this.y !== e.y) && (this._x = e.x, this._y = e.y, this._observer._onUpdate(this)), this;
|
|
336
313
|
}
|
|
337
|
-
|
|
338
|
-
|
|
314
|
+
toVector2() {
|
|
315
|
+
return new b(this.x, this.y);
|
|
339
316
|
}
|
|
340
|
-
|
|
341
|
-
|
|
317
|
+
}, te = class {
|
|
318
|
+
constructor(e) {
|
|
319
|
+
f(this, "_classType", void 0), f(this, "_pool", []), f(this, "_index", 0), f(this, "_count", 0), this._classType = e;
|
|
342
320
|
}
|
|
343
|
-
|
|
344
|
-
|
|
321
|
+
get(e) {
|
|
322
|
+
var t;
|
|
323
|
+
let n;
|
|
324
|
+
return this._index > 0 ? n = this._pool[--this._index] : (n = new this._classType(), this._count++), (t = n.init) == null || t.call(n, e), n;
|
|
345
325
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
index: 0,
|
|
350
|
-
list: []
|
|
351
|
-
}), j.list[j.index++] = n;
|
|
326
|
+
return(e) {
|
|
327
|
+
var t;
|
|
328
|
+
(t = e.reset) == null || t.call(e), this._pool[this._index++] = e;
|
|
352
329
|
}
|
|
353
|
-
|
|
354
|
-
|
|
330
|
+
clear() {
|
|
331
|
+
if (this._pool.length > 0 && this._pool[0].destroy) for (let e = 0; e < this._index; ++e) this._pool[e].destroy();
|
|
332
|
+
this._pool.length = 0, this._count = 0, this._index = 0;
|
|
355
333
|
}
|
|
356
|
-
|
|
357
|
-
|
|
334
|
+
}, ne = new class {
|
|
335
|
+
constructor() {
|
|
336
|
+
f(this, "_poolsByClass", /* @__PURE__ */ new Map());
|
|
358
337
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
return uidCache[n] === void 0 && (uidCache[n] = -1), ++uidCache[n];
|
|
362
|
-
}
|
|
363
|
-
function updateBounds(n, j, M) {
|
|
364
|
-
let { width: N, height: P } = M.orig;
|
|
365
|
-
n.minX = -j.x * N, n.minY = -j.y * P, n.maxX = n.minX + N, n.maxY = n.minY + P;
|
|
366
|
-
}
|
|
367
|
-
function applyMixins(n, ...j) {
|
|
368
|
-
for (let M of j) Object.defineProperties(n.prototype, Object.getOwnPropertyDescriptors(M));
|
|
369
|
-
}
|
|
370
|
-
var ObservablePoint = class {
|
|
371
|
-
constructor(n, j, M) {
|
|
372
|
-
this._x = j || 0, this._y = M || 0, this._observer = n;
|
|
338
|
+
getPool(e) {
|
|
339
|
+
return this._poolsByClass.has(e) || this._poolsByClass.set(e, new te(e)), this._poolsByClass.get(e);
|
|
373
340
|
}
|
|
374
|
-
|
|
375
|
-
|
|
341
|
+
}(), w = class e {
|
|
342
|
+
constructor(e = Infinity, t = Infinity, n = -Infinity, r = -Infinity) {
|
|
343
|
+
f(this, "minX", Infinity), f(this, "minY", Infinity), f(this, "maxX", -Infinity), f(this, "maxY", -Infinity), f(this, "matrix", new _()), f(this, "_rectangle", void 0), this.minX = e, this.minY = t, this.maxX = n, this.maxY = r;
|
|
376
344
|
}
|
|
377
345
|
get x() {
|
|
378
|
-
return this.
|
|
346
|
+
return this.minX;
|
|
379
347
|
}
|
|
380
|
-
set x(
|
|
381
|
-
|
|
348
|
+
set x(e) {
|
|
349
|
+
let t = this.maxX - this.minX;
|
|
350
|
+
this.minX = e, this.maxX = e + t;
|
|
382
351
|
}
|
|
383
352
|
get y() {
|
|
384
|
-
return this.
|
|
385
|
-
}
|
|
386
|
-
set y(n) {
|
|
387
|
-
this._y !== n && (this._y = n, this._observer._onUpdate(this));
|
|
388
|
-
}
|
|
389
|
-
copyFrom(n) {
|
|
390
|
-
return (this.x !== n.x || this.y !== n.y) && (this._x = n.x, this._y = n.y, this._observer._onUpdate(this)), this;
|
|
353
|
+
return this.minY;
|
|
391
354
|
}
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
};
|
|
396
|
-
const RAD_TO_DEG = 180 / Math.PI, DEG_TO_RAD = Math.PI / 180;
|
|
397
|
-
var eventemitter3_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((n, j) => {
|
|
398
|
-
var M = Object.prototype.hasOwnProperty, N = "~";
|
|
399
|
-
function P() {}
|
|
400
|
-
Object.create && (P.prototype = Object.create(null), new P().__proto__ || (N = !1));
|
|
401
|
-
function F(n, j, M) {
|
|
402
|
-
this.fn = n, this.context = j, this.once = M || !1;
|
|
403
|
-
}
|
|
404
|
-
function I(n, j, M, P, I) {
|
|
405
|
-
if (typeof M != "function") throw TypeError("The listener must be a function");
|
|
406
|
-
var L = new F(M, P || n, I), R = N ? N + j : j;
|
|
407
|
-
return n._events[R] ? n._events[R].fn ? n._events[R] = [n._events[R], L] : n._events[R].push(L) : (n._events[R] = L, n._eventsCount++), n;
|
|
408
|
-
}
|
|
409
|
-
function L(n, j) {
|
|
410
|
-
--n._eventsCount === 0 ? n._events = new P() : delete n._events[j];
|
|
411
|
-
}
|
|
412
|
-
function R() {
|
|
413
|
-
this._events = new P(), this._eventsCount = 0;
|
|
414
|
-
}
|
|
415
|
-
R.prototype.eventNames = function() {
|
|
416
|
-
var n = [], j, P;
|
|
417
|
-
if (this._eventsCount === 0) return n;
|
|
418
|
-
for (P in j = this._events) M.call(j, P) && n.push(N ? P.slice(1) : P);
|
|
419
|
-
return Object.getOwnPropertySymbols ? n.concat(Object.getOwnPropertySymbols(j)) : n;
|
|
420
|
-
}, R.prototype.listeners = function(n) {
|
|
421
|
-
var j = N ? N + n : n, M = this._events[j];
|
|
422
|
-
if (!M) return [];
|
|
423
|
-
if (M.fn) return [M.fn];
|
|
424
|
-
for (var P = 0, F = M.length, I = Array(F); P < F; P++) I[P] = M[P].fn;
|
|
425
|
-
return I;
|
|
426
|
-
}, R.prototype.listenerCount = function(n) {
|
|
427
|
-
var j = N ? N + n : n, M = this._events[j];
|
|
428
|
-
return M ? M.fn ? 1 : M.length : 0;
|
|
429
|
-
}, R.prototype.emit = function(n, j, M, P, F, I) {
|
|
430
|
-
var L = N ? N + n : n;
|
|
431
|
-
if (!this._events[L]) return !1;
|
|
432
|
-
var R = this._events[L], z = arguments.length, B, V;
|
|
433
|
-
if (R.fn) {
|
|
434
|
-
switch (R.once && this.removeListener(n, R.fn, void 0, !0), z) {
|
|
435
|
-
case 1: return R.fn.call(R.context), !0;
|
|
436
|
-
case 2: return R.fn.call(R.context, j), !0;
|
|
437
|
-
case 3: return R.fn.call(R.context, j, M), !0;
|
|
438
|
-
case 4: return R.fn.call(R.context, j, M, P), !0;
|
|
439
|
-
case 5: return R.fn.call(R.context, j, M, P, F), !0;
|
|
440
|
-
case 6: return R.fn.call(R.context, j, M, P, F, I), !0;
|
|
441
|
-
}
|
|
442
|
-
for (V = 1, B = Array(z - 1); V < z; V++) B[V - 1] = arguments[V];
|
|
443
|
-
R.fn.apply(R.context, B);
|
|
444
|
-
} else {
|
|
445
|
-
var H = R.length, U;
|
|
446
|
-
for (V = 0; V < H; V++) switch (R[V].once && this.removeListener(n, R[V].fn, void 0, !0), z) {
|
|
447
|
-
case 1:
|
|
448
|
-
R[V].fn.call(R[V].context);
|
|
449
|
-
break;
|
|
450
|
-
case 2:
|
|
451
|
-
R[V].fn.call(R[V].context, j);
|
|
452
|
-
break;
|
|
453
|
-
case 3:
|
|
454
|
-
R[V].fn.call(R[V].context, j, M);
|
|
455
|
-
break;
|
|
456
|
-
case 4:
|
|
457
|
-
R[V].fn.call(R[V].context, j, M, P);
|
|
458
|
-
break;
|
|
459
|
-
default:
|
|
460
|
-
if (!B) for (U = 1, B = Array(z - 1); U < z; U++) B[U - 1] = arguments[U];
|
|
461
|
-
R[V].fn.apply(R[V].context, B);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
return !0;
|
|
465
|
-
}, R.prototype.on = function(n, j, M) {
|
|
466
|
-
return I(this, n, j, M, !1);
|
|
467
|
-
}, R.prototype.once = function(n, j, M) {
|
|
468
|
-
return I(this, n, j, M, !0);
|
|
469
|
-
}, R.prototype.removeListener = function(n, j, M, P) {
|
|
470
|
-
var F = N ? N + n : n;
|
|
471
|
-
if (!this._events[F]) return this;
|
|
472
|
-
if (!j) return L(this, F), this;
|
|
473
|
-
var I = this._events[F];
|
|
474
|
-
if (I.fn) I.fn === j && (!P || I.once) && (!M || I.context === M) && L(this, F);
|
|
475
|
-
else {
|
|
476
|
-
for (var R = 0, z = [], B = I.length; R < B; R++) (I[R].fn !== j || P && !I[R].once || M && I[R].context !== M) && z.push(I[R]);
|
|
477
|
-
z.length ? this._events[F] = z.length === 1 ? z[0] : z : L(this, F);
|
|
478
|
-
}
|
|
479
|
-
return this;
|
|
480
|
-
}, R.prototype.removeAllListeners = function(n) {
|
|
481
|
-
var j;
|
|
482
|
-
return n ? (j = N ? N + n : n, this._events[j] && L(this, j)) : (this._events = new P(), this._eventsCount = 0), this;
|
|
483
|
-
}, R.prototype.off = R.prototype.removeListener, R.prototype.addListener = R.prototype.on, R.prefixed = N, R.EventEmitter = R, j !== void 0 && (j.exports = R);
|
|
484
|
-
})))(), 1)).default, Bounds = class n {
|
|
485
|
-
constructor(n = Infinity, j = Infinity, M = -Infinity, N = -Infinity) {
|
|
486
|
-
this.minX = Infinity, this.minY = Infinity, this.maxX = -Infinity, this.maxY = -Infinity, this.matrix = new Matrix(), this.minX = n, this.minY = j, this.maxX = M, this.maxY = N;
|
|
355
|
+
set y(e) {
|
|
356
|
+
let t = this.maxY - this.minY;
|
|
357
|
+
this.minY = e, this.maxY = e + t;
|
|
487
358
|
}
|
|
488
359
|
clone() {
|
|
489
|
-
return new
|
|
360
|
+
return new e(this.minX, this.minY, this.maxX, this.maxY);
|
|
490
361
|
}
|
|
491
362
|
isEmpty() {
|
|
492
363
|
return this.minX >= this.maxX || this.minY >= this.maxY;
|
|
493
364
|
}
|
|
494
365
|
clear() {
|
|
495
|
-
this.minX = Infinity, this.minY = Infinity, this.maxX = -Infinity, this.maxY = -Infinity;
|
|
366
|
+
return this.minX = Infinity, this.minY = Infinity, this.maxX = -Infinity, this.maxY = -Infinity, this;
|
|
496
367
|
}
|
|
497
|
-
pad(
|
|
498
|
-
return this.minX -=
|
|
368
|
+
pad(e, t = e) {
|
|
369
|
+
return this.minX -= e, this.maxX += e, this.minY -= t, this.maxY += t, this;
|
|
499
370
|
}
|
|
500
371
|
get width() {
|
|
501
372
|
return this.maxX - this.minX;
|
|
502
373
|
}
|
|
503
|
-
set width(
|
|
504
|
-
this.maxX = this.minX +
|
|
374
|
+
set width(e) {
|
|
375
|
+
this.maxX = this.minX + e;
|
|
505
376
|
}
|
|
506
377
|
get height() {
|
|
507
378
|
return this.maxY - this.minY;
|
|
508
379
|
}
|
|
509
|
-
set height(
|
|
510
|
-
this.maxY = this.minY +
|
|
380
|
+
set height(e) {
|
|
381
|
+
this.maxY = this.minY + e;
|
|
511
382
|
}
|
|
512
383
|
get left() {
|
|
513
384
|
return this.minX;
|
|
@@ -524,509 +395,491 @@ var eventemitter3_default = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJS
|
|
|
524
395
|
get isValid() {
|
|
525
396
|
return this.minX + this.minY !== Infinity;
|
|
526
397
|
}
|
|
527
|
-
set(
|
|
528
|
-
this.minX =
|
|
398
|
+
set(e, t, n, r) {
|
|
399
|
+
this.minX = e, this.minY = t, this.maxX = n, this.maxY = r;
|
|
529
400
|
}
|
|
530
|
-
addBounds(
|
|
531
|
-
this.addFrame(
|
|
401
|
+
addBounds(e, t) {
|
|
402
|
+
this.addFrame(e.minX, e.minY, e.maxX, e.maxY, t);
|
|
532
403
|
}
|
|
533
|
-
addRect(
|
|
534
|
-
this.addFrame(
|
|
404
|
+
addRect(e, t) {
|
|
405
|
+
this.addFrame(e.x, e.y, e.width + e.x, e.height + e.y, t);
|
|
535
406
|
}
|
|
536
|
-
addFrame(
|
|
537
|
-
|
|
538
|
-
let
|
|
539
|
-
|
|
407
|
+
addFrame(e, t, n, r, i) {
|
|
408
|
+
i || (i = this.matrix);
|
|
409
|
+
let a = i.a, o = i.b, s = i.c, c = i.d, l = i.tx, u = i.ty, d = this.minX, f = this.minY, p = this.maxX, m = this.maxY, h = a * e + s * t + l, g = o * e + c * t + u;
|
|
410
|
+
h < d && (d = h), g < f && (f = g), h > p && (p = h), g > m && (m = g), h = a * n + s * t + l, g = o * n + c * t + u, h < d && (d = h), g < f && (f = g), h > p && (p = h), g > m && (m = g), h = a * e + s * r + l, g = o * e + c * r + u, h < d && (d = h), g < f && (f = g), h > p && (p = h), g > m && (m = g), h = a * n + s * r + l, g = o * n + c * r + u, h < d && (d = h), g < f && (f = g), h > p && (p = h), g > m && (m = g), this.minX = d, this.minY = f, this.maxX = p, this.maxY = m;
|
|
540
411
|
}
|
|
541
412
|
get rectangle() {
|
|
542
|
-
this._rectangle || (this._rectangle = new
|
|
543
|
-
let
|
|
544
|
-
return this.minX > this.maxX || this.minY > this.maxY ? (
|
|
545
|
-
}
|
|
546
|
-
addBoundsMask(
|
|
547
|
-
this.minX = this.minX >
|
|
548
|
-
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
413
|
+
this._rectangle || (this._rectangle = new y());
|
|
414
|
+
let e = this._rectangle;
|
|
415
|
+
return this.minX > this.maxX || this.minY > this.maxY ? (e.x = 0, e.y = 0, e.width = 0, e.height = 0) : (e.x = this.minX, e.y = this.minY, e.width = this.maxX - this.minX, e.height = this.maxY - this.minY), e;
|
|
416
|
+
}
|
|
417
|
+
addBoundsMask(e) {
|
|
418
|
+
this.minX = this.minX > e.minX ? this.minX : e.minX, this.minY = this.minY > e.minY ? this.minY : e.minY, this.maxX = this.maxX < e.maxX ? this.maxX : e.maxX, this.maxY = this.maxY < e.maxY ? this.maxY : e.maxY;
|
|
419
|
+
}
|
|
420
|
+
containsPoint(e, t) {
|
|
421
|
+
return this.minX <= e && e <= this.maxX && this.minY <= t && t <= this.maxY;
|
|
422
|
+
}
|
|
423
|
+
}, T = ne.getPool(_), re = ne.getPool(w);
|
|
424
|
+
function ie(e, t, n, r, i, a) {
|
|
425
|
+
let o = e - n, s = t - r, c = i - n, l = a - r, u = o * c + s * l, d = c * c + l * l, f = -1;
|
|
426
|
+
d !== 0 && (f = u / d);
|
|
427
|
+
let p, m;
|
|
428
|
+
f < 0 ? (p = n, m = r) : f > 1 ? (p = i, m = a) : (p = n + f * c, m = r + f * l);
|
|
429
|
+
let h = e - p, g = t - m;
|
|
430
|
+
return h * h + g * g;
|
|
431
|
+
}
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region lib/utils/uid.ts
|
|
434
|
+
var E = { default: -1 };
|
|
435
|
+
function D(e = "default") {
|
|
436
|
+
return E[e] === void 0 && (E[e] = -1), ++E[e];
|
|
437
|
+
}
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region lib/utils/index.ts
|
|
440
|
+
function ae(e, t, n) {
|
|
441
|
+
let { width: r, height: i } = n.orig;
|
|
442
|
+
e.minX = -t.x * r, e.minY = -t.y * i, e.maxX = e.minX + r, e.maxY = e.minY + i;
|
|
552
443
|
}
|
|
553
|
-
function
|
|
554
|
-
|
|
444
|
+
function oe(e, ...t) {
|
|
445
|
+
for (let n of t) Object.defineProperties(e.prototype, Object.getOwnPropertyDescriptors(n));
|
|
555
446
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region lib/scene/container/mixins/childrenHelperMixin.ts
|
|
449
|
+
var se = { removeChildren(e = 0, t) {
|
|
450
|
+
let n = t == null ? this.children.length : t, r = n - e, i = [];
|
|
451
|
+
if (r > 0 && r <= n) {
|
|
452
|
+
for (let t = n - 1; t >= e; --t) {
|
|
453
|
+
let e = this.children[t];
|
|
454
|
+
e && (i.push(e), e.parent = null);
|
|
455
|
+
}
|
|
456
|
+
ce(this.children, e, n);
|
|
457
|
+
let t = this.renderGroup || this.parentRenderGroup;
|
|
458
|
+
return t && t.removeChildren(i), i.length > 0 && this._didViewChangeTick++, i;
|
|
459
|
+
} else if (r === 0 && this.children.length === 0) return i;
|
|
460
|
+
throw Error("removeChildren: numeric values are outside the acceptable range.");
|
|
461
|
+
} };
|
|
462
|
+
function ce(e, t, n) {
|
|
463
|
+
let r = e.length, i;
|
|
464
|
+
if (t >= r || n === 0) return;
|
|
465
|
+
n = t + n > r ? r - t : n;
|
|
466
|
+
let a = r - n;
|
|
467
|
+
for (i = t; i < a; ++i) e[i] = e[i + n];
|
|
468
|
+
e.length = a;
|
|
469
|
+
}
|
|
470
|
+
//#endregion
|
|
471
|
+
//#region lib/maths/getLocalBounds.ts
|
|
472
|
+
function O(e, t, n) {
|
|
473
|
+
return t.clear(), n || (n = new _()), le(e, t, n, e, !0), t.isValid || t.set(0, 0, 0, 0), t;
|
|
474
|
+
}
|
|
475
|
+
function le(e, t, n, r, i) {
|
|
476
|
+
let a;
|
|
477
|
+
if (i) a = T.get(), a.copyFrom(n);
|
|
559
478
|
else {
|
|
560
|
-
if (!
|
|
561
|
-
|
|
479
|
+
if (!e.visible || !e.measurable) return;
|
|
480
|
+
e.updateLocalTransform(), a = T.get(), a.appendFrom(e.localTransform, n);
|
|
562
481
|
}
|
|
563
|
-
let
|
|
564
|
-
if (
|
|
482
|
+
let o = t, s = !!e.effects.length;
|
|
483
|
+
if (s && (t = re.get().clear()), e.boundsArea) t.addRect(e.boundsArea, a);
|
|
565
484
|
else {
|
|
566
|
-
|
|
567
|
-
let
|
|
568
|
-
for (let
|
|
569
|
-
if (
|
|
570
|
-
for (let
|
|
571
|
-
var
|
|
572
|
-
(
|
|
485
|
+
e.renderPipeId && (t.matrix = a, t.addBounds(e.bounds));
|
|
486
|
+
let n = e.children;
|
|
487
|
+
for (let e = 0; e < n.length; e++) le(n[e], t, a, r, !1);
|
|
488
|
+
if (s) {
|
|
489
|
+
for (let n = 0; n < e.effects.length; ++n) {
|
|
490
|
+
var c, l;
|
|
491
|
+
(c = (l = e.effects[n]).addLocalBounds) == null || c.call(l, t, r);
|
|
573
492
|
}
|
|
574
|
-
|
|
493
|
+
o.addBounds(t, _.IDENTITY), re.return(t);
|
|
575
494
|
}
|
|
576
495
|
}
|
|
577
|
-
return
|
|
496
|
+
T.return(a);
|
|
578
497
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region lib/scene/mask/StencilMask.ts
|
|
500
|
+
var ue = class {
|
|
501
|
+
constructor(e) {
|
|
502
|
+
f(this, "pipe", "stencilMask"), f(this, "mask", void 0), this.mask = e, e.includeInBuild = !1, e.measurable = !1;
|
|
503
|
+
}
|
|
504
|
+
addLocalBounds(e, t) {
|
|
505
|
+
let n = new w();
|
|
585
506
|
this.mask.measurable = !0;
|
|
586
|
-
let
|
|
587
|
-
|
|
507
|
+
let r = de(this.mask, t);
|
|
508
|
+
O(this.mask, n, r), this.mask.measurable = !1, e.addBoundsMask(n);
|
|
588
509
|
}
|
|
589
510
|
};
|
|
590
|
-
function
|
|
591
|
-
return
|
|
511
|
+
function de(e, t, n) {
|
|
512
|
+
return n || (n = new _()), e === t ? n : (n = de(e.parent, t, n), e.updateLocalTransform(), _.append(n, e.localTransform));
|
|
592
513
|
}
|
|
593
|
-
|
|
514
|
+
//#endregion
|
|
515
|
+
//#region lib/scene/container/mixins/effectMixin.ts
|
|
516
|
+
var fe = {
|
|
594
517
|
effects: [],
|
|
595
518
|
_maskEffect: null,
|
|
596
|
-
addEffect(
|
|
597
|
-
this.effects.push(
|
|
519
|
+
addEffect(e) {
|
|
520
|
+
this.effects.push(e), this._updateIsSimple();
|
|
598
521
|
},
|
|
599
|
-
removeEffect(
|
|
600
|
-
let
|
|
601
|
-
|
|
522
|
+
removeEffect(e) {
|
|
523
|
+
let t = this.effects.indexOf(e);
|
|
524
|
+
t === -1 && this.effects.splice(t, 1), this._updateIsSimple();
|
|
602
525
|
},
|
|
603
|
-
set mask(
|
|
604
|
-
let
|
|
605
|
-
|
|
526
|
+
set mask(e) {
|
|
527
|
+
let t = this._maskEffect;
|
|
528
|
+
e !== (t == null ? void 0 : t.mask) && (t && (this.removeEffect(t), this._maskEffect = null), e != null && (this._maskEffect = new ue(e), this.addEffect(this._maskEffect)));
|
|
606
529
|
},
|
|
607
530
|
get mask() {
|
|
608
|
-
var
|
|
609
|
-
return (
|
|
531
|
+
var e;
|
|
532
|
+
return (e = this._maskEffect) == null ? void 0 : e.mask;
|
|
610
533
|
}
|
|
611
|
-
},
|
|
612
|
-
_zIndex: 0,
|
|
613
|
-
sortableChildren: !1,
|
|
614
|
-
sortDirty: !1
|
|
615
|
-
}, measureMixin = {
|
|
534
|
+
}, pe = {
|
|
616
535
|
_localBoundsCacheData: null,
|
|
617
|
-
_setWidth(
|
|
618
|
-
let
|
|
619
|
-
|
|
536
|
+
_setWidth(e, t) {
|
|
537
|
+
let n = Math.sign(this.scale.x) || 1;
|
|
538
|
+
t === 0 ? this.scale.x = n : this.scale.x = e / t * n;
|
|
620
539
|
},
|
|
621
|
-
_setHeight(
|
|
622
|
-
let
|
|
623
|
-
|
|
540
|
+
_setHeight(e, t) {
|
|
541
|
+
let n = Math.sign(this.scale.y) || 1;
|
|
542
|
+
t === 0 ? this.scale.y = n : this.scale.y = e / t * n;
|
|
624
543
|
},
|
|
625
544
|
getLocalBounds() {
|
|
626
545
|
this._localBoundsCacheData || (this._localBoundsCacheData = {
|
|
627
546
|
data: [],
|
|
628
547
|
index: 1,
|
|
629
548
|
didChange: !1,
|
|
630
|
-
localBounds: new
|
|
549
|
+
localBounds: new w()
|
|
631
550
|
});
|
|
632
|
-
let
|
|
633
|
-
return
|
|
551
|
+
let e = this._localBoundsCacheData;
|
|
552
|
+
return e.index = 1, e.didChange = !1, e.data[0] !== this._didViewChangeTick && (e.didChange = !0, e.data[0] = this._didViewChangeTick), me(this, e), e.didChange && O(this, e.localBounds), e.localBounds;
|
|
634
553
|
}
|
|
635
554
|
};
|
|
636
|
-
function
|
|
637
|
-
let
|
|
638
|
-
for (let
|
|
639
|
-
let
|
|
640
|
-
(
|
|
555
|
+
function me(e, t) {
|
|
556
|
+
let n = e.children;
|
|
557
|
+
for (let e = 0; e < n.length; ++e) {
|
|
558
|
+
let r = n[e], i = r.uid, a = (r._didViewChangeTick & 65535) << 16 | r._didContainerChangeTick & 65535, o = t.index;
|
|
559
|
+
(t.data[o] !== i || t.data[o + 1] !== a) && (t.data[o] = i, t.data[o + 1] = a, t.didChange = !0), t.index += 2, r.children.length && me(r, t);
|
|
641
560
|
}
|
|
642
|
-
return
|
|
561
|
+
return t.didChange;
|
|
643
562
|
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region lib/scene/container/mixins/sortMixin.ts
|
|
565
|
+
var he = {
|
|
566
|
+
_zIndex: 0,
|
|
567
|
+
sortableChildren: !1,
|
|
568
|
+
sortDirty: !1
|
|
569
|
+
}, ge = class {
|
|
570
|
+
constructor() {
|
|
571
|
+
f(this, "instructions", []), f(this, "instructionSize", 0), f(this, "renderPipes", void 0);
|
|
572
|
+
}
|
|
573
|
+
reset() {
|
|
574
|
+
this.instructionSize = 0;
|
|
575
|
+
}
|
|
576
|
+
add(e) {
|
|
577
|
+
this.instructions[this.instructionSize++] = e;
|
|
578
|
+
}
|
|
579
|
+
}, _e = class {
|
|
580
|
+
constructor(e) {
|
|
581
|
+
f(this, "worldTransform", new _()), f(this, "localTransform", new _()), f(this, "root", null), f(this, "instructionSet", new ge()), f(this, "structureDidChange", !0), f(this, "renderGroupParent", null), f(this, "renderGroupChildren", []), f(this, "childrenToUpdate", Object.create(null)), f(this, "childrenRenderablesToUpdate", {
|
|
582
|
+
list: [],
|
|
583
|
+
index: 0
|
|
584
|
+
}), f(this, "_onRenderContainers", []), this.init(e);
|
|
585
|
+
}
|
|
586
|
+
init(e) {
|
|
587
|
+
this.root = e;
|
|
588
|
+
let t = e.children;
|
|
589
|
+
for (let e = 0; e < t.length; ++e) this.addChild(t[e]);
|
|
590
|
+
}
|
|
591
|
+
addChild(e) {
|
|
592
|
+
if (this.structureDidChange = !0, e.parentRenderGroup = this, e.parent === this.root ? e.relativeRenderGroupDepth = 1 : e.relativeRenderGroupDepth = e.parent.relativeRenderGroupDepth + 1, e.didChange = !0, this.onChildUpdate(e), e.renderGroup) {
|
|
593
|
+
this.addRenderGroupChild(e.renderGroup);
|
|
594
|
+
return;
|
|
650
595
|
}
|
|
651
|
-
|
|
652
|
-
let
|
|
653
|
-
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
596
|
+
e._onRender && this.addOnRender(e);
|
|
597
|
+
let t = e.children;
|
|
598
|
+
for (let e = 0; e < t.length; ++e) this.addChild(t[e]);
|
|
599
|
+
}
|
|
600
|
+
removeChild(e) {
|
|
601
|
+
if (this.structureDidChange = !0, e.parentRenderGroup = null, e.renderGroup) {
|
|
602
|
+
this._removeRenderGroupChild(e.renderGroup);
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
let t = e.children;
|
|
606
|
+
for (let e = 0; e < t.length; ++e) this.removeChild(t[e]);
|
|
607
|
+
}
|
|
608
|
+
removeChildren(e) {
|
|
609
|
+
for (let t = 0; t < e.length; ++t) this.removeChild(e[t]);
|
|
610
|
+
}
|
|
611
|
+
addRenderGroupChild(e) {
|
|
612
|
+
e.renderGroupParent && e.renderGroupParent._removeRenderGroupChild(e), e.renderGroupParent = this, this.renderGroupChildren.push(e);
|
|
613
|
+
}
|
|
614
|
+
_removeRenderGroupChild(e) {
|
|
615
|
+
let t = this.renderGroupChildren.indexOf(e);
|
|
616
|
+
t > -1 && this.renderGroupChildren.splice(t, 1), e.renderGroupParent = null;
|
|
617
|
+
}
|
|
618
|
+
addOnRender(e) {
|
|
619
|
+
this._onRenderContainers.push(e);
|
|
620
|
+
}
|
|
621
|
+
removeOnRender(e) {
|
|
622
|
+
this._onRenderContainers.splice(this._onRenderContainers.indexOf(e), 1);
|
|
623
|
+
}
|
|
624
|
+
runOnRender(e) {
|
|
625
|
+
for (let t = 0; t < this._onRenderContainers.length; ++t) this._onRenderContainers[t]._onRender(e);
|
|
626
|
+
}
|
|
627
|
+
onChildViewUpdate(e) {
|
|
628
|
+
this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++] = e;
|
|
629
|
+
}
|
|
630
|
+
onChildUpdate(e) {
|
|
631
|
+
let t = this.childrenToUpdate[e.relativeRenderGroupDepth];
|
|
632
|
+
t || (t = this.childrenToUpdate[e.relativeRenderGroupDepth] = {
|
|
633
|
+
index: 0,
|
|
634
|
+
list: []
|
|
635
|
+
}), t.list[t.index++] = e;
|
|
636
|
+
}
|
|
637
|
+
updateRenderable(e) {
|
|
638
|
+
e.globalDisplayStatus < 7 || (this.instructionSet.renderPipes[e.renderPipeId].updateRenderable(e), e.didViewUpdate = !1);
|
|
639
|
+
}
|
|
640
|
+
destroy() {
|
|
641
|
+
this.root = null, this.childrenRenderablesToUpdate = null, this.childrenToUpdate = null, this._onRenderContainers = null, this.renderGroupChildren = null, this.instructionSet = null;
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region lib/scene/container/utils.ts
|
|
646
|
+
function ve(e, t) {
|
|
647
|
+
t || (t = 0);
|
|
648
|
+
for (let n = t; n < e.length && e[n]; ++n) e[n] = null;
|
|
649
|
+
}
|
|
650
|
+
function ye(e, t, n = {}) {
|
|
651
|
+
for (let r in t) !n[r] && t[r] !== void 0 && (e[r] = t[r]);
|
|
664
652
|
}
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region lib/scene/container/Container.ts
|
|
655
|
+
var be = 1, xe = 2, Se = 4, Ce = 8, k = new C(null), A = new C(null), j = new C(null, 1, 1), M = new C(null), N = class extends c {
|
|
656
|
+
constructor(e = {}) {
|
|
657
|
+
var t, n;
|
|
658
|
+
super(), f(this, "uid", D("renderable")), f(this, "label", void 0), f(this, "destroyed", !1), f(this, "renderGroup", null), f(this, "parentRenderGroup", null), f(this, "parent", null), f(this, "eventMode", "passive"), f(this, "hitArea", null), f(this, "boundsArea", void 0), f(this, "_position", new C(this, 0, 0)), f(this, "includeInBuild", !0), f(this, "renderPipeId", void 0), f(this, "didChange", !1), f(this, "didViewUpdate", !1), f(this, "isSimple", !0), f(this, "measurable", !0), f(this, "relativeRenderGroupDepth", 0), f(this, "_didViewChangeTick", 0), f(this, "_didContainerChangeTick", 0), f(this, "_localTransformUpdateTick", 0), f(this, "_updateFlags", 15), f(this, "localDisplayStatus", 7), f(this, "globalDisplayStatus", 7), f(this, "children", []), f(this, "localTransform", new _()), f(this, "relativeGroupTransform", new _()), f(this, "groupTransform", this.relativeGroupTransform), f(this, "_rotation", 0), f(this, "_worldTransform", void 0), f(this, "_cx", 1), f(this, "_sx", 0), f(this, "_cy", 0), f(this, "_sy", 1), f(this, "_skew", k), f(this, "_scale", j), f(this, "_origin", A), f(this, "_pivot", M), f(this, "localAlpha", 1), f(this, "groupColor", 16777215), f(this, "localColor", 16777215), f(this, "groupAlpha", 1), f(this, "groupColorAlpha", 4294967295), ye(this, e, {
|
|
670
659
|
children: !0,
|
|
671
660
|
parent: !0,
|
|
672
661
|
effects: !0
|
|
673
|
-
}), (
|
|
662
|
+
}), (t = e.children) == null || t.forEach((e) => this.addChild(e)), (n = e.parent) == null || n.addChild(this), this.effects = [];
|
|
674
663
|
}
|
|
675
664
|
get renderable() {
|
|
676
665
|
return !!(this.localDisplayStatus & 1);
|
|
677
666
|
}
|
|
678
|
-
set renderable(
|
|
679
|
-
let
|
|
680
|
-
(this.localDisplayStatus & 1) !==
|
|
667
|
+
set renderable(e) {
|
|
668
|
+
let t = +!!e;
|
|
669
|
+
(this.localDisplayStatus & 1) !== t && (this._updateFlags |= 4, this.localDisplayStatus ^= 1, this.parentRenderGroup && (this.parentRenderGroup.structureDidChange = !0), this._onUpdate());
|
|
681
670
|
}
|
|
682
671
|
get visible() {
|
|
683
672
|
return !!(this.localDisplayStatus & 2);
|
|
684
673
|
}
|
|
685
|
-
set visible(
|
|
686
|
-
let
|
|
687
|
-
(this.localDisplayStatus & 2) !==
|
|
674
|
+
set visible(e) {
|
|
675
|
+
let t = e ? 2 : 0;
|
|
676
|
+
(this.localDisplayStatus & 2) !== t && (this.parentRenderGroup && (this.parentRenderGroup.structureDidChange = !0), this._updateFlags |= 4, this.localDisplayStatus ^= 2, this._onUpdate(), this.emit("visibleChanged", e));
|
|
688
677
|
}
|
|
689
678
|
get isRenderGroup() {
|
|
690
679
|
return !!this.renderGroup;
|
|
691
680
|
}
|
|
692
|
-
set isRenderGroup(
|
|
693
|
-
!!this.renderGroup !==
|
|
681
|
+
set isRenderGroup(e) {
|
|
682
|
+
!!this.renderGroup !== e && (e ? this.enableRenderGroup() : this.disableRenderGroup());
|
|
694
683
|
}
|
|
695
684
|
get zIndex() {
|
|
696
685
|
return this._zIndex;
|
|
697
686
|
}
|
|
698
|
-
set zIndex(
|
|
699
|
-
|
|
687
|
+
set zIndex(e) {
|
|
688
|
+
e !== this._zIndex && (this._zIndex = e, this.depthOfChildModified());
|
|
700
689
|
}
|
|
701
690
|
_updateIsSimple() {
|
|
702
|
-
this.isSimple = !this.renderGroup && this.effects.length
|
|
691
|
+
this.isSimple = !this.renderGroup && this.effects.length === 0;
|
|
703
692
|
}
|
|
704
693
|
sortChildren() {
|
|
705
|
-
this.sortDirty && (this.sortDirty = !1, this.children.sort(
|
|
694
|
+
this.sortDirty && (this.sortDirty = !1, this.children.sort(Te));
|
|
706
695
|
}
|
|
707
696
|
depthOfChildModified() {
|
|
708
697
|
this.parent && (this.parent.sortableChildren = !0, this.parent.sortDirty = !0), this.parentRenderGroup && (this.parentRenderGroup.structureDidChange = !0);
|
|
709
698
|
}
|
|
710
699
|
enableRenderGroup() {
|
|
711
700
|
if (this.renderGroup) return;
|
|
712
|
-
let
|
|
713
|
-
|
|
701
|
+
let e = this.parentRenderGroup;
|
|
702
|
+
e == null || e.removeChild(this), this.renderGroup = new _e(this), this.groupTransform = _.IDENTITY, e == null || e.addChild(this), this._updateIsSimple();
|
|
714
703
|
}
|
|
715
704
|
disableRenderGroup() {
|
|
716
705
|
if (!this.renderGroup) return;
|
|
717
|
-
let
|
|
718
|
-
|
|
706
|
+
let e = this.parentRenderGroup;
|
|
707
|
+
e == null || e.removeChild(this), this.renderGroup = null, this.groupTransform = this.relativeGroupTransform, e == null || e.addChild(this), this._updateIsSimple();
|
|
719
708
|
}
|
|
720
|
-
collectRenderables(
|
|
721
|
-
this.globalDisplayStatus < 7 || !this.includeInBuild || (this.sortableChildren && this.sortChildren(), this.isSimple ? this.collectRenderableSimple(
|
|
709
|
+
collectRenderables(e, t) {
|
|
710
|
+
this.globalDisplayStatus < 7 || !this.includeInBuild || (this.sortableChildren && this.sortChildren(), this.isSimple ? this.collectRenderableSimple(e, t) : this.renderGroup || this.collectRenderablesWithEffects(e, t));
|
|
722
711
|
}
|
|
723
|
-
collectRenderablesWithEffects(
|
|
724
|
-
for (let
|
|
725
|
-
let
|
|
726
|
-
|
|
712
|
+
collectRenderablesWithEffects(e, t) {
|
|
713
|
+
for (let n = 0; n < this.effects.length; ++n) {
|
|
714
|
+
let r = this.effects[n];
|
|
715
|
+
e[r.pipe].push(r, t);
|
|
727
716
|
}
|
|
728
|
-
this.collectRenderableSimple(
|
|
729
|
-
for (let
|
|
730
|
-
let
|
|
731
|
-
|
|
717
|
+
this.collectRenderableSimple(e, t);
|
|
718
|
+
for (let n = 0; n < this.effects.length; ++n) {
|
|
719
|
+
let r = this.effects[n];
|
|
720
|
+
e[r.pipe].pop(r, t);
|
|
732
721
|
}
|
|
733
722
|
}
|
|
734
|
-
collectRenderableSimple(
|
|
735
|
-
let
|
|
736
|
-
for (let
|
|
723
|
+
collectRenderableSimple(e, t) {
|
|
724
|
+
let n = this.children;
|
|
725
|
+
for (let r = 0; r < n.length; ++r) n[r].collectRenderables(e, t);
|
|
737
726
|
}
|
|
738
|
-
setFromMatrix(
|
|
739
|
-
|
|
727
|
+
setFromMatrix(e) {
|
|
728
|
+
e.decompose(this);
|
|
740
729
|
}
|
|
741
730
|
_updateSkew() {
|
|
742
|
-
let
|
|
743
|
-
this._cx = Math.cos(
|
|
731
|
+
let e = this.rotation, t = this.skew;
|
|
732
|
+
this._cx = Math.cos(e + t.y), this._sx = Math.sin(e + t.y), this._cy = -Math.sin(e - t.x), this._sy = Math.cos(e - t.x);
|
|
744
733
|
}
|
|
745
734
|
updateLocalTransform() {
|
|
746
|
-
let
|
|
747
|
-
if (this._localTransformUpdateTick ===
|
|
748
|
-
this._localTransformUpdateTick =
|
|
749
|
-
let
|
|
750
|
-
|
|
735
|
+
let e = this._didContainerChangeTick;
|
|
736
|
+
if (this._localTransformUpdateTick === e) return;
|
|
737
|
+
this._localTransformUpdateTick = e, this._updateSkew();
|
|
738
|
+
let t = this.position, n = this.localTransform, r = this._scale.x, i = this._scale.y, a = -this._origin.x, o = -this._origin.y, s = this._pivot.x, c = this._pivot.y;
|
|
739
|
+
n.a = this._cx * r, n.b = this._sx * r, n.c = this._cy * i, n.d = this._sy * i, n.tx = t.x - (s * n.a + c * n.c) + (a * n.a + o * n.c) - a, n.ty = t.y - (s * n.b + c * n.d) + (a * n.b + o * n.d) - o;
|
|
751
740
|
}
|
|
752
741
|
get alpha() {
|
|
753
742
|
return this.localAlpha;
|
|
754
743
|
}
|
|
755
|
-
set alpha(
|
|
756
|
-
|
|
744
|
+
set alpha(e) {
|
|
745
|
+
e !== this.localAlpha && (this.localAlpha = e, this._updateFlags |= 1, this._onUpdate());
|
|
757
746
|
}
|
|
758
747
|
get root() {
|
|
759
|
-
let
|
|
760
|
-
for (;
|
|
761
|
-
return
|
|
748
|
+
let e = this.parent, t = this.parent;
|
|
749
|
+
for (; e;) e.parent || (t = e), e = e.parent;
|
|
750
|
+
return t;
|
|
762
751
|
}
|
|
763
752
|
get worldTransform() {
|
|
764
|
-
return this._worldTransform || (this._worldTransform = new
|
|
753
|
+
return this._worldTransform || (this._worldTransform = new _()), this.renderGroup ? this._worldTransform.copyFrom(this.renderGroup.worldTransform) : this.parentRenderGroup && this._worldTransform.appendFrom(this.relativeGroupTransform, this.parentRenderGroup.worldTransform), this._worldTransform;
|
|
765
754
|
}
|
|
766
755
|
get x() {
|
|
767
756
|
return this._position.x;
|
|
768
757
|
}
|
|
769
|
-
set x(
|
|
770
|
-
this._position.x =
|
|
758
|
+
set x(e) {
|
|
759
|
+
this._position.x = e;
|
|
771
760
|
}
|
|
772
761
|
get position() {
|
|
773
762
|
return this._position;
|
|
774
763
|
}
|
|
775
|
-
set position(
|
|
776
|
-
this._position.copyFrom(
|
|
764
|
+
set position(e) {
|
|
765
|
+
this._position.copyFrom(e);
|
|
777
766
|
}
|
|
778
767
|
get y() {
|
|
779
768
|
return this._position.y;
|
|
780
769
|
}
|
|
781
|
-
set y(
|
|
782
|
-
this._position.y =
|
|
770
|
+
set y(e) {
|
|
771
|
+
this._position.y = e;
|
|
783
772
|
}
|
|
784
773
|
get rotation() {
|
|
785
774
|
return this._rotation;
|
|
786
775
|
}
|
|
787
|
-
set rotation(
|
|
788
|
-
this._rotation !==
|
|
776
|
+
set rotation(e) {
|
|
777
|
+
this._rotation !== e && (this._rotation = e, this._onUpdate(this._skew));
|
|
789
778
|
}
|
|
790
779
|
get angle() {
|
|
791
|
-
return this.rotation *
|
|
780
|
+
return this.rotation * S;
|
|
792
781
|
}
|
|
793
|
-
set angle(
|
|
794
|
-
this.rotation =
|
|
782
|
+
set angle(e) {
|
|
783
|
+
this.rotation = e * ee;
|
|
795
784
|
}
|
|
796
785
|
get skew() {
|
|
797
|
-
return this._skew ===
|
|
786
|
+
return this._skew === k && (this._skew = new C(this, 0, 0)), this._skew;
|
|
798
787
|
}
|
|
799
|
-
set skew(
|
|
800
|
-
this._skew ===
|
|
788
|
+
set skew(e) {
|
|
789
|
+
this._skew === k && (this._skew = new C(this, 0, 0)), this._skew.copyFrom(e);
|
|
801
790
|
}
|
|
802
791
|
get scale() {
|
|
803
|
-
return this._scale ===
|
|
792
|
+
return this._scale === j && (this._scale = new C(this, 1, 1)), this._scale;
|
|
804
793
|
}
|
|
805
|
-
set scale(
|
|
806
|
-
this._scale ===
|
|
794
|
+
set scale(e) {
|
|
795
|
+
this._scale === j && (this._scale = new C(this, 1, 1)), this._scale.copyFrom(e);
|
|
807
796
|
}
|
|
808
797
|
get pivot() {
|
|
809
|
-
return this._pivot ===
|
|
798
|
+
return this._pivot === M && (this._pivot = new C(this, 0, 0)), this._pivot;
|
|
810
799
|
}
|
|
811
|
-
set pivot(
|
|
812
|
-
this._pivot ===
|
|
800
|
+
set pivot(e) {
|
|
801
|
+
this._pivot === M && (this._pivot = new C(this, 0, 0)), this._pivot.copyFrom(e);
|
|
813
802
|
}
|
|
814
803
|
get origin() {
|
|
815
|
-
return this._origin ===
|
|
804
|
+
return this._origin === A && (this._origin = new C(this, 0, 0)), this._origin;
|
|
816
805
|
}
|
|
817
|
-
set origin(
|
|
818
|
-
this._origin ===
|
|
806
|
+
set origin(e) {
|
|
807
|
+
this._origin === A && (this._origin = new C(this, 0, 0)), typeof e == "number" ? this._origin.set(e) : this._origin.copyFrom(e);
|
|
819
808
|
}
|
|
820
809
|
get width() {
|
|
821
810
|
return Math.abs(this.scale.x * this.getLocalBounds().width);
|
|
822
811
|
}
|
|
823
|
-
set width(
|
|
812
|
+
set width(e) {}
|
|
824
813
|
get height() {
|
|
825
814
|
return Math.abs(this.scale.y * this.getLocalBounds().height);
|
|
826
815
|
}
|
|
827
|
-
set height(
|
|
828
|
-
addChild(...
|
|
829
|
-
if (
|
|
830
|
-
for (let
|
|
831
|
-
return
|
|
816
|
+
set height(e) {}
|
|
817
|
+
addChild(...e) {
|
|
818
|
+
if (e.length > 1) {
|
|
819
|
+
for (let t = 0; t < e.length; ++t) this.addChild(e[t]);
|
|
820
|
+
return e[0];
|
|
832
821
|
}
|
|
833
|
-
let
|
|
834
|
-
return
|
|
822
|
+
let t = e[0], n = this.renderGroup || this.parentRenderGroup;
|
|
823
|
+
return t.parent === this ? (this.children.splice(this.children.indexOf(t), 1), this.children.push(t), n && (n.structureDidChange = !0), t) : (this.sortableChildren && (this.sortDirty = !0), t.parent && t.parent.removeChild(t), this.children.push(t), this.sortableChildren && (this.sortDirty = !0), t.parent = this, t.didChange = !0, t._updateFlags = 7, n && n.addChild(t), this._didViewChangeTick++, t._zIndex !== 0 && t.depthOfChildModified(), t);
|
|
835
824
|
}
|
|
836
|
-
removeChild(...
|
|
837
|
-
if (
|
|
838
|
-
for (let
|
|
839
|
-
return
|
|
825
|
+
removeChild(...e) {
|
|
826
|
+
if (e.length > 1) {
|
|
827
|
+
for (let t = 0; t < e.length; ++t) this.removeChild(e[t]);
|
|
828
|
+
return e[0];
|
|
840
829
|
}
|
|
841
|
-
let
|
|
842
|
-
if (!
|
|
843
|
-
let
|
|
844
|
-
return
|
|
830
|
+
let t = e[0];
|
|
831
|
+
if (!t) return t;
|
|
832
|
+
let n = this.children.indexOf(t);
|
|
833
|
+
return n > -1 && (this._didViewChangeTick++, this.children.splice(n, 1), this.renderGroup ? this.renderGroup.removeChild(t) : this.parentRenderGroup && this.parentRenderGroup.removeChild(t), t.parent = null), t;
|
|
845
834
|
}
|
|
846
|
-
_onUpdate(
|
|
847
|
-
|
|
835
|
+
_onUpdate(e) {
|
|
836
|
+
e && e === this._skew && this._updateSkew(), this._didContainerChangeTick++, !this.didChange && (this.didChange = !0, this.parentRenderGroup && this.parentRenderGroup.onChildUpdate(this));
|
|
848
837
|
}
|
|
849
|
-
toGlobal(
|
|
850
|
-
|
|
838
|
+
toGlobal(e, t, n) {
|
|
839
|
+
let r = this.getGlobalTransform(T.get(), n);
|
|
840
|
+
return t = r.apply(e, t), T.return(r), t;
|
|
851
841
|
}
|
|
852
|
-
toLocal(
|
|
853
|
-
|
|
854
|
-
|
|
842
|
+
toLocal(e, t, n, r) {
|
|
843
|
+
t && (e = t.toGlobal(e, n, r));
|
|
844
|
+
let i = this.getGlobalTransform(T.get(), r);
|
|
845
|
+
return n = i.applyInverse(e, n), T.return(i), n;
|
|
855
846
|
}
|
|
856
|
-
getGlobalTransform(
|
|
857
|
-
if (
|
|
847
|
+
getGlobalTransform(e = new _(), t = !1) {
|
|
848
|
+
if (t) return this.worldTransform.clone();
|
|
858
849
|
this.updateLocalTransform();
|
|
859
|
-
let
|
|
860
|
-
return
|
|
850
|
+
let n = we(this, T.get().identity());
|
|
851
|
+
return e.appendFrom(this.localTransform, n), T.return(n), e;
|
|
861
852
|
}
|
|
862
|
-
getGlobalPosition(
|
|
863
|
-
return this.parent ? this.parent.toGlobal(this._position,
|
|
853
|
+
getGlobalPosition(e = new b(), t = !1) {
|
|
854
|
+
return this.parent ? this.parent.toGlobal(this._position, e, t) : (e.x = this._position.x, e.y = this._position.y), e;
|
|
864
855
|
}
|
|
865
|
-
destroy(
|
|
866
|
-
var
|
|
856
|
+
destroy(e = !1) {
|
|
857
|
+
var t, n;
|
|
867
858
|
if (this.destroyed) return;
|
|
868
859
|
this.destroyed = !0;
|
|
869
|
-
let
|
|
870
|
-
if (this.children.length && (
|
|
871
|
-
(
|
|
860
|
+
let r;
|
|
861
|
+
if (this.children.length && (r = this.removeChildren(0, this.children.length)), (t = this.parent) == null || t.removeChild(this), this.parent = null, this._maskEffect = null, this.effects = null, this._position = null, this._scale = null, this._pivot = null, this._origin = null, this._skew = null, (typeof e == "boolean" ? e : e != null && e.children) && r) for (let t = 0; t < r.length; ++t) r[t].destroy(e);
|
|
862
|
+
(n = this.renderGroup) == null || n.destroy(), this.renderGroup = null;
|
|
872
863
|
}
|
|
873
864
|
};
|
|
874
|
-
function
|
|
875
|
-
let
|
|
876
|
-
if (
|
|
877
|
-
|
|
878
|
-
let
|
|
879
|
-
|
|
880
|
-
}
|
|
881
|
-
return
|
|
865
|
+
function we(e, t) {
|
|
866
|
+
let n = e.parent;
|
|
867
|
+
if (n) {
|
|
868
|
+
we(n, t), n.updateLocalTransform();
|
|
869
|
+
let e = _.append(t, n.localTransform);
|
|
870
|
+
t.copyFrom(e);
|
|
871
|
+
}
|
|
872
|
+
return t;
|
|
882
873
|
}
|
|
883
|
-
function
|
|
884
|
-
return
|
|
874
|
+
function Te(e, t) {
|
|
875
|
+
return e._zIndex - t._zIndex;
|
|
885
876
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
for (let j in N) {
|
|
893
|
-
let M = Number(j), P = N[M], F = P.list, I = P.index;
|
|
894
|
-
for (let j = 0; j < I; ++j) {
|
|
895
|
-
let N = F[j];
|
|
896
|
-
N.parentRenderGroup === n && N.relativeRenderGroupDepth === M && updateTransform(N, 0);
|
|
897
|
-
}
|
|
898
|
-
clearList(F, I), P.index = 0;
|
|
899
|
-
}
|
|
900
|
-
if (j) for (let M = 0; M < n.renderGroupChildren.length; ++M) updateRenderGroupTransform(n.renderGroupChildren[M], j);
|
|
901
|
-
}
|
|
902
|
-
function updateTransform(n, j) {
|
|
903
|
-
n.didChange = !1;
|
|
904
|
-
let M = n.parent, N = n.localTransform;
|
|
905
|
-
n.updateLocalTransform(), M && (j |= n._updateFlags, n.relativeGroupTransform.appendFrom(N, M.relativeGroupTransform), j & UPDATE_BLEND_COLOR_VISIBLE && updateBlendColorVisible(n, M, j));
|
|
906
|
-
let P = n.children;
|
|
907
|
-
for (let n = 0; n < P.length; n++) updateTransform(P[n], j);
|
|
908
|
-
}
|
|
909
|
-
function updateBlendColorVisible(n, j, M) {
|
|
910
|
-
if (M & 1) {
|
|
911
|
-
n.groupColor = j.groupColor;
|
|
912
|
-
let M = n.localAlpha * j.groupAlpha;
|
|
913
|
-
M = M < 0 ? 0 : M > 1 ? 1 : M, n.groupAlpha = M, n.groupColorAlpha = n.groupColor + ((M * 255 | 0) << 24);
|
|
914
|
-
}
|
|
915
|
-
M & 4 && (n.globalDisplayStatus = n.localDisplayStatus & j.globalDisplayStatus), n._updateFlags = 0;
|
|
916
|
-
}
|
|
917
|
-
function validateRenderables(n, j) {
|
|
918
|
-
let { list: M, index: N } = n.childrenRenderablesToUpdate, P = !1;
|
|
919
|
-
for (let n = 0; n < N; ++n) {
|
|
920
|
-
let N = M[n];
|
|
921
|
-
if (P = j[N.renderPipeId].validateRenderable(N), P) break;
|
|
922
|
-
}
|
|
923
|
-
return n.structureDidChange = P, P;
|
|
924
|
-
}
|
|
925
|
-
var _RenderGroupSystem, RenderGroupSystem = class {
|
|
926
|
-
constructor(n) {
|
|
927
|
-
this.renderer = n;
|
|
928
|
-
}
|
|
929
|
-
_updateRenderGroup(n) {
|
|
930
|
-
let j = this.renderer, M = j.renderPipes;
|
|
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;
|
|
932
|
-
}
|
|
933
|
-
render({ container: n, transform: j }) {
|
|
934
|
-
let M = this.renderer;
|
|
935
|
-
j && n.renderGroup.localTransform.copyFrom(j), M.canvasContext.globalTransform = j ? n.renderGroup.localTransform : n.renderGroup.worldTransform, this._updateRenderGroup(n.renderGroup), executeInstructions(n.renderGroup, M.renderPipes);
|
|
936
|
-
}
|
|
937
|
-
_buildInstructions(n, j) {
|
|
938
|
-
let M = j.renderPipes, N = n.root;
|
|
939
|
-
n.instructionSet.reset(), N.sortableChildren && N.sortChildren(), M.batch.buildStart(), N.collectRenderablesWithEffects(M, n.instructionSet), M.batch.buildEnd(n.instructionSet);
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
|
-
_RenderGroupSystem = RenderGroupSystem, _RenderGroupSystem.desc = { name: "renderGroup" };
|
|
943
|
-
function executeInstructions(n, j) {
|
|
944
|
-
let { instructionSet: M } = n, N = M.instructions;
|
|
945
|
-
for (let n = 0; n < M.instructionSize; n++) {
|
|
946
|
-
let M = N[n];
|
|
947
|
-
j[M.renderPipeId].execute(M);
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
var _SpritePipe, SpritePipe = class {
|
|
951
|
-
constructor(n) {
|
|
952
|
-
this._renderer = n;
|
|
953
|
-
}
|
|
954
|
-
addRenderable(n, j) {
|
|
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 = {
|
|
969
|
-
renderable: n,
|
|
970
|
-
texture: n.texture,
|
|
971
|
-
transform: n.relativeGroupTransform,
|
|
972
|
-
bounds: n.bounds,
|
|
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;
|
|
979
|
-
}
|
|
980
|
-
destroy() {
|
|
981
|
-
this._renderer = null;
|
|
982
|
-
}
|
|
983
|
-
};
|
|
984
|
-
_SpritePipe = SpritePipe, _SpritePipe.desc = { name: "sprite" };
|
|
985
|
-
var _TextPipe, TextPipe = class {
|
|
986
|
-
constructor(n) {
|
|
987
|
-
this._renderer = n;
|
|
988
|
-
}
|
|
989
|
-
addRenderable(n, j) {
|
|
990
|
-
let M = this._getRuntimeText(n);
|
|
991
|
-
if (n._didTextUpdate) {
|
|
992
|
-
let j = n._autoResolution ? this._renderer.resolution : n.resolution;
|
|
993
|
-
(M.currentKey !== n.styleKey || n._resolution !== j) && this._updateRuntimeText(n), n._didTextUpdate = !1, updateBounds(M.bounds, n._anchor, M.texture);
|
|
994
|
-
}
|
|
995
|
-
this._renderer.renderPipes.batch.addToBatch(M, j);
|
|
996
|
-
}
|
|
997
|
-
validateRenderable(n) {
|
|
998
|
-
let j = this._getRuntimeText(n), M = n.styleKey;
|
|
999
|
-
return j.currentKey === M ? n._didTextUpdate : !0;
|
|
1000
|
-
}
|
|
1001
|
-
initCacheText(n) {
|
|
1002
|
-
let j = {
|
|
1003
|
-
currentKey: "--",
|
|
1004
|
-
transform: n.relativeGroupTransform,
|
|
1005
|
-
bounds: n.bounds,
|
|
1006
|
-
roundPixels: this._renderer._roundPixels | n._roundPixels,
|
|
1007
|
-
renderable: n,
|
|
1008
|
-
texture: null,
|
|
1009
|
-
destroy: function() {
|
|
1010
|
-
this.renderable = null, this.texture = null, this.bounds = null;
|
|
1011
|
-
}
|
|
1012
|
-
};
|
|
1013
|
-
return n._runtimeData[this._renderer.uid] = j, j;
|
|
1014
|
-
}
|
|
1015
|
-
_getRuntimeText(n) {
|
|
1016
|
-
return n._runtimeData[this._renderer.uid] || this.initCacheText(n);
|
|
1017
|
-
}
|
|
1018
|
-
_updateRuntimeText(n) {
|
|
1019
|
-
let j = this._getRuntimeText(n);
|
|
1020
|
-
j.texture, n._resolution = n._autoResolution ? this._renderer.resolution : n.resolution, j.texture = this._renderer.text.getManagedTexture(n), j.currentKey = n.styleKey;
|
|
1021
|
-
}
|
|
1022
|
-
destroy() {
|
|
1023
|
-
this._renderer = null;
|
|
1024
|
-
}
|
|
1025
|
-
};
|
|
1026
|
-
_TextPipe = TextPipe, _TextPipe.desc = { name: "text" };
|
|
1027
|
-
var ViewContainer = class extends Container {
|
|
1028
|
-
constructor(...n) {
|
|
1029
|
-
super(...n), this._runtimeData = Object.create(null), this._roundPixels = 0, this._bounds = new Bounds(0, 1, 0, 0), this._boundsDirty = !0;
|
|
877
|
+
oe(N, he, fe, pe, se);
|
|
878
|
+
//#endregion
|
|
879
|
+
//#region lib/scene/ViewContainer.ts
|
|
880
|
+
var P = class extends N {
|
|
881
|
+
constructor(...e) {
|
|
882
|
+
super(...e), f(this, "_runtimeData", Object.create(null)), f(this, "_resolution", void 0), f(this, "_roundPixels", 0), f(this, "_bounds", new w(0, 1, 0, 0)), f(this, "_boundsDirty", !0);
|
|
1030
883
|
}
|
|
1031
884
|
get bounds() {
|
|
1032
885
|
return this._boundsDirty ? (this.updateBounds(), this._boundsDirty = !1, this._bounds) : this._bounds;
|
|
@@ -1034,32 +887,32 @@ var ViewContainer = class extends Container {
|
|
|
1034
887
|
onViewUpdate() {
|
|
1035
888
|
if (this._didViewChangeTick++, this._boundsDirty = !0, this.didViewUpdate) return;
|
|
1036
889
|
this.didViewUpdate = !0;
|
|
1037
|
-
let
|
|
1038
|
-
|
|
890
|
+
let e = this.renderGroup || this.parentRenderGroup;
|
|
891
|
+
e && e.onChildViewUpdate(this);
|
|
1039
892
|
}
|
|
1040
|
-
collectRenderableSimple(
|
|
1041
|
-
let
|
|
1042
|
-
|
|
1043
|
-
let
|
|
1044
|
-
for (let
|
|
893
|
+
collectRenderableSimple(e, t) {
|
|
894
|
+
let n = e[this.renderPipeId];
|
|
895
|
+
n && n.addRenderable && n.addRenderable(this, t), this.didViewUpdate = !1;
|
|
896
|
+
let r = this.children;
|
|
897
|
+
for (let n = 0; n < r.length; ++n) r[n].collectRenderables(e, t);
|
|
1045
898
|
}
|
|
1046
|
-
containsPoint(
|
|
1047
|
-
let
|
|
1048
|
-
return
|
|
899
|
+
containsPoint(e) {
|
|
900
|
+
let t = this.bounds, { x: n, y: r } = e;
|
|
901
|
+
return n > t.minX && n < t.maxX && r > t.minY && r < t.maxY;
|
|
1049
902
|
}
|
|
1050
903
|
get roundPixels() {
|
|
1051
904
|
return !!this._roundPixels;
|
|
1052
905
|
}
|
|
1053
|
-
set roundPixels(
|
|
1054
|
-
this._roundPixels =
|
|
906
|
+
set roundPixels(e) {
|
|
907
|
+
this._roundPixels = +!!e;
|
|
1055
908
|
}
|
|
1056
|
-
destroy(
|
|
1057
|
-
for (let
|
|
1058
|
-
this._runtimeData = Object.create(null), this.onViewUpdate(), super.destroy(
|
|
909
|
+
destroy(e = !1) {
|
|
910
|
+
for (let e in this._runtimeData) this._runtimeData[e].destroy();
|
|
911
|
+
this._runtimeData = Object.create(null), this.onViewUpdate(), super.destroy(e), this._bounds = null;
|
|
1059
912
|
}
|
|
1060
|
-
},
|
|
913
|
+
}, Ee = class {
|
|
1061
914
|
constructor() {
|
|
1062
|
-
this
|
|
915
|
+
f(this, "points", []), f(this, "closePath", void 0), f(this, "type", "polygon");
|
|
1063
916
|
}
|
|
1064
917
|
construction() {}
|
|
1065
918
|
get lastX() {
|
|
@@ -1068,171 +921,153 @@ var ViewContainer = class extends Container {
|
|
|
1068
921
|
get lastY() {
|
|
1069
922
|
return this.points[this.points.length - 1];
|
|
1070
923
|
}
|
|
1071
|
-
|
|
1072
|
-
let n =
|
|
1073
|
-
for (let n = 0; n <
|
|
1074
|
-
let
|
|
1075
|
-
|
|
924
|
+
strokeContains(e, t, n, r = .5) {
|
|
925
|
+
let i = n * n, a = i * (1 - r), o = i - a, { points: s } = this, c = s.length - (this.closePath ? 0 : 2);
|
|
926
|
+
for (let n = 0; n < c; n += 2) {
|
|
927
|
+
let r = s[n], i = s[n + 1], c = s[(n + 2) % s.length], l = s[(n + 3) % s.length];
|
|
928
|
+
if (ie(e, t, r, i, c, l) <= (Math.sign((c - r) * (t - i) - (l - i) * (e - r)) < 0 ? o : a)) return !0;
|
|
1076
929
|
}
|
|
1077
|
-
return
|
|
930
|
+
return !1;
|
|
1078
931
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
932
|
+
contains(e, t) {
|
|
933
|
+
let n = !1, r = this.points.length / 2;
|
|
934
|
+
for (let i = 0, a = r - 1; i < r; a = i++) {
|
|
935
|
+
let r = this.points[i * 2], o = this.points[i * 2 + 1], s = this.points[a * 2], c = this.points[a * 2 + 1];
|
|
936
|
+
o > t != c > t && e < (s - r) * ((t - o) / (c - o)) + r && (n = !n);
|
|
937
|
+
}
|
|
938
|
+
return n;
|
|
939
|
+
}
|
|
940
|
+
getBounds(e) {
|
|
941
|
+
e || (e = new y());
|
|
942
|
+
let t = this.points, n = Infinity, r = Infinity, i = -Infinity, a = -Infinity;
|
|
943
|
+
for (let e = 0; e < t.length; e += 2) {
|
|
944
|
+
let o = t[e], s = t[e + 1];
|
|
945
|
+
n = o < n ? o : n, r = s < r ? s : r, i = o > i ? o : i, a = s > a ? s : a;
|
|
946
|
+
}
|
|
947
|
+
return e.x = n, e.width = i - n, e.y = r, e.height = a - r, e;
|
|
948
|
+
}
|
|
949
|
+
}, De = 8, F = 1.1920929e-7, Oe = 1;
|
|
950
|
+
function ke(e, t, n, r, i, a, o, s, c, l) {
|
|
951
|
+
let u = (Oe - Math.min(.99, Math.max(0, l == null ? .5 : l))) / 1;
|
|
952
|
+
return u *= u, Ae(t, n, r, i, a, o, s, c, e, u), e;
|
|
1083
953
|
}
|
|
1084
|
-
function
|
|
1085
|
-
|
|
954
|
+
function Ae(e, t, n, r, i, a, o, s, c, l) {
|
|
955
|
+
I(e, t, n, r, i, a, o, s, c, l, 0), c.push(o, s);
|
|
1086
956
|
}
|
|
1087
|
-
function
|
|
1088
|
-
if (
|
|
1089
|
-
let
|
|
1090
|
-
if (
|
|
1091
|
-
let
|
|
1092
|
-
if (
|
|
1093
|
-
if ((
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
return;
|
|
1097
|
-
}
|
|
1098
|
-
let z = Math.atan2(F - N, P - M);
|
|
1099
|
-
if (G = Math.abs(z - Math.atan2(N - j, M - n)), K = Math.abs(Math.atan2(L - F, I - P) - z), G >= V && (G = 2 * V - G), K >= V && (K = 2 * V - K), G + K < mAngleTolerance) {
|
|
1100
|
-
R.push(Q, $);
|
|
1101
|
-
return;
|
|
1102
|
-
}
|
|
1103
|
-
if (mCuspLimit !== 0) {
|
|
1104
|
-
if (G > mCuspLimit) {
|
|
1105
|
-
R.push(M, N);
|
|
1106
|
-
return;
|
|
1107
|
-
}
|
|
1108
|
-
if (K > mCuspLimit) {
|
|
1109
|
-
R.push(P, F);
|
|
1110
|
-
return;
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
957
|
+
function I(e, t, n, r, i, a, o, s, c, l, u) {
|
|
958
|
+
if (u > De) return;
|
|
959
|
+
let d = (e + n) / 2, f = (t + r) / 2, p = (n + i) / 2, m = (r + a) / 2, h = (i + o) / 2, g = (a + s) / 2, _ = (d + p) / 2, v = (f + m) / 2, y = (p + h) / 2, b = (m + g) / 2, x = (_ + y) / 2, S = (v + b) / 2;
|
|
960
|
+
if (u > 0) {
|
|
961
|
+
let u = o - e, d = s - t, f = Math.abs((n - o) * d - (r - s) * u), p = Math.abs((i - o) * d - (a - s) * u);
|
|
962
|
+
if (f > F && p > F) {
|
|
963
|
+
if ((f + p) * (f + p) <= l * (u * u + d * d)) {
|
|
964
|
+
c.push(x, S);
|
|
965
|
+
return;
|
|
1113
966
|
}
|
|
1114
|
-
} else if (
|
|
1115
|
-
if (
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
return;
|
|
1119
|
-
}
|
|
1120
|
-
if (G = Math.abs(Math.atan2(F - N, P - M) - Math.atan2(N - j, M - n)), G >= V && (G = 2 * V - G), G < mAngleTolerance) {
|
|
1121
|
-
R.push(M, N), R.push(P, F);
|
|
1122
|
-
return;
|
|
1123
|
-
}
|
|
1124
|
-
if (mCuspLimit !== 0 && G > mCuspLimit) {
|
|
1125
|
-
R.push(M, N);
|
|
1126
|
-
return;
|
|
1127
|
-
}
|
|
967
|
+
} else if (f > F) {
|
|
968
|
+
if (f * f <= l * (u * u + d * d)) {
|
|
969
|
+
c.push(x, S);
|
|
970
|
+
return;
|
|
1128
971
|
}
|
|
1129
|
-
} else if (
|
|
1130
|
-
if (
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
if (G = Math.abs(Math.atan2(L - F, I - P) - Math.atan2(F - N, P - M)), G >= V && (G = 2 * V - G), G < mAngleTolerance) {
|
|
1136
|
-
R.push(M, N), R.push(P, F);
|
|
1137
|
-
return;
|
|
1138
|
-
}
|
|
1139
|
-
if (mCuspLimit !== 0 && G > mCuspLimit) {
|
|
1140
|
-
R.push(P, F);
|
|
1141
|
-
return;
|
|
1142
|
-
}
|
|
972
|
+
} else if (p > F) {
|
|
973
|
+
if (p * p <= l * (u * u + d * d)) {
|
|
974
|
+
c.push(x, S);
|
|
975
|
+
return;
|
|
1143
976
|
}
|
|
1144
|
-
} else if (
|
|
1145
|
-
|
|
977
|
+
} else if (u = x - (e + o) / 2, d = S - (t + s) / 2, u * u + d * d <= l) {
|
|
978
|
+
c.push(x, S);
|
|
1146
979
|
return;
|
|
1147
980
|
}
|
|
1148
981
|
}
|
|
1149
|
-
|
|
982
|
+
I(e, t, d, f, _, v, x, S, c, l, u + 1), I(x, S, y, b, h, g, o, s, c, l, u + 1);
|
|
1150
983
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
984
|
+
//#endregion
|
|
985
|
+
//#region lib/scene/graphics/path/ShapePath.ts
|
|
986
|
+
var je = new y(), Me = class {
|
|
987
|
+
constructor(e) {
|
|
988
|
+
f(this, "_currentPoly", void 0), f(this, "shapePrimitives", []), f(this, "_graphicsPath", void 0), f(this, "_bounds", new w()), this._graphicsPath = e;
|
|
1154
989
|
}
|
|
1155
|
-
_ensurePoly(
|
|
1156
|
-
this._currentPoly || (this._currentPoly = new
|
|
990
|
+
_ensurePoly(e = !0) {
|
|
991
|
+
this._currentPoly || (this._currentPoly = new Ee(), e && this._currentPoly.points.push(0, 0));
|
|
1157
992
|
}
|
|
1158
|
-
lineTo(
|
|
993
|
+
lineTo(e, t) {
|
|
1159
994
|
this._ensurePoly();
|
|
1160
|
-
let
|
|
1161
|
-
return (
|
|
995
|
+
let n = this._currentPoly.points, r = n[n.length - 2], i = n[n.length - 1];
|
|
996
|
+
return (r !== e || i !== t) && n.push(e, t), this;
|
|
1162
997
|
}
|
|
1163
|
-
rect(
|
|
1164
|
-
return this.drawShape(new
|
|
998
|
+
rect(e, t, n, r) {
|
|
999
|
+
return this.drawShape(new y(e, t, n, r)), this;
|
|
1165
1000
|
}
|
|
1166
|
-
drawShape(
|
|
1167
|
-
return this.endPloy(), this.shapePrimitives.push({ shape:
|
|
1001
|
+
drawShape(e) {
|
|
1002
|
+
return this.endPloy(), this.shapePrimitives.push({ shape: e }), this;
|
|
1168
1003
|
}
|
|
1169
|
-
moveTo(
|
|
1170
|
-
return this.startPoly(
|
|
1004
|
+
moveTo(e, t) {
|
|
1005
|
+
return this.startPoly(e, t), this;
|
|
1171
1006
|
}
|
|
1172
|
-
bezierCurveTo(
|
|
1007
|
+
bezierCurveTo(e, t, n, r, i, a, o) {
|
|
1173
1008
|
this._ensurePoly();
|
|
1174
|
-
let
|
|
1175
|
-
return
|
|
1009
|
+
let s = this._currentPoly.points;
|
|
1010
|
+
return ke(s, this._currentPoly.lastX, this._currentPoly.lastY, e, t, n, r, i, a, o), this;
|
|
1176
1011
|
}
|
|
1177
|
-
startPoly(
|
|
1178
|
-
return this._currentPoly && this.endPloy(), this._currentPoly = new
|
|
1012
|
+
startPoly(e, t) {
|
|
1013
|
+
return this._currentPoly && this.endPloy(), this._currentPoly = new Ee(), this._currentPoly.points.push(e, t), this;
|
|
1179
1014
|
}
|
|
1180
|
-
endPloy(
|
|
1181
|
-
let
|
|
1182
|
-
|
|
1015
|
+
endPloy(e = !1) {
|
|
1016
|
+
let t = this._currentPoly;
|
|
1017
|
+
return t && t.points.length > 2 && (t.closePath = e, this.shapePrimitives.push({ shape: t })), this._currentPoly = null, this;
|
|
1183
1018
|
}
|
|
1184
1019
|
closePath() {
|
|
1185
1020
|
return this.endPloy(!0), this;
|
|
1186
1021
|
}
|
|
1187
1022
|
buildPath() {
|
|
1188
|
-
let
|
|
1189
|
-
for (let
|
|
1190
|
-
let
|
|
1191
|
-
this[
|
|
1023
|
+
let e = this._graphicsPath;
|
|
1024
|
+
for (let t = 0; t < e.instructions.length; ++t) {
|
|
1025
|
+
let n = e.instructions[t];
|
|
1026
|
+
this[n.action](...n.data);
|
|
1192
1027
|
}
|
|
1193
|
-
return this;
|
|
1028
|
+
return this.endPloy(!1), this;
|
|
1194
1029
|
}
|
|
1195
1030
|
get bounds() {
|
|
1196
|
-
let
|
|
1197
|
-
|
|
1198
|
-
let
|
|
1199
|
-
for (let
|
|
1200
|
-
let
|
|
1201
|
-
|
|
1031
|
+
let e = this._bounds;
|
|
1032
|
+
e.clear();
|
|
1033
|
+
let t = this.shapePrimitives;
|
|
1034
|
+
for (let n = 0; n < t.length; ++n) {
|
|
1035
|
+
let r = t[n].shape.getBounds(je);
|
|
1036
|
+
e.addRect(r);
|
|
1202
1037
|
}
|
|
1203
|
-
return
|
|
1038
|
+
return e;
|
|
1204
1039
|
}
|
|
1205
|
-
},
|
|
1040
|
+
}, Ne = class e {
|
|
1206
1041
|
constructor() {
|
|
1207
|
-
this
|
|
1042
|
+
f(this, "instructions", []), f(this, "_dirty", !0), f(this, "_shapePath", void 0);
|
|
1208
1043
|
}
|
|
1209
|
-
rect(
|
|
1044
|
+
rect(e, t, n, r) {
|
|
1210
1045
|
return this.instructions.push({
|
|
1211
1046
|
action: "rect",
|
|
1212
1047
|
data: [
|
|
1048
|
+
e,
|
|
1049
|
+
t,
|
|
1213
1050
|
n,
|
|
1214
|
-
|
|
1215
|
-
M,
|
|
1216
|
-
N
|
|
1051
|
+
r
|
|
1217
1052
|
]
|
|
1218
1053
|
}), this._dirty = !0, this;
|
|
1219
1054
|
}
|
|
1220
|
-
lineTo(...
|
|
1055
|
+
lineTo(...e) {
|
|
1221
1056
|
return this.instructions.push({
|
|
1222
1057
|
action: "lineTo",
|
|
1223
|
-
data:
|
|
1058
|
+
data: e
|
|
1224
1059
|
}), this._dirty = !0, this;
|
|
1225
1060
|
}
|
|
1226
|
-
bezierCurveTo(...
|
|
1061
|
+
bezierCurveTo(...e) {
|
|
1227
1062
|
return this.instructions.push({
|
|
1228
1063
|
action: "bezierCurveTo",
|
|
1229
|
-
data:
|
|
1064
|
+
data: e
|
|
1230
1065
|
}), this;
|
|
1231
1066
|
}
|
|
1232
|
-
moveTo(...
|
|
1067
|
+
moveTo(...e) {
|
|
1233
1068
|
return this.instructions.push({
|
|
1234
1069
|
action: "moveTo",
|
|
1235
|
-
data:
|
|
1070
|
+
data: e
|
|
1236
1071
|
}), this;
|
|
1237
1072
|
}
|
|
1238
1073
|
closePath() {
|
|
@@ -1242,22 +1077,22 @@ var ShapePath = class {
|
|
|
1242
1077
|
}), this._dirty = !0, this;
|
|
1243
1078
|
}
|
|
1244
1079
|
get shapePath() {
|
|
1245
|
-
return this._shapePath || (this._shapePath = new
|
|
1080
|
+
return this._shapePath || (this._shapePath = new Me(this)), this._dirty && (this._dirty = !1, this._shapePath.buildPath()), this._shapePath;
|
|
1246
1081
|
}
|
|
1247
1082
|
get bounds() {
|
|
1248
1083
|
return this.shapePath.bounds;
|
|
1249
1084
|
}
|
|
1250
1085
|
getLastPoint() {
|
|
1251
|
-
let
|
|
1252
|
-
if (!
|
|
1086
|
+
let e = this.instructions.length - 1, t = this.instructions[e];
|
|
1087
|
+
if (!t) return {
|
|
1253
1088
|
x: 0,
|
|
1254
1089
|
y: 0
|
|
1255
1090
|
};
|
|
1256
|
-
switch (
|
|
1091
|
+
switch (t.action) {
|
|
1257
1092
|
case "moveTo":
|
|
1258
1093
|
case "lineTo": return {
|
|
1259
|
-
x:
|
|
1260
|
-
y:
|
|
1094
|
+
x: t.data[0],
|
|
1095
|
+
y: t.data[1]
|
|
1261
1096
|
};
|
|
1262
1097
|
}
|
|
1263
1098
|
return {
|
|
@@ -1269,15 +1104,77 @@ var ShapePath = class {
|
|
|
1269
1104
|
this.instructions.length = 0, this._dirty = !0;
|
|
1270
1105
|
}
|
|
1271
1106
|
clone() {
|
|
1272
|
-
let
|
|
1273
|
-
return
|
|
1107
|
+
let t = new e();
|
|
1108
|
+
return t.instructions = this.instructions.slice(), t;
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
//#endregion
|
|
1112
|
+
//#region lib/utils/color.ts
|
|
1113
|
+
function Pe(e) {
|
|
1114
|
+
let t = e.replace("#", ""), n = t;
|
|
1115
|
+
t.length === 4 && (n = t.split("").map((e) => e + e).join(""));
|
|
1116
|
+
let r = n.substring(0, 2), i = n.substring(2, 4), a = n.substring(4, 6), o = n.substring(6, 8) || "ff", s = Number.parseInt(r, 16), c = Number.parseInt(i, 16), l = Number.parseInt(a, 16);
|
|
1117
|
+
return {
|
|
1118
|
+
r: s,
|
|
1119
|
+
g: c,
|
|
1120
|
+
b: l,
|
|
1121
|
+
a: +(Number.parseInt(o, 16) / 255).toFixed(2),
|
|
1122
|
+
rgb: `rgb(${s}, ${c}, ${l})`,
|
|
1123
|
+
hex: `#${r}${i}${a}`
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
//#endregion
|
|
1127
|
+
//#region lib/scene/graphics/utils/convertInputToStyle.ts
|
|
1128
|
+
function L(e, t) {
|
|
1129
|
+
return {
|
|
1130
|
+
...t,
|
|
1131
|
+
...e
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
function Fe(e, t) {
|
|
1135
|
+
if (e == null) return null;
|
|
1136
|
+
let n = {
|
|
1137
|
+
...t,
|
|
1138
|
+
...e
|
|
1139
|
+
};
|
|
1140
|
+
if (n.color.startsWith("#")) {
|
|
1141
|
+
let { a: e, hex: t } = Pe(n.color);
|
|
1142
|
+
n.alpha *= e, n.color = t;
|
|
1274
1143
|
}
|
|
1275
|
-
|
|
1144
|
+
return n;
|
|
1145
|
+
}
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region lib/scene/graphics/utils/getMaxMiterRatio.ts
|
|
1148
|
+
function Ie(e, t) {
|
|
1149
|
+
let n = 1, r = e.shapePath.shapePrimitives;
|
|
1150
|
+
for (let e = 0; e < r.length; e++) {
|
|
1151
|
+
let i = r[e].shape;
|
|
1152
|
+
if (i.type !== "polygon") continue;
|
|
1153
|
+
let a = i.points, o = a.length;
|
|
1154
|
+
if (o < 6) continue;
|
|
1155
|
+
let s = i.closePath;
|
|
1156
|
+
for (let e = 0; e < o; e += 2) {
|
|
1157
|
+
if (!s && (e === 0 || e === o - 2)) continue;
|
|
1158
|
+
let r = (e - 2 + o) % o, i = (e + 2) % o, c = a[r], l = a[r + 1], u = a[e], d = a[e + 1], f = a[i], p = a[i + 1], m = c - u, h = l - d, g = f - u, _ = p - d, v = m * m + h * h, y = g * g + _ * _;
|
|
1159
|
+
if (v < 1e-12 || y < 1e-12) continue;
|
|
1160
|
+
let b = (m * g + h * _) / Math.sqrt(v * y);
|
|
1161
|
+
b < -1 ? b = -1 : b > 1 && (b = 1);
|
|
1162
|
+
let x = Math.sqrt((1 - b) * .5);
|
|
1163
|
+
if (x < 1e-6) continue;
|
|
1164
|
+
let S = Math.min(1 / x, t);
|
|
1165
|
+
S > n && (n = S);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
return n;
|
|
1169
|
+
}
|
|
1170
|
+
//#endregion
|
|
1171
|
+
//#region lib/scene/graphics/GraphicsContext.ts
|
|
1172
|
+
var R = class e {
|
|
1276
1173
|
constructor() {
|
|
1277
|
-
this._activePath
|
|
1174
|
+
f(this, "_strokeStyle", { ...e.defaultStrokeStyle }), f(this, "_fillStyle", { ...e.defaultFillStyle }), f(this, "_activePath", new Ne()), f(this, "_bounds", new w()), f(this, "_boundsDirty", !0), f(this, "_tick", 0), f(this, "instructions", []);
|
|
1278
1175
|
}
|
|
1279
|
-
setStrokeStyle(
|
|
1280
|
-
this._strokeStyle =
|
|
1176
|
+
setStrokeStyle(t) {
|
|
1177
|
+
this._strokeStyle = L(t, e.defaultStrokeStyle);
|
|
1281
1178
|
}
|
|
1282
1179
|
clear() {
|
|
1283
1180
|
return this._activePath.clear(), this.instructions.length = 0, this.onUpdate(), this;
|
|
@@ -1285,75 +1182,106 @@ var ShapePath = class {
|
|
|
1285
1182
|
onUpdate() {
|
|
1286
1183
|
this._boundsDirty = !0;
|
|
1287
1184
|
}
|
|
1288
|
-
moveTo(
|
|
1289
|
-
return this._activePath.moveTo(
|
|
1185
|
+
moveTo(e, t) {
|
|
1186
|
+
return ++this._tick, this._activePath.moveTo(e, t), this;
|
|
1290
1187
|
}
|
|
1291
|
-
lineTo(
|
|
1292
|
-
return this._activePath.lineTo(
|
|
1188
|
+
lineTo(e, t) {
|
|
1189
|
+
return ++this._tick, this._activePath.lineTo(e, t), this;
|
|
1293
1190
|
}
|
|
1294
|
-
bezierCurveTo(
|
|
1295
|
-
return this._activePath.bezierCurveTo(
|
|
1191
|
+
bezierCurveTo(e, t, n, r, i, a, o) {
|
|
1192
|
+
return ++this._tick, this._activePath.bezierCurveTo(e, t, n, r, i, a, o), this;
|
|
1296
1193
|
}
|
|
1297
|
-
rect(
|
|
1298
|
-
return this._activePath.rect(
|
|
1194
|
+
rect(e, t, n, r) {
|
|
1195
|
+
return ++this._tick, this._activePath.rect(e, t, n, r), this;
|
|
1299
1196
|
}
|
|
1300
1197
|
beginPath() {
|
|
1301
|
-
return this._activePath = new
|
|
1198
|
+
return this._activePath = new Ne(), this;
|
|
1302
1199
|
}
|
|
1303
1200
|
closePath() {
|
|
1304
|
-
return this._activePath.closePath(), this;
|
|
1201
|
+
return ++this._tick, this._activePath.closePath(), this;
|
|
1305
1202
|
}
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1203
|
+
get fillStyle() {
|
|
1204
|
+
return this._fillStyle;
|
|
1205
|
+
}
|
|
1206
|
+
set fillStyle(t) {
|
|
1207
|
+
this._fillStyle = Fe(t, e.defaultFillStyle);
|
|
1208
|
+
}
|
|
1209
|
+
get strokeStyle() {
|
|
1210
|
+
return this._strokeStyle;
|
|
1211
|
+
}
|
|
1212
|
+
set strokeStyle(t) {
|
|
1213
|
+
this._strokeStyle = L(t, e.defaultStrokeStyle);
|
|
1214
|
+
}
|
|
1215
|
+
fill(t) {
|
|
1216
|
+
let n = this.instructions[this.instructions.length - 1], r;
|
|
1217
|
+
return r = this._tick === 0 && (n == null ? void 0 : n.action) === "stroke" ? n.data.path : this._activePath.clone(), r ? (t != null && (this._fillStyle = Fe(t, e.defaultFillStyle)), this.instructions.push({
|
|
1312
1218
|
action: "fill",
|
|
1313
1219
|
data: {
|
|
1314
|
-
style:
|
|
1315
|
-
path:
|
|
1220
|
+
style: this.fillStyle,
|
|
1221
|
+
path: r
|
|
1316
1222
|
}
|
|
1317
|
-
}), this;
|
|
1223
|
+
}), this.onUpdate(), this._initNextPathLocation(), this._tick = 0, this) : this;
|
|
1318
1224
|
}
|
|
1319
|
-
stroke() {
|
|
1320
|
-
this.instructions.
|
|
1225
|
+
stroke(t) {
|
|
1226
|
+
let n, r = this.instructions[this.instructions.length - 1];
|
|
1227
|
+
return n = this._tick === 0 && (r == null ? void 0 : r.action) === "fill" ? r.data.path : this._activePath.clone(), n ? (t != null && (this._strokeStyle = L(t, e.defaultStrokeStyle)), this.instructions.push({
|
|
1321
1228
|
action: "stroke",
|
|
1322
1229
|
data: {
|
|
1323
|
-
style: this.
|
|
1324
|
-
path:
|
|
1230
|
+
style: this.strokeStyle,
|
|
1231
|
+
path: n
|
|
1325
1232
|
}
|
|
1326
|
-
}), this._initNextPathLocation();
|
|
1233
|
+
}), this.onUpdate(), this._initNextPathLocation(), this._tick = 0, this) : this;
|
|
1327
1234
|
}
|
|
1328
1235
|
_initNextPathLocation() {
|
|
1329
|
-
let { x:
|
|
1330
|
-
this._activePath.clear(), this._activePath.moveTo(
|
|
1236
|
+
let { x: e, y: t } = this._activePath.getLastPoint();
|
|
1237
|
+
this._activePath.clear(), this._activePath.moveTo(e, t);
|
|
1331
1238
|
}
|
|
1332
1239
|
get bounds() {
|
|
1333
1240
|
if (!this._boundsDirty) return this._bounds;
|
|
1334
1241
|
this._boundsDirty = !1;
|
|
1335
|
-
let
|
|
1336
|
-
|
|
1337
|
-
for (let
|
|
1338
|
-
let
|
|
1339
|
-
if (
|
|
1340
|
-
let
|
|
1341
|
-
|
|
1342
|
-
} else if (
|
|
1343
|
-
let
|
|
1344
|
-
|
|
1345
|
-
let
|
|
1346
|
-
|
|
1242
|
+
let e = this._bounds;
|
|
1243
|
+
e.clear();
|
|
1244
|
+
for (let t = 0; t < this.instructions.length; ++t) {
|
|
1245
|
+
let n = this.instructions[t], r = n.action;
|
|
1246
|
+
if (r === "fill") {
|
|
1247
|
+
let t = n.data;
|
|
1248
|
+
e.addBounds(t.path.bounds);
|
|
1249
|
+
} else if (r === "stroke") {
|
|
1250
|
+
let t = n.data, r = t.style.alignment, i = t.style.width * (1 - r);
|
|
1251
|
+
t.style.join === "miter" && (i *= Ie(t.path, t.style.miterLimit));
|
|
1252
|
+
let a = t.path.bounds;
|
|
1253
|
+
e.addFrame(a.minX - i, a.minY - i, a.maxX + i, a.maxY + i);
|
|
1347
1254
|
}
|
|
1348
1255
|
}
|
|
1349
|
-
return
|
|
1256
|
+
return e.isValid || e.set(0, 0, 0, 0), e;
|
|
1257
|
+
}
|
|
1258
|
+
containsPoint(e) {
|
|
1259
|
+
if (!this.bounds.containsPoint(e.x, e.y)) return !1;
|
|
1260
|
+
let t = this.instructions, n = !1;
|
|
1261
|
+
for (let r = 0; r < t.length; ++r) {
|
|
1262
|
+
let i = t[r], a = i.data, o = a.path;
|
|
1263
|
+
if (!i.action || !o) continue;
|
|
1264
|
+
let s = a.style, c = o.shapePath.shapePrimitives;
|
|
1265
|
+
for (let t = 0; t < c.length; ++t) {
|
|
1266
|
+
let t = c[r].shape;
|
|
1267
|
+
if (!s || !t) continue;
|
|
1268
|
+
let a = e;
|
|
1269
|
+
if (i.action === "fill") n = t.contains(a.x, a.y);
|
|
1270
|
+
else {
|
|
1271
|
+
let e = s;
|
|
1272
|
+
n = t.strokeContains(a.x, a.y, e.width, e.alignment);
|
|
1273
|
+
}
|
|
1274
|
+
if (n) return !0;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return n;
|
|
1350
1278
|
}
|
|
1351
1279
|
clone() {
|
|
1352
|
-
let
|
|
1353
|
-
return
|
|
1280
|
+
let t = new e();
|
|
1281
|
+
return t.instructions = this.instructions.slice(), t._activePath = this._activePath.clone(), t._bounds = this._bounds.clone(), t._strokeStyle = { ...this._strokeStyle }, t;
|
|
1354
1282
|
}
|
|
1355
1283
|
};
|
|
1356
|
-
|
|
1284
|
+
f(R, "defaultStrokeStyle", {
|
|
1357
1285
|
width: 1,
|
|
1358
1286
|
color: "#ffffff",
|
|
1359
1287
|
alignment: .5,
|
|
@@ -1362,45 +1290,56 @@ _GraphicsContext = GraphicsContext, _GraphicsContext.defaultStrokeStyle = {
|
|
|
1362
1290
|
join: "miter",
|
|
1363
1291
|
pixelLine: !1,
|
|
1364
1292
|
alpha: 1
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
let { context: j, ...M } = n || {};
|
|
1293
|
+
}), f(R, "defaultFillStyle", {
|
|
1294
|
+
color: "#ffffff",
|
|
1295
|
+
alpha: 1
|
|
1296
|
+
});
|
|
1297
|
+
//#endregion
|
|
1298
|
+
//#region lib/scene/graphics/Graphics.ts
|
|
1299
|
+
var Le = class extends P {
|
|
1300
|
+
constructor(e) {
|
|
1301
|
+
e instanceof R && (e = { context: e });
|
|
1302
|
+
let { context: t, ...n } = e || {};
|
|
1376
1303
|
super({
|
|
1377
1304
|
label: "Graphics",
|
|
1378
|
-
...
|
|
1379
|
-
}), this
|
|
1305
|
+
...n
|
|
1306
|
+
}), f(this, "renderPipeId", "graphics"), f(this, "_context", void 0), t ? this.context = t : this.context = new R(), this.didViewUpdate = !0;
|
|
1380
1307
|
}
|
|
1381
1308
|
get context() {
|
|
1382
1309
|
return this._context;
|
|
1383
1310
|
}
|
|
1384
|
-
set context(
|
|
1385
|
-
|
|
1311
|
+
set context(e) {
|
|
1312
|
+
e !== this._context && (this._context = e, this.onViewUpdate());
|
|
1386
1313
|
}
|
|
1387
|
-
|
|
1388
|
-
return this.
|
|
1314
|
+
get fillStyle() {
|
|
1315
|
+
return this._context.fillStyle;
|
|
1389
1316
|
}
|
|
1390
|
-
|
|
1391
|
-
|
|
1317
|
+
set fillStyle(e) {
|
|
1318
|
+
this._context.fillStyle = e;
|
|
1392
1319
|
}
|
|
1393
|
-
|
|
1394
|
-
return this.
|
|
1320
|
+
get strokeStyle() {
|
|
1321
|
+
return this._context.strokeStyle;
|
|
1395
1322
|
}
|
|
1396
|
-
|
|
1397
|
-
|
|
1323
|
+
set strokeStyle(e) {
|
|
1324
|
+
this._context.strokeStyle = e;
|
|
1398
1325
|
}
|
|
1399
|
-
|
|
1400
|
-
return this._callContextMethod("
|
|
1326
|
+
setStrokeStyle(...e) {
|
|
1327
|
+
return this._callContextMethod("setStrokeStyle", e);
|
|
1401
1328
|
}
|
|
1402
|
-
|
|
1403
|
-
return this._callContextMethod("
|
|
1329
|
+
rect(...e) {
|
|
1330
|
+
return this._callContextMethod("rect", e);
|
|
1331
|
+
}
|
|
1332
|
+
bezierCurveTo(...e) {
|
|
1333
|
+
return this._callContextMethod("bezierCurveTo", e);
|
|
1334
|
+
}
|
|
1335
|
+
lineTo(...e) {
|
|
1336
|
+
return this._callContextMethod("lineTo", e);
|
|
1337
|
+
}
|
|
1338
|
+
moveTo(...e) {
|
|
1339
|
+
return this._callContextMethod("moveTo", e);
|
|
1340
|
+
}
|
|
1341
|
+
stroke(...e) {
|
|
1342
|
+
return this._callContextMethod("stroke", e);
|
|
1404
1343
|
}
|
|
1405
1344
|
beginPath() {
|
|
1406
1345
|
return this._callContextMethod("beginPath", []);
|
|
@@ -1408,11 +1347,11 @@ var Graphics = class extends ViewContainer {
|
|
|
1408
1347
|
closePath() {
|
|
1409
1348
|
return this._callContextMethod("closePath", []);
|
|
1410
1349
|
}
|
|
1411
|
-
fill(
|
|
1412
|
-
return this._callContextMethod("fill",
|
|
1350
|
+
fill(...e) {
|
|
1351
|
+
return this._callContextMethod("fill", e);
|
|
1413
1352
|
}
|
|
1414
|
-
_callContextMethod(
|
|
1415
|
-
return this.context[
|
|
1353
|
+
_callContextMethod(e, t) {
|
|
1354
|
+
return this.context[e](...t), this;
|
|
1416
1355
|
}
|
|
1417
1356
|
updateBounds() {}
|
|
1418
1357
|
get bounds() {
|
|
@@ -1421,153 +1360,213 @@ var Graphics = class extends ViewContainer {
|
|
|
1421
1360
|
clear() {
|
|
1422
1361
|
return this._callContextMethod("clear", []);
|
|
1423
1362
|
}
|
|
1424
|
-
},
|
|
1425
|
-
constructor(
|
|
1426
|
-
this._renderer =
|
|
1363
|
+
}, z = class {
|
|
1364
|
+
constructor(e) {
|
|
1365
|
+
f(this, "_renderer", void 0), this._renderer = e;
|
|
1427
1366
|
}
|
|
1428
|
-
addRenderable(
|
|
1429
|
-
this._renderer.renderPipes.batch.break(
|
|
1367
|
+
addRenderable(e, t) {
|
|
1368
|
+
this._renderer.renderPipes.batch.break(t), t.add(e);
|
|
1430
1369
|
}
|
|
1431
|
-
validateRenderable(
|
|
1370
|
+
validateRenderable(e) {
|
|
1432
1371
|
return !1;
|
|
1433
1372
|
}
|
|
1434
|
-
execute(
|
|
1435
|
-
let
|
|
1436
|
-
if (!(
|
|
1437
|
-
|
|
1438
|
-
for (let
|
|
1439
|
-
let
|
|
1440
|
-
if (
|
|
1441
|
-
|
|
1442
|
-
let
|
|
1443
|
-
if (
|
|
1444
|
-
let
|
|
1445
|
-
|
|
1446
|
-
} else
|
|
1447
|
-
let
|
|
1448
|
-
for (let
|
|
1449
|
-
let
|
|
1450
|
-
|
|
1373
|
+
execute(e) {
|
|
1374
|
+
let t = this._renderer, n = t.canvasContext, r = n.activeConext, i = t.roundPixels, a = (e.groupColorAlpha >>> 24 & 255) / 255;
|
|
1375
|
+
if (!(a <= 0)) {
|
|
1376
|
+
r.save(), n.setContextTransform(e.relativeGroupTransform, i);
|
|
1377
|
+
for (let t = 0; t < e.context.instructions.length; ++t) {
|
|
1378
|
+
let n = e.context.instructions[t], i = n.data.style, o = i.alpha * a;
|
|
1379
|
+
if (o <= 0) continue;
|
|
1380
|
+
r.globalAlpha = o;
|
|
1381
|
+
let s = n.action === "stroke";
|
|
1382
|
+
if (s) {
|
|
1383
|
+
let e = i.color;
|
|
1384
|
+
r.lineWidth = i.width, r.lineCap = i.cap, r.lineJoin = i.join, r.miterLimit = i.miterLimit, r.strokeStyle = e;
|
|
1385
|
+
} else r.fillStyle = n.data.style.color;
|
|
1386
|
+
let c = n.data.path.shapePath.shapePrimitives;
|
|
1387
|
+
for (let e = 0; e < c.length; ++e) {
|
|
1388
|
+
let t = c[e];
|
|
1389
|
+
t.shape && (r.beginPath(), B(r, t.shape), s ? r.stroke() : r.fill());
|
|
1451
1390
|
}
|
|
1452
1391
|
}
|
|
1453
|
-
|
|
1392
|
+
r.restore();
|
|
1454
1393
|
}
|
|
1455
1394
|
}
|
|
1456
1395
|
destroy() {
|
|
1457
1396
|
this._renderer = null;
|
|
1458
1397
|
}
|
|
1459
1398
|
};
|
|
1460
|
-
|
|
1461
|
-
function
|
|
1462
|
-
switch (
|
|
1399
|
+
f(z, "desc", { name: "graphics" });
|
|
1400
|
+
function B(e, t) {
|
|
1401
|
+
switch (t.type) {
|
|
1463
1402
|
case "rectangle": {
|
|
1464
|
-
let
|
|
1465
|
-
|
|
1403
|
+
let n = t;
|
|
1404
|
+
e.rect(n.x, n.y, n.width, n.height);
|
|
1466
1405
|
break;
|
|
1467
1406
|
}
|
|
1468
1407
|
case "polygon": {
|
|
1469
|
-
let
|
|
1470
|
-
if (!
|
|
1471
|
-
|
|
1472
|
-
for (let
|
|
1473
|
-
|
|
1408
|
+
let n = t, r = n.points;
|
|
1409
|
+
if (!r.length) return;
|
|
1410
|
+
e.moveTo(r[0], r[1]);
|
|
1411
|
+
for (let t = 2; t < r.length; t += 2) e.lineTo(r[t], r[t + 1]);
|
|
1412
|
+
n.closePath && e.closePath();
|
|
1474
1413
|
break;
|
|
1475
1414
|
}
|
|
1476
1415
|
}
|
|
1477
1416
|
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
this._activeBatch = new Batcher();
|
|
1491
|
-
}
|
|
1492
|
-
buildEnd(n) {
|
|
1493
|
-
this.break(n);
|
|
1494
|
-
}
|
|
1495
|
-
break(n) {
|
|
1496
|
-
this._activeBatch.build(n);
|
|
1417
|
+
//#endregion
|
|
1418
|
+
//#region lib/scene/mask/StencilMaskPipe.ts
|
|
1419
|
+
var Re = class {
|
|
1420
|
+
constructor(e) {
|
|
1421
|
+
f(this, "_renderer", void 0), f(this, "_canvasMaskStack", []), this._renderer = e;
|
|
1422
|
+
}
|
|
1423
|
+
push(e, t) {
|
|
1424
|
+
t.add({
|
|
1425
|
+
renderPipeId: "stencilMask",
|
|
1426
|
+
action: "pushMaskBegin",
|
|
1427
|
+
mask: e
|
|
1428
|
+
});
|
|
1497
1429
|
}
|
|
1498
|
-
|
|
1499
|
-
this.
|
|
1500
|
-
|
|
1501
|
-
|
|
1430
|
+
pop(e, t) {
|
|
1431
|
+
this._renderer.renderPipes.batch.break(t), t.add({
|
|
1432
|
+
renderPipeId: "stencilMask",
|
|
1433
|
+
action: "popMaskEnd",
|
|
1434
|
+
mask: e
|
|
1502
1435
|
});
|
|
1503
1436
|
}
|
|
1504
|
-
execute(
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
if (I <= 0) continue;
|
|
1511
|
-
N.globalAlpha = I, M.setContextTransform(P.transform, F === 1);
|
|
1512
|
-
let L = P.bounds, R = P.texture, z = R.frame, B = R.source._resolution || 1, V = z.x * B, H = z.y * B, U = z.width * B, W = z.height * B, G = L.minX, K = L.minY, q = L.maxX - L.minX, J = L.maxY - L.minY, Y = G, X = K, Z = q, Q = J;
|
|
1513
|
-
N.drawImage(R.source.resource, V, H, U, W, Y, X, Z, Q);
|
|
1437
|
+
execute(e) {
|
|
1438
|
+
if (e.action !== "pushMaskBegin" && e.action !== "popMaskEnd") return;
|
|
1439
|
+
let t = this._renderer.canvasContext, n = t.activeConext;
|
|
1440
|
+
if (e.action === "popMaskEnd") {
|
|
1441
|
+
this._canvasMaskStack.pop() && n.restore();
|
|
1442
|
+
return;
|
|
1514
1443
|
}
|
|
1444
|
+
let r = e.mask.mask, i = r.context.instructions, a = r._roundPixels === 1;
|
|
1445
|
+
n.save(), t.setContextTransform(r.relativeGroupTransform, a), n.beginPath();
|
|
1446
|
+
for (let e = 0; e < i.length; ++e) {
|
|
1447
|
+
let t = i[e], r = t.action;
|
|
1448
|
+
if (r !== "fill" && r !== "stroke") return;
|
|
1449
|
+
let a = t.data.path.shapePath.shapePrimitives;
|
|
1450
|
+
for (let e = 0; e < a.length; ++e) {
|
|
1451
|
+
let t = a[e].shape;
|
|
1452
|
+
B(n, t);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
n.clip(), this._canvasMaskStack.push(!0);
|
|
1515
1456
|
}
|
|
1516
1457
|
destroy() {
|
|
1517
|
-
|
|
1518
|
-
this._renderer = null, (n = this._activeBatch) == null || n.destroy(), this._activeBatch = null;
|
|
1458
|
+
this._renderer = null;
|
|
1519
1459
|
}
|
|
1520
1460
|
};
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1461
|
+
f(Re, "desc", { name: "stencilMask" });
|
|
1462
|
+
//#endregion
|
|
1463
|
+
//#region lib/scene/sprite/SpritePipe.ts
|
|
1464
|
+
var ze = class {
|
|
1465
|
+
constructor(e) {
|
|
1466
|
+
f(this, "_renderer", void 0), this._renderer = e;
|
|
1467
|
+
}
|
|
1468
|
+
addRenderable(e, t) {
|
|
1469
|
+
let n = this._getRuntimeSprite(e);
|
|
1470
|
+
e.didViewUpdate && this._updateBatchableSprite(e, n), this._renderer.renderPipes.batch.addToBatch(n, t);
|
|
1471
|
+
}
|
|
1472
|
+
_updateBatchableSprite(e, t) {
|
|
1473
|
+
t.texture = e._texture, t.bounds = e.bounds;
|
|
1474
|
+
}
|
|
1475
|
+
validateRenderable(e) {
|
|
1476
|
+
return this._getRuntimeSprite(e).texture._source.uid !== e._texture._source.uid;
|
|
1477
|
+
}
|
|
1478
|
+
_getRuntimeSprite(e) {
|
|
1479
|
+
return e._runtimeData[this._renderer.uid] || this._initCacheSprite(e);
|
|
1480
|
+
}
|
|
1481
|
+
_initCacheSprite(e) {
|
|
1482
|
+
let t = {
|
|
1483
|
+
renderable: e,
|
|
1484
|
+
texture: e.texture,
|
|
1485
|
+
transform: e.relativeGroupTransform,
|
|
1486
|
+
bounds: e.bounds,
|
|
1487
|
+
roundPixels: this._renderer._roundPixels | e._roundPixels,
|
|
1488
|
+
destroy() {
|
|
1489
|
+
this.renderable = null, this.texture = null, this.transform = null, this.bounds = null;
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
return e._runtimeData[this._renderer.uid] = t, t;
|
|
1525
1493
|
}
|
|
1526
|
-
|
|
1527
|
-
this.
|
|
1494
|
+
destroy() {
|
|
1495
|
+
this._renderer = null;
|
|
1528
1496
|
}
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1497
|
+
};
|
|
1498
|
+
f(ze, "desc", { name: "sprite" });
|
|
1499
|
+
//#endregion
|
|
1500
|
+
//#region lib/scene/text/TextPipe.ts
|
|
1501
|
+
var V = class {
|
|
1502
|
+
constructor(e) {
|
|
1503
|
+
f(this, "_renderer", void 0), this._renderer = e;
|
|
1504
|
+
}
|
|
1505
|
+
addRenderable(e, t) {
|
|
1506
|
+
let n = this._getRuntimeText(e);
|
|
1507
|
+
if (e._didTextUpdate) {
|
|
1508
|
+
let t = e._autoResolution ? this._renderer.resolution : e.resolution;
|
|
1509
|
+
(n.currentKey !== e.styleKey || e._resolution !== t) && this._updateRuntimeText(e), e._didTextUpdate = !1, ae(n.bounds, e._anchor, n.texture);
|
|
1537
1510
|
}
|
|
1511
|
+
this._renderer.renderPipes.batch.addToBatch(n, t);
|
|
1512
|
+
}
|
|
1513
|
+
validateRenderable(e) {
|
|
1514
|
+
let t = this._getRuntimeText(e), n = e.styleKey;
|
|
1515
|
+
return t.currentKey === n ? e._didTextUpdate : !0;
|
|
1516
|
+
}
|
|
1517
|
+
initCacheText(e) {
|
|
1518
|
+
let t = {
|
|
1519
|
+
currentKey: "--",
|
|
1520
|
+
transform: e.relativeGroupTransform,
|
|
1521
|
+
bounds: e.bounds,
|
|
1522
|
+
roundPixels: this._renderer._roundPixels | e._roundPixels,
|
|
1523
|
+
renderable: e,
|
|
1524
|
+
texture: null,
|
|
1525
|
+
destroy() {
|
|
1526
|
+
this.renderable = null, this.texture = null, this.bounds = null;
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
return e._runtimeData[this._renderer.uid] = t, t;
|
|
1530
|
+
}
|
|
1531
|
+
_getRuntimeText(e) {
|
|
1532
|
+
return e._runtimeData[this._renderer.uid] || this.initCacheText(e);
|
|
1533
|
+
}
|
|
1534
|
+
_updateRuntimeText(e) {
|
|
1535
|
+
let t = this._getRuntimeText(e);
|
|
1536
|
+
t.texture, e._resolution = e._autoResolution ? this._renderer.resolution : e.resolution, t.texture = this._renderer.text.getManagedTexture(e), t.currentKey = e.styleKey;
|
|
1538
1537
|
}
|
|
1539
1538
|
destroy() {
|
|
1540
|
-
this.
|
|
1539
|
+
this._renderer = null;
|
|
1541
1540
|
}
|
|
1542
1541
|
};
|
|
1543
|
-
|
|
1542
|
+
f(V, "desc", { name: "text" });
|
|
1543
|
+
var Be = new class {
|
|
1544
1544
|
constructor() {
|
|
1545
|
-
this._canvasPool = Object.create(null);
|
|
1545
|
+
f(this, "_canvasPool", void 0), this._canvasPool = Object.create(null);
|
|
1546
1546
|
}
|
|
1547
|
-
getOptimalCanvasAndContext(
|
|
1548
|
-
let
|
|
1549
|
-
this._canvasPool[
|
|
1550
|
-
let
|
|
1551
|
-
if (
|
|
1547
|
+
getOptimalCanvasAndContext(e, t, n = 1) {
|
|
1548
|
+
let r = x(e * n - 1e-6), i = x(t * n - 1e-6), a = r << 17 + i << 1;
|
|
1549
|
+
this._canvasPool[a] || (this._canvasPool[a] = []);
|
|
1550
|
+
let o = this._canvasPool[a].pop();
|
|
1551
|
+
if (o) return o;
|
|
1552
1552
|
{
|
|
1553
|
-
let
|
|
1554
|
-
return
|
|
1555
|
-
canvas:
|
|
1556
|
-
context:
|
|
1553
|
+
let e = document.createElement("canvas");
|
|
1554
|
+
return e.width = r, e.height = i, {
|
|
1555
|
+
canvas: e,
|
|
1556
|
+
context: e.getContext("2d")
|
|
1557
1557
|
};
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
|
-
}()
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
...
|
|
1566
|
-
...j
|
|
1560
|
+
}(), H = class e {
|
|
1561
|
+
constructor(t) {
|
|
1562
|
+
f(this, "uid", D("textStyle")), f(this, "_cachedFontString", void 0), f(this, "_fontSize", void 0), f(this, "_fontFamily", void 0), f(this, "_fontStyle", void 0), f(this, "_lineHeight", void 0), f(this, "_leading", void 0), f(this, "_fontVariant", void 0), f(this, "_fontWeight", void 0), f(this, "_letterSpacing", void 0), f(this, "_textBaseline", void 0), f(this, "_align", void 0), f(this, "_wordWrap", void 0), f(this, "_fill", void 0), f(this, "_tick", 0);
|
|
1563
|
+
let n = {
|
|
1564
|
+
...e.defaultStyle,
|
|
1565
|
+
...t
|
|
1567
1566
|
};
|
|
1568
|
-
for (let
|
|
1569
|
-
let
|
|
1570
|
-
this[
|
|
1567
|
+
for (let e in n) {
|
|
1568
|
+
let t = e;
|
|
1569
|
+
this[t] = n[e];
|
|
1571
1570
|
}
|
|
1572
1571
|
}
|
|
1573
1572
|
get styleKey() {
|
|
@@ -1576,86 +1575,86 @@ var _TextStyle, TextStyle = class n {
|
|
|
1576
1575
|
get fontSize() {
|
|
1577
1576
|
return this._fontSize;
|
|
1578
1577
|
}
|
|
1579
|
-
set fontSize(
|
|
1580
|
-
this._fontSize !==
|
|
1578
|
+
set fontSize(e) {
|
|
1579
|
+
this._fontSize !== e && (this._fontSize = e, this.update());
|
|
1581
1580
|
}
|
|
1582
1581
|
get fill() {
|
|
1583
1582
|
return this._fill;
|
|
1584
1583
|
}
|
|
1585
|
-
set fill(
|
|
1586
|
-
this._fill !==
|
|
1584
|
+
set fill(e) {
|
|
1585
|
+
this._fill !== e && (this._fill = e, this.update());
|
|
1587
1586
|
}
|
|
1588
1587
|
get align() {
|
|
1589
1588
|
return this._align;
|
|
1590
1589
|
}
|
|
1591
|
-
set align(
|
|
1592
|
-
this._align !==
|
|
1590
|
+
set align(e) {
|
|
1591
|
+
this._align !== e && (this._align = e, this.update());
|
|
1593
1592
|
}
|
|
1594
|
-
get
|
|
1593
|
+
get wordWrap() {
|
|
1595
1594
|
return this._wordWrap;
|
|
1596
1595
|
}
|
|
1597
|
-
set wordWrap(
|
|
1598
|
-
this._wordWrap !==
|
|
1596
|
+
set wordWrap(e) {
|
|
1597
|
+
this._wordWrap !== e && (this._wordWrap = e, this.update());
|
|
1599
1598
|
}
|
|
1600
1599
|
get fontFamily() {
|
|
1601
1600
|
return this._fontFamily;
|
|
1602
1601
|
}
|
|
1603
|
-
set fontFamily(
|
|
1604
|
-
this._fontFamily !==
|
|
1602
|
+
set fontFamily(e) {
|
|
1603
|
+
this._fontFamily !== e && (this._fontFamily = e, this.update());
|
|
1605
1604
|
}
|
|
1606
1605
|
get leading() {
|
|
1607
1606
|
return this._leading;
|
|
1608
1607
|
}
|
|
1609
|
-
set leading(
|
|
1610
|
-
this._leading !==
|
|
1608
|
+
set leading(e) {
|
|
1609
|
+
this._leading !== e && (this._leading = e, this.update());
|
|
1611
1610
|
}
|
|
1612
1611
|
get fontStyle() {
|
|
1613
1612
|
return this._fontStyle;
|
|
1614
1613
|
}
|
|
1615
|
-
set fontStyle(
|
|
1616
|
-
this._fontStyle !==
|
|
1614
|
+
set fontStyle(e) {
|
|
1615
|
+
this._fontStyle !== e && (this._fontStyle = e.toLowerCase(), this.update());
|
|
1617
1616
|
}
|
|
1618
1617
|
get textBaseline() {
|
|
1619
1618
|
return this._textBaseline;
|
|
1620
1619
|
}
|
|
1621
|
-
set textBaseline(
|
|
1622
|
-
this._textBaseline =
|
|
1620
|
+
set textBaseline(e) {
|
|
1621
|
+
this._textBaseline = e, this.update();
|
|
1623
1622
|
}
|
|
1624
1623
|
get lineHeight() {
|
|
1625
1624
|
return this._lineHeight;
|
|
1626
1625
|
}
|
|
1627
|
-
set lineHeight(
|
|
1628
|
-
this._lineHeight !==
|
|
1626
|
+
set lineHeight(e) {
|
|
1627
|
+
this._lineHeight !== e && (this._lineHeight = e, this.update());
|
|
1629
1628
|
}
|
|
1630
1629
|
get letterSpacing() {
|
|
1631
1630
|
return this._letterSpacing;
|
|
1632
1631
|
}
|
|
1633
|
-
set letterSpacing(
|
|
1634
|
-
this._letterSpacing !==
|
|
1632
|
+
set letterSpacing(e) {
|
|
1633
|
+
this._letterSpacing !== e && (this._letterSpacing = e, this.update());
|
|
1635
1634
|
}
|
|
1636
1635
|
get fontVariant() {
|
|
1637
1636
|
return this._fontVariant;
|
|
1638
1637
|
}
|
|
1639
|
-
set fontVariant(
|
|
1640
|
-
this._fontVariant !==
|
|
1638
|
+
set fontVariant(e) {
|
|
1639
|
+
this._fontVariant !== e && (this._fontVariant = e, this.update());
|
|
1641
1640
|
}
|
|
1642
1641
|
get fontWeight() {
|
|
1643
1642
|
return this._fontWeight;
|
|
1644
1643
|
}
|
|
1645
|
-
set fontWeight(
|
|
1646
|
-
this._fontWeight !==
|
|
1644
|
+
set fontWeight(e) {
|
|
1645
|
+
this._fontWeight !== e && (this._fontWeight = e, this.update());
|
|
1647
1646
|
}
|
|
1648
1647
|
get _fontString() {
|
|
1649
|
-
return this._cachedFontString === null && (this._cachedFontString =
|
|
1648
|
+
return this._cachedFontString === null && (this._cachedFontString = He(this)), this._cachedFontString;
|
|
1650
1649
|
}
|
|
1651
1650
|
update() {
|
|
1652
1651
|
this._tick++, this._cachedFontString = null;
|
|
1653
1652
|
}
|
|
1654
|
-
destroy(
|
|
1653
|
+
destroy(e = !1) {
|
|
1655
1654
|
this._fill = null;
|
|
1656
1655
|
}
|
|
1657
1656
|
};
|
|
1658
|
-
|
|
1657
|
+
f(H, "defaultStyle", {
|
|
1659
1658
|
align: "left",
|
|
1660
1659
|
breakWords: !1,
|
|
1661
1660
|
dropShadow: null,
|
|
@@ -1675,8 +1674,8 @@ _TextStyle = TextStyle, _TextStyle.defaultStyle = {
|
|
|
1675
1674
|
whiteSpace: "pre",
|
|
1676
1675
|
wordWrap: !1,
|
|
1677
1676
|
wordWrapWidth: 100
|
|
1678
|
-
};
|
|
1679
|
-
var
|
|
1677
|
+
});
|
|
1678
|
+
var Ve = [
|
|
1680
1679
|
"serif",
|
|
1681
1680
|
"sans-serif",
|
|
1682
1681
|
"monospace",
|
|
@@ -1684,199 +1683,201 @@ var genericFontFamilies = [
|
|
|
1684
1683
|
"fantasy",
|
|
1685
1684
|
"system-ui"
|
|
1686
1685
|
];
|
|
1687
|
-
function
|
|
1688
|
-
let
|
|
1689
|
-
Array.isArray(
|
|
1690
|
-
for (let
|
|
1691
|
-
let
|
|
1692
|
-
!/([
|
|
1693
|
-
}
|
|
1694
|
-
return `${
|
|
1686
|
+
function He(e) {
|
|
1687
|
+
let t = typeof e.fontSize == "number" ? `${e.fontSize}px` : e.fontSize, n = e.fontFamily;
|
|
1688
|
+
Array.isArray(e.fontFamily) || (n = e.fontFamily.split(","));
|
|
1689
|
+
for (let e = n.length - 1; e >= 0; e--) {
|
|
1690
|
+
let t = n[e].trim();
|
|
1691
|
+
!/(["'])[^'"]+\1/.test(t) && !Ve.includes(t) && (t = `"${t}"`), n[e] = t;
|
|
1692
|
+
}
|
|
1693
|
+
return `${e.fontStyle} ${e.fontVariant} ${e.fontWeight} ${t} ${n.join(",")}`;
|
|
1695
1694
|
}
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
var
|
|
1699
|
-
constructor(
|
|
1700
|
-
this.text =
|
|
1695
|
+
//#endregion
|
|
1696
|
+
//#region lib/scene/text/utils.ts
|
|
1697
|
+
var Ue = /(?:\r\n|\r|\n)/, U = class e {
|
|
1698
|
+
constructor(e, t, n, r, i, a, o, s, c) {
|
|
1699
|
+
f(this, "text", void 0), f(this, "style", void 0), f(this, "width", void 0), f(this, "height", void 0), f(this, "lines", void 0), f(this, "lineWidths", void 0), f(this, "lineHeight", void 0), f(this, "maxLineWidth", void 0), f(this, "fontProperties", void 0), this.text = e, this.style = t, this.width = n, this.height = r, this.lines = i, this.lineWidths = a, this.lineHeight = o, this.maxLineWidth = s, this.fontProperties = c;
|
|
1701
1700
|
}
|
|
1702
1701
|
static get canvas() {
|
|
1703
|
-
if (!
|
|
1704
|
-
let
|
|
1702
|
+
if (!e._canvas) {
|
|
1703
|
+
let t;
|
|
1705
1704
|
try {
|
|
1706
|
-
let
|
|
1707
|
-
if (
|
|
1708
|
-
|
|
1709
|
-
} catch (
|
|
1710
|
-
|
|
1705
|
+
let n = new OffscreenCanvas(0, 0);
|
|
1706
|
+
if (n.getContext("2d", { willReadFrequently: !0 }).measureText) return e._canvas = n, n;
|
|
1707
|
+
t = W(10, 10);
|
|
1708
|
+
} catch (e) {
|
|
1709
|
+
t = W(10, 10);
|
|
1711
1710
|
}
|
|
1712
|
-
|
|
1711
|
+
e._canvas = t;
|
|
1713
1712
|
}
|
|
1714
|
-
return
|
|
1713
|
+
return e._canvas;
|
|
1715
1714
|
}
|
|
1716
1715
|
static get context() {
|
|
1717
|
-
return
|
|
1718
|
-
}
|
|
1719
|
-
static measureText(
|
|
1720
|
-
let
|
|
1721
|
-
if (
|
|
1722
|
-
let
|
|
1723
|
-
|
|
1724
|
-
let
|
|
1725
|
-
|
|
1726
|
-
let
|
|
1727
|
-
for (let
|
|
1728
|
-
let
|
|
1729
|
-
|
|
1716
|
+
return e._context || (e._context = e.canvas.getContext("2d", { willReadFrequently: !0 })), e._context;
|
|
1717
|
+
}
|
|
1718
|
+
static measureText(t, n) {
|
|
1719
|
+
let r = `${t}-${n.styleKey}`;
|
|
1720
|
+
if (e._measurementCache.has(r)) return e._measurementCache.get(r);
|
|
1721
|
+
let i = n._fontString, a = e.measureFont(i);
|
|
1722
|
+
a.fontSize === 0 && (a.fontSize = n.fontSize, a.ascent = n.fontSize, a.descent = 0);
|
|
1723
|
+
let o = e.context;
|
|
1724
|
+
o.font = i;
|
|
1725
|
+
let s = t.split(Ue), c = Array.from({ length: s.length }), l = 0;
|
|
1726
|
+
for (let t = 0; t < s.length; ++t) {
|
|
1727
|
+
let r = e._measureText(s[t], n.letterSpacing);
|
|
1728
|
+
c[t] = r, l = Math.max(l, r);
|
|
1730
1729
|
}
|
|
1731
|
-
let
|
|
1732
|
-
return
|
|
1733
|
-
}
|
|
1734
|
-
static _measureText(
|
|
1735
|
-
var
|
|
1736
|
-
let
|
|
1737
|
-
|
|
1738
|
-
let
|
|
1739
|
-
|
|
1740
|
-
let
|
|
1741
|
-
return
|
|
1742
|
-
}
|
|
1743
|
-
static measureFont(
|
|
1744
|
-
var
|
|
1745
|
-
if (
|
|
1746
|
-
let
|
|
1747
|
-
|
|
1748
|
-
let
|
|
1749
|
-
ascent:
|
|
1750
|
-
descent:
|
|
1751
|
-
fontSize:
|
|
1730
|
+
let u = n.lineHeight || a.fontSize, d = new e(t, n, l, Math.max(u, a.fontSize + (s.length - 1) * (u + n.leading)), s, c, u, l, a);
|
|
1731
|
+
return e._measurementCache.set(r, d), d;
|
|
1732
|
+
}
|
|
1733
|
+
static _measureText(t, n) {
|
|
1734
|
+
var r, i;
|
|
1735
|
+
let a = e.context;
|
|
1736
|
+
a.letterSpacing = "0px", a.textLetterSpacing = n;
|
|
1737
|
+
let o = a.measureText(t), s = o.width, c = 0;
|
|
1738
|
+
s > 0 && (c = (e.graphemeSegmenter(t).length - 1) * n, s += c);
|
|
1739
|
+
let l = -((r = o.actualBoundingBoxLeft) == null ? 0 : r), u = ((i = o.actualBoundingBoxRight) == null ? 0 : i) - l;
|
|
1740
|
+
return o.width > 0 && (u += c), Math.max(s, u);
|
|
1741
|
+
}
|
|
1742
|
+
static measureFont(t) {
|
|
1743
|
+
var n, r;
|
|
1744
|
+
if (e._fonts[t]) return e._fonts[t];
|
|
1745
|
+
let i = e.context;
|
|
1746
|
+
i.font = t;
|
|
1747
|
+
let a = i.measureText(e.METRICS_STRING + e.BASELINE_SYMBOL), o = (n = a.actualBoundingBoxAscent) == null ? 0 : n, s = (r = a.actualBoundingBoxDescent) == null ? 0 : r, c = {
|
|
1748
|
+
ascent: o,
|
|
1749
|
+
descent: s,
|
|
1750
|
+
fontSize: o + s
|
|
1752
1751
|
};
|
|
1753
|
-
return
|
|
1752
|
+
return e._fonts[t] = c, c;
|
|
1754
1753
|
}
|
|
1755
1754
|
};
|
|
1756
|
-
|
|
1757
|
-
var
|
|
1758
|
-
if (typeof ((
|
|
1759
|
-
let
|
|
1760
|
-
return (
|
|
1761
|
-
let
|
|
1762
|
-
for (let
|
|
1763
|
-
return
|
|
1755
|
+
f(U, "METRICS_STRING", "|ÉqÅ"), f(U, "BASELINE_SYMBOL", "M"), f(U, "_canvas", void 0), f(U, "_context", void 0), f(U, "_measurementCache", /* @__PURE__ */ new Map()), f(U, "_fonts", {}), f(U, "graphemeSegmenter", (() => {
|
|
1756
|
+
var e;
|
|
1757
|
+
if (typeof ((e = Intl) == null ? void 0 : e.Segmenter) == "function") {
|
|
1758
|
+
let e = new Intl.Segmenter();
|
|
1759
|
+
return (t) => {
|
|
1760
|
+
let n = e.segment(t), r = [], i = 0;
|
|
1761
|
+
for (let e of n) r[i++] = e.segment;
|
|
1762
|
+
return r;
|
|
1764
1763
|
};
|
|
1765
1764
|
}
|
|
1766
|
-
return (
|
|
1767
|
-
})();
|
|
1768
|
-
function
|
|
1769
|
-
let
|
|
1770
|
-
return
|
|
1765
|
+
return (e) => [...e];
|
|
1766
|
+
})());
|
|
1767
|
+
function W(e, t) {
|
|
1768
|
+
let n = document.createElement("canvas");
|
|
1769
|
+
return n.width = e, n.height = t, n;
|
|
1771
1770
|
}
|
|
1772
|
-
function
|
|
1773
|
-
let { text:
|
|
1774
|
-
return
|
|
1775
|
-
canvasAndContext:
|
|
1776
|
-
frame: new
|
|
1771
|
+
function We(e) {
|
|
1772
|
+
let { text: t, style: n, resolution: r = 1, padding: i = 0 } = e, a = U.measureText(t, n), o = Math.ceil(Math.ceil(Math.max(1, a.width) + i * 2) * r), s = Math.ceil(Math.ceil(Math.max(1, a.height) + i * 2) * r), c = Be.getOptimalCanvasAndContext(o, s);
|
|
1773
|
+
return Ge(n, r, i, c, a), {
|
|
1774
|
+
canvasAndContext: c,
|
|
1775
|
+
frame: new y(0, 0, o, s)
|
|
1777
1776
|
};
|
|
1778
1777
|
}
|
|
1779
|
-
function
|
|
1780
|
-
let { context:
|
|
1781
|
-
|
|
1782
|
-
let
|
|
1783
|
-
|
|
1784
|
-
for (let
|
|
1785
|
-
let
|
|
1786
|
-
if (
|
|
1787
|
-
let
|
|
1788
|
-
|
|
1778
|
+
function Ge(e, t, n, r, i) {
|
|
1779
|
+
let { context: a } = r, o = He(e), { lines: s, lineHeight: c, lineWidths: l, maxLineWidth: u, fontProperties: d } = i;
|
|
1780
|
+
a.resetTransform(), a.scale(t, t), a.textBaseline = e.textBaseline, a.font = o;
|
|
1781
|
+
let f = Math.min(0, (c - d.fontSize) / 2);
|
|
1782
|
+
a.fillStyle = e.fill;
|
|
1783
|
+
for (let t = 0; t < s.length; ++t) {
|
|
1784
|
+
let i = Ke(l[t], u, e.align), a = t * c + d.ascent + f, o = 0;
|
|
1785
|
+
if (e.align === "justify" && e.wordWrap && t < s.length - 1) {
|
|
1786
|
+
let e = qe(s[t]);
|
|
1787
|
+
e > 0 && (o = (u - l[t]) / e);
|
|
1789
1788
|
}
|
|
1790
|
-
|
|
1789
|
+
Je(s[t], e, r, i + n, a + n, !1, o);
|
|
1791
1790
|
}
|
|
1792
1791
|
}
|
|
1793
|
-
function
|
|
1794
|
-
return
|
|
1792
|
+
function Ke(e, t, n) {
|
|
1793
|
+
return n === "right" ? t - e : n === "center" ? (t - e) / 2 : 0;
|
|
1795
1794
|
}
|
|
1796
|
-
function
|
|
1797
|
-
let
|
|
1798
|
-
for (let
|
|
1799
|
-
return
|
|
1795
|
+
function qe(e) {
|
|
1796
|
+
let t = 0;
|
|
1797
|
+
for (let n = 0; n < e.length; n++) e.charCodeAt(n) === 32 && t++;
|
|
1798
|
+
return t;
|
|
1800
1799
|
}
|
|
1801
|
-
function
|
|
1802
|
-
let
|
|
1803
|
-
if (
|
|
1804
|
-
|
|
1800
|
+
function Je(e, t, n, r, i, a = !1, o = 0) {
|
|
1801
|
+
let s = n.context, c = t.letterSpacing;
|
|
1802
|
+
if (c === 0 && o === 0) {
|
|
1803
|
+
s.fillText(e, r, i);
|
|
1805
1804
|
return;
|
|
1806
1805
|
}
|
|
1807
|
-
if (
|
|
1808
|
-
let
|
|
1809
|
-
for (let
|
|
1806
|
+
if (o !== 0 && c === 0) {
|
|
1807
|
+
let t = e.split(" "), n = r, a = s.measureText(" ").width;
|
|
1808
|
+
for (let e = 0; e < t.length; ++e) s.fillText(t[e], n, i), n += s.measureText(t[e]).width + a + o;
|
|
1810
1809
|
return;
|
|
1811
1810
|
}
|
|
1812
|
-
let
|
|
1813
|
-
for (let
|
|
1814
|
-
let
|
|
1815
|
-
|
|
1816
|
-
let
|
|
1817
|
-
for (let
|
|
1818
|
-
|
|
1811
|
+
let l = r, u = U.graphemeSegmenter(e), d = s.measureText(e).width, f = 0;
|
|
1812
|
+
for (let e = 0; e < u.length; ++e) {
|
|
1813
|
+
let t = u[e];
|
|
1814
|
+
s.fillText(t, l, i);
|
|
1815
|
+
let n = "";
|
|
1816
|
+
for (let t = e + 1; t < u.length; ++t) n += u[t];
|
|
1817
|
+
f = s.measureText(n).width, l += d - f + c, t === "" && (l += o), d = f;
|
|
1819
1818
|
}
|
|
1820
1819
|
}
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1820
|
+
//#endregion
|
|
1821
|
+
//#region lib/renderer/texture/TextureSource.ts
|
|
1822
|
+
var G = class e extends c {
|
|
1823
|
+
constructor(t) {
|
|
1824
|
+
super(), f(this, "uid", D("textureSource")), f(this, "label", void 0), f(this, "_resolution", 1), f(this, "pixelWidth", 1), f(this, "pixelHeight", 1), f(this, "width", 1), f(this, "height", 1), f(this, "resource", void 0), f(this, "destroyed", void 0);
|
|
1825
|
+
let n = {
|
|
1826
|
+
...e.defaultOptions,
|
|
1827
|
+
...t
|
|
1827
1828
|
};
|
|
1828
|
-
this.label =
|
|
1829
|
+
this.label = t.label, this.resource = n.resource, this._resolution = n.resolution, n.width ? this.pixelWidth = t.width * this._resolution : this.pixelWidth = this.resource && this.resourceWidth || 1, n.height ? this.pixelHeight = t.height * this._resolution : this.pixelHeight = this.resource && this.resourceHeight || 1, this.width = this.pixelWidth / this._resolution, this.height = this.pixelHeight / this._resolution, this.destroyed = !1;
|
|
1829
1830
|
}
|
|
1830
1831
|
get resolution() {
|
|
1831
1832
|
return this._resolution;
|
|
1832
1833
|
}
|
|
1833
|
-
set resolution(
|
|
1834
|
-
this._resolution !==
|
|
1834
|
+
set resolution(e) {
|
|
1835
|
+
this._resolution !== e && (this._resolution = e, this.width = this.pixelWidth / e, this.height = this.pixelHeight / e);
|
|
1835
1836
|
}
|
|
1836
1837
|
get resourceWidth() {
|
|
1837
|
-
let
|
|
1838
|
-
return
|
|
1838
|
+
let e = this.resource;
|
|
1839
|
+
return e.naturalWidth || e.width;
|
|
1839
1840
|
}
|
|
1840
1841
|
get resourceHeight() {
|
|
1841
|
-
let
|
|
1842
|
-
return
|
|
1842
|
+
let e = this.resource;
|
|
1843
|
+
return e.naturalHeight || e.height;
|
|
1843
1844
|
}
|
|
1844
|
-
resize(
|
|
1845
|
-
|
|
1846
|
-
let
|
|
1847
|
-
return this.width =
|
|
1845
|
+
resize(e, t, n) {
|
|
1846
|
+
n || (n = this._resolution), e || (e = this.width), t || (t = this.height);
|
|
1847
|
+
let r = Math.round(e * n), i = Math.round(t * n);
|
|
1848
|
+
return this.width = r / n, this.height = i / n, this._resolution = n, this.pixelWidth === r && this.pixelHeight === i ? !1 : (this.pixelWidth = r, this.pixelHeight = i, this.emit("resize", this), !0);
|
|
1848
1849
|
}
|
|
1849
1850
|
destroy() {
|
|
1850
1851
|
this.destroyed = !0, this.resource = null, this.emit("destroy", this), this.removeAllListeners();
|
|
1851
1852
|
}
|
|
1852
1853
|
};
|
|
1853
|
-
|
|
1854
|
-
var
|
|
1855
|
-
constructor(
|
|
1856
|
-
|
|
1854
|
+
f(G, "defaultOptions", { resolution: 1 });
|
|
1855
|
+
var Ye = class extends G {
|
|
1856
|
+
constructor(e) {
|
|
1857
|
+
e.resource || (e.resource = W()), e.width || (e.width = e.resource.width, e.autoDensity || (e.width /= e.resolution)), e.height || (e.height = e.resource.height, e.autoDensity || (e.height /= e.resolution)), super(e), f(this, "autoDensity", void 0), this.autoDensity = e.autoDensity, this.resizeCanvas();
|
|
1857
1858
|
}
|
|
1858
1859
|
resizeCanvas() {
|
|
1859
1860
|
this.autoDensity && (this.resource.style.width = `${this.width}px`, this.resource.style.height = `${this.height}px`), (this.resource.width !== this.pixelWidth || this.resource.height !== this.pixelHeight) && (this.resource.width = this.pixelWidth, this.resource.height = this.pixelHeight);
|
|
1860
1861
|
}
|
|
1861
|
-
resize(
|
|
1862
|
-
let
|
|
1863
|
-
return
|
|
1862
|
+
resize(e = this.width, t = this.height, n = this._resolution) {
|
|
1863
|
+
let r = super.resize(e, t, n);
|
|
1864
|
+
return r && this.resizeCanvas(), r;
|
|
1864
1865
|
}
|
|
1865
|
-
},
|
|
1866
|
-
constructor({ source:
|
|
1867
|
-
if (super(), this
|
|
1866
|
+
}, K = class extends c {
|
|
1867
|
+
constructor({ source: e, label: t, frame: n, orig: r, rotate: i } = {}) {
|
|
1868
|
+
if (super(), f(this, "label", void 0), f(this, "_source", void 0), f(this, "orig", void 0), f(this, "frame", new y()), f(this, "rotate", void 0), f(this, "destroyed", void 0), f(this, "noFrame", !1), this.label = t, this.source = e, n) this.frame.copyFrom(n);
|
|
1868
1869
|
else {
|
|
1869
1870
|
this.noFrame = !0;
|
|
1870
|
-
let { width:
|
|
1871
|
-
this.frame.width =
|
|
1871
|
+
let { width: t, height: n } = e;
|
|
1872
|
+
this.frame.width = t, this.frame.height = n;
|
|
1872
1873
|
}
|
|
1873
|
-
this.orig =
|
|
1874
|
+
this.orig = r || this.frame, this.rotate = i == null ? 0 : i, this.destroyed = !1;
|
|
1874
1875
|
}
|
|
1875
1876
|
get source() {
|
|
1876
1877
|
return this._source;
|
|
1877
1878
|
}
|
|
1878
|
-
set source(
|
|
1879
|
-
this._source && this._source.off("resize", this.update, this), this._source =
|
|
1879
|
+
set source(e) {
|
|
1880
|
+
this._source && this._source.off("resize", this.update, this), this._source = e, e.on("resize", this.update, this);
|
|
1880
1881
|
}
|
|
1881
1882
|
get width() {
|
|
1882
1883
|
return this.orig.width;
|
|
@@ -1887,100 +1888,76 @@ var CanvasSource = class extends TextureSource {
|
|
|
1887
1888
|
update() {
|
|
1888
1889
|
this.noFrame && (this.frame.width = this._source.width, this.frame.height = this._source.height);
|
|
1889
1890
|
}
|
|
1890
|
-
destroy(
|
|
1891
|
-
this._source && (this._source.off("resize", this.update, this),
|
|
1891
|
+
destroy(e = !1) {
|
|
1892
|
+
this._source && (this._source.off("resize", this.update, this), e && (this._source.destroy(), this._source = null)), this.destroyed = !0, this.emit("destroy", this), this.removeAllListeners();
|
|
1892
1893
|
}
|
|
1893
1894
|
};
|
|
1894
|
-
|
|
1895
|
+
f(K, "EMPTY", void 0), K.EMPTY = new K({
|
|
1895
1896
|
label: "EMPTY",
|
|
1896
|
-
source: new
|
|
1897
|
+
source: new G({ label: "EMPTY" })
|
|
1897
1898
|
});
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
let
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1899
|
+
//#endregion
|
|
1900
|
+
//#region lib/scene/text/TextSystem.ts
|
|
1901
|
+
var Xe = class {
|
|
1902
|
+
constructor(e) {
|
|
1903
|
+
f(this, "renderer", void 0), f(this, "_activeTexture", {}), this.renderer = e;
|
|
1904
|
+
}
|
|
1905
|
+
getManagedTexture(e) {
|
|
1906
|
+
e._resolution = e._autoResolution ? this.renderer.resolution : e.resolution;
|
|
1907
|
+
let t = e.styleKey;
|
|
1908
|
+
if (this._activeTexture[t]) return this._activeTexture[t];
|
|
1909
|
+
let n = this.getTexture({
|
|
1910
|
+
text: e.text,
|
|
1911
|
+
style: e.style,
|
|
1912
|
+
resolution: e._resolution
|
|
1910
1913
|
});
|
|
1911
|
-
return this._activeTexture[
|
|
1912
|
-
}
|
|
1913
|
-
getTexture(
|
|
1914
|
-
let { text:
|
|
1915
|
-
text:
|
|
1916
|
-
style:
|
|
1917
|
-
resolution:
|
|
1918
|
-
}),
|
|
1919
|
-
resource:
|
|
1920
|
-
resolution:
|
|
1914
|
+
return this._activeTexture[t] = n, n;
|
|
1915
|
+
}
|
|
1916
|
+
getTexture(e) {
|
|
1917
|
+
let { text: t, style: n } = e, r = e.resolution || this.renderer.resolution, { frame: i, canvasAndContext: a } = We({
|
|
1918
|
+
text: t,
|
|
1919
|
+
style: n,
|
|
1920
|
+
resolution: r
|
|
1921
|
+
}), o = a.canvas, s = new K({ source: new G({
|
|
1922
|
+
resource: o,
|
|
1923
|
+
resolution: r
|
|
1921
1924
|
}) });
|
|
1922
|
-
return
|
|
1925
|
+
return s.frame.width = i.width / r, s.frame.height = i.height / r, s;
|
|
1923
1926
|
}
|
|
1924
1927
|
};
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
j.add({
|
|
1932
|
-
renderPipeId: "stencilMask",
|
|
1933
|
-
action: "pushMaskBegin",
|
|
1934
|
-
mask: n
|
|
1935
|
-
});
|
|
1928
|
+
f(Xe, "desc", { name: "text" });
|
|
1929
|
+
//#endregion
|
|
1930
|
+
//#region lib/system/CanvasContextSystem.ts
|
|
1931
|
+
var Ze = class {
|
|
1932
|
+
constructor(e) {
|
|
1933
|
+
f(this, "_renderer", void 0), f(this, "rootContext", void 0), f(this, "activeConext", void 0), f(this, "activeResolution", 1), f(this, "globalTransform", new _()), this._renderer = e;
|
|
1936
1934
|
}
|
|
1937
|
-
|
|
1938
|
-
this._renderer.
|
|
1939
|
-
renderPipeId: "stencilMask",
|
|
1940
|
-
action: "popMaskEnd",
|
|
1941
|
-
mask: n
|
|
1942
|
-
});
|
|
1943
|
-
}
|
|
1944
|
-
execute(n) {
|
|
1945
|
-
if (n.action !== "pushMaskBegin" && n.action !== "popMaskEnd") return;
|
|
1946
|
-
let j = this._renderer.canvasContext, M = j.activeConext;
|
|
1947
|
-
if (n.action === "popMaskEnd") {
|
|
1948
|
-
this._canvasMaskStack.pop() && M.restore();
|
|
1949
|
-
return;
|
|
1950
|
-
}
|
|
1951
|
-
let N = n.mask.mask, P = N.context.instructions, F = N._roundPixels === 1;
|
|
1952
|
-
M.save(), j.setContextTransform(N.relativeGroupTransform, F), M.beginPath();
|
|
1953
|
-
for (let n = 0; n < P.length; ++n) {
|
|
1954
|
-
let j = P[n], N = j.action;
|
|
1955
|
-
if (N !== "fill" && N !== "stroke") return;
|
|
1956
|
-
let F = j.data.path.shapePath.shapePrimitives;
|
|
1957
|
-
for (let n = 0; n < F.length; ++n) {
|
|
1958
|
-
let j = F[n].shape;
|
|
1959
|
-
buildShapePath(M, j);
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
M.clip(), this._canvasMaskStack.push(!0);
|
|
1935
|
+
init() {
|
|
1936
|
+
this.activeConext = this._renderer.canvas.getContext("2d"), this.rootContext = this.activeConext, this.activeResolution = this._renderer.resolution;
|
|
1963
1937
|
}
|
|
1964
|
-
|
|
1965
|
-
this.
|
|
1938
|
+
setContextTransform(e, t, n) {
|
|
1939
|
+
let r = this.activeResolution, i = _.append(this.globalTransform, e);
|
|
1940
|
+
n || (n = this.activeResolution), t ? this.activeConext.setTransform(i.a * n, i.b * n, i.c * n, i.d * n, i.tx * r | 0, i.ty * r | 0) : this.activeConext.setTransform(i.a * n, i.b * n, i.c * n, i.d * n, i.tx * r, i.ty * r);
|
|
1966
1941
|
}
|
|
1967
1942
|
};
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1943
|
+
f(Ze, "desc", { name: "canvasContext" });
|
|
1944
|
+
//#endregion
|
|
1945
|
+
//#region lib/renderer/texture/RenderTexture.ts
|
|
1946
|
+
var Qe = class e extends K {
|
|
1947
|
+
static create(t) {
|
|
1948
|
+
return new e({ source: new G(t) });
|
|
1949
|
+
}
|
|
1950
|
+
}, $e = class extends P {
|
|
1951
|
+
constructor(e = K.EMPTY) {
|
|
1952
|
+
e instanceof K && (e = { texture: e });
|
|
1953
|
+
let { texture: t = K.EMPTY, width: n, height: r, ...i } = e;
|
|
1977
1954
|
super({
|
|
1978
1955
|
label: "Sprite",
|
|
1979
|
-
...
|
|
1980
|
-
}), this
|
|
1956
|
+
...i
|
|
1957
|
+
}), f(this, "_texture", void 0), f(this, "anchor", void 0), f(this, "renderPipeId", "sprite"), f(this, "_width", void 0), f(this, "_height", void 0), this.texture = t, this.anchor = new b(), n != null && (this.width = n), r != null && (this.height = r);
|
|
1981
1958
|
}
|
|
1982
|
-
set texture(
|
|
1983
|
-
|
|
1959
|
+
set texture(e) {
|
|
1960
|
+
e || (e = K.EMPTY), this._texture !== e && (this._texture = e, this._width && this._setWidth(this.width, this._texture.orig.width), this._height && this._setHeight(this.height, this._texture.orig.height), this.onViewUpdate());
|
|
1984
1961
|
}
|
|
1985
1962
|
get texture() {
|
|
1986
1963
|
return this._texture;
|
|
@@ -1988,31 +1965,31 @@ var RenderTexture = class n extends Texture {
|
|
|
1988
1965
|
get height() {
|
|
1989
1966
|
return Math.abs(this.scale.y) * this.texture.orig.height;
|
|
1990
1967
|
}
|
|
1991
|
-
set height(
|
|
1992
|
-
let
|
|
1993
|
-
|
|
1968
|
+
set height(e) {
|
|
1969
|
+
let t = this.texture.orig.height, n = Math.sign(this.scale.y) || 1;
|
|
1970
|
+
t === 0 ? this.scale.y = n : this.scale.y = e / t * n, this._height = e;
|
|
1994
1971
|
}
|
|
1995
1972
|
get width() {
|
|
1996
1973
|
return Math.abs(this.scale.x) * this.texture.orig.width;
|
|
1997
1974
|
}
|
|
1998
|
-
set width(
|
|
1999
|
-
let
|
|
2000
|
-
|
|
1975
|
+
set width(e) {
|
|
1976
|
+
let t = this.texture.orig.width, n = Math.sign(this.scale.x) || 1;
|
|
1977
|
+
t === 0 ? this.scale.x = n : this.scale.x = e / t * n, this._width = e;
|
|
2001
1978
|
}
|
|
2002
1979
|
updateBounds() {
|
|
2003
|
-
let
|
|
2004
|
-
|
|
2005
|
-
}
|
|
2006
|
-
},
|
|
2007
|
-
constructor(
|
|
2008
|
-
var
|
|
2009
|
-
let { text:
|
|
2010
|
-
super(
|
|
1980
|
+
let e = this._bounds, { width: t, height: n } = this.texture.orig;
|
|
1981
|
+
e.minX = -this.anchor.x * t, e.maxX = e.minX + t, e.minY = -this.anchor.y * n, e.maxY = e.minY + n;
|
|
1982
|
+
}
|
|
1983
|
+
}, et = class extends P {
|
|
1984
|
+
constructor(e) {
|
|
1985
|
+
var t;
|
|
1986
|
+
let { text: n, resolution: r, style: i, width: a, height: o, ...s } = e;
|
|
1987
|
+
super(s), f(this, "renderPipeId", "text"), f(this, "_anchor", void 0), f(this, "_didTextUpdate", !0), f(this, "_resolution", null), f(this, "_autoResolution", !0), f(this, "_text", void 0), f(this, "_style", void 0), this._anchor = new C({ _onUpdate: () => {
|
|
2011
1988
|
this.onViewUpdate();
|
|
2012
|
-
} }, 0, 0), this.text = (
|
|
1989
|
+
} }, 0, 0), this.text = (t = e.text) == null ? "" : t, this.style = i, this.resolution = r == null ? null : r, a != null && (this.width = a), o != null && (this.height = o);
|
|
2013
1990
|
}
|
|
2014
|
-
set resolution(
|
|
2015
|
-
this._autoResolution =
|
|
1991
|
+
set resolution(e) {
|
|
1992
|
+
this._autoResolution = e === null, this._resolution = e, this.onViewUpdate();
|
|
2016
1993
|
}
|
|
2017
1994
|
get resolution() {
|
|
2018
1995
|
return this._resolution;
|
|
@@ -2020,226 +1997,497 @@ var RenderTexture = class n extends Texture {
|
|
|
2020
1997
|
get anchor() {
|
|
2021
1998
|
return this._anchor;
|
|
2022
1999
|
}
|
|
2023
|
-
set anchor(
|
|
2024
|
-
this._anchor.copyFrom(
|
|
2000
|
+
set anchor(e) {
|
|
2001
|
+
this._anchor.copyFrom(e);
|
|
2025
2002
|
}
|
|
2026
2003
|
get text() {
|
|
2027
2004
|
return this._text;
|
|
2028
2005
|
}
|
|
2029
|
-
set text(
|
|
2030
|
-
let
|
|
2031
|
-
this._text !==
|
|
2006
|
+
set text(e) {
|
|
2007
|
+
let t = String(e);
|
|
2008
|
+
this._text !== t && (this._text = t, this.onViewUpdate());
|
|
2032
2009
|
}
|
|
2033
2010
|
get style() {
|
|
2034
2011
|
return this._style;
|
|
2035
2012
|
}
|
|
2036
|
-
set style(
|
|
2037
|
-
|
|
2013
|
+
set style(e) {
|
|
2014
|
+
e || (e = {}), e instanceof H ? this._style = e : this._style = new H(e), this.onViewUpdate();
|
|
2038
2015
|
}
|
|
2039
2016
|
get width() {
|
|
2040
2017
|
return Math.abs(this.scale.x) * this.bounds.width;
|
|
2041
2018
|
}
|
|
2042
|
-
set width(
|
|
2043
|
-
this._setWidth(
|
|
2019
|
+
set width(e) {
|
|
2020
|
+
this._setWidth(e, this.bounds.width);
|
|
2044
2021
|
}
|
|
2045
2022
|
get height() {
|
|
2046
2023
|
return Math.abs(this.scale.y) * this.bounds.height;
|
|
2047
2024
|
}
|
|
2048
|
-
set height(
|
|
2049
|
-
this._setHeight(
|
|
2025
|
+
set height(e) {
|
|
2026
|
+
this._setHeight(e, this.bounds.height);
|
|
2050
2027
|
}
|
|
2051
2028
|
onViewUpdate() {
|
|
2052
2029
|
this.didViewUpdate || (this._didTextUpdate = !0), super.onViewUpdate();
|
|
2053
2030
|
}
|
|
2054
2031
|
updateBounds() {
|
|
2055
|
-
let
|
|
2056
|
-
|
|
2032
|
+
let e = this._bounds, t = this._anchor, n = U.measureText(this._text, this._style), r = n.width, i = n.height;
|
|
2033
|
+
e.minX = -t._x * r, e.minY = -t._y * i, e.maxX = e.minX + r, e.maxY = e.minY + i;
|
|
2057
2034
|
}
|
|
2058
2035
|
get styleKey() {
|
|
2059
2036
|
return `${this._text}:${this._style.styleKey}:${this._resolution}`;
|
|
2060
2037
|
}
|
|
2061
|
-
destroy(
|
|
2062
|
-
super.destroy(
|
|
2063
|
-
}
|
|
2064
|
-
},
|
|
2065
|
-
constructor(
|
|
2066
|
-
this._renderer =
|
|
2067
|
-
}
|
|
2068
|
-
texture(
|
|
2069
|
-
return this._generateTexture(
|
|
2070
|
-
}
|
|
2071
|
-
_generateTexture(
|
|
2072
|
-
|
|
2073
|
-
let
|
|
2074
|
-
|
|
2075
|
-
let
|
|
2076
|
-
width:
|
|
2077
|
-
height:
|
|
2078
|
-
resolution:
|
|
2079
|
-
}),
|
|
2080
|
-
return
|
|
2038
|
+
destroy(e = !1) {
|
|
2039
|
+
super.destroy(e), this._bounds = null, this._anchor = null, (typeof e == "boolean" ? e : e != null && e.style) && this._style.destroy(e), this._style = null, this._text = null;
|
|
2040
|
+
}
|
|
2041
|
+
}, tt = class {
|
|
2042
|
+
constructor(e) {
|
|
2043
|
+
f(this, "_renderer", void 0), this._renderer = e;
|
|
2044
|
+
}
|
|
2045
|
+
texture(e) {
|
|
2046
|
+
return this._generateTexture(e);
|
|
2047
|
+
}
|
|
2048
|
+
_generateTexture(e) {
|
|
2049
|
+
e instanceof N && (e = { target: e });
|
|
2050
|
+
let t = e.resolution || this._renderer.resolution, n = e.target, r = new w(), i = e.frame || O(n, r).rectangle;
|
|
2051
|
+
i.width = Math.max(i.width, 1 / t) | 0, i.height = Math.max(i.height, 1 / t) | 0;
|
|
2052
|
+
let a = Qe.create({
|
|
2053
|
+
width: i.width,
|
|
2054
|
+
height: i.height,
|
|
2055
|
+
resolution: t
|
|
2056
|
+
}), o = T.get();
|
|
2057
|
+
return o.tx = -i.x, o.ty = -i.y, this._renderer.render({
|
|
2081
2058
|
clearColor: "transparent",
|
|
2082
|
-
container:
|
|
2083
|
-
transform:
|
|
2084
|
-
target:
|
|
2085
|
-
}),
|
|
2059
|
+
container: n,
|
|
2060
|
+
transform: o,
|
|
2061
|
+
target: a
|
|
2062
|
+
}), T.return(o), a;
|
|
2086
2063
|
}
|
|
2087
2064
|
};
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
this.activeConext = this._renderer.canvas.getContext("2d"), this.rootContext = this.activeConext, this.activeResolution = this._renderer.resolution;
|
|
2095
|
-
}
|
|
2096
|
-
setContextTransform(n, j, M) {
|
|
2097
|
-
let N = this.activeResolution, P = Matrix.append(this.globalTransform, n);
|
|
2098
|
-
M || (M = this.activeResolution), j ? this.activeConext.setTransform(P.a * M, P.b * M, P.c * M, P.d * M, P.tx * N | 0, P.ty * N | 0) : this.activeConext.setTransform(P.a * M, P.b * M, P.c * M, P.d * M, P.tx * N, P.ty * N);
|
|
2065
|
+
f(tt, "desc", { name: "extract" });
|
|
2066
|
+
//#endregion
|
|
2067
|
+
//#region lib/system/ViewSystem.ts
|
|
2068
|
+
var q = class e {
|
|
2069
|
+
constructor() {
|
|
2070
|
+
f(this, "canvas", void 0), f(this, "screen", void 0), f(this, "texture", void 0);
|
|
2099
2071
|
}
|
|
2100
|
-
};
|
|
2101
|
-
_CanvasContextSystem = CanvasContextSystem, _CanvasContextSystem.desc = { name: "canvasContext" };
|
|
2102
|
-
var _ViewSystem, ViewSystem = class n {
|
|
2103
2072
|
get resolution() {
|
|
2104
2073
|
return this.texture.source._resolution;
|
|
2105
2074
|
}
|
|
2106
|
-
set resolution(
|
|
2107
|
-
this.texture.source.resize(this.texture.source.width, this.texture.source.height,
|
|
2075
|
+
set resolution(e) {
|
|
2076
|
+
this.texture.source.resize(this.texture.source.width, this.texture.source.height, e);
|
|
2108
2077
|
}
|
|
2109
|
-
init(
|
|
2110
|
-
|
|
2111
|
-
...
|
|
2112
|
-
...
|
|
2113
|
-
}, this.screen = new
|
|
2078
|
+
init(t) {
|
|
2079
|
+
t = {
|
|
2080
|
+
...e.defaultOptions,
|
|
2081
|
+
...t
|
|
2082
|
+
}, this.screen = new y(0, 0, t.width, t.height), this.canvas = W(), this.texture = new K({ source: new Ye({
|
|
2114
2083
|
resource: this.canvas,
|
|
2115
|
-
...
|
|
2116
|
-
}) }), this.resolution =
|
|
2084
|
+
...t
|
|
2085
|
+
}) }), this.resolution = t.resolution;
|
|
2117
2086
|
}
|
|
2118
|
-
resize(
|
|
2119
|
-
this.texture.source.resize(
|
|
2087
|
+
resize(e, t, n) {
|
|
2088
|
+
this.texture.source.resize(e, t, n), this.screen.width = this.texture.frame.width, this.screen.height = this.texture.frame.height;
|
|
2120
2089
|
}
|
|
2121
2090
|
};
|
|
2122
|
-
|
|
2091
|
+
f(q, "desc", { name: "view" }), f(q, "defaultOptions", {
|
|
2123
2092
|
width: 800,
|
|
2124
2093
|
height: 600,
|
|
2125
2094
|
autoDensity: !1
|
|
2095
|
+
});
|
|
2096
|
+
//#endregion
|
|
2097
|
+
//#region lib/events/FederatedEvent.ts
|
|
2098
|
+
var J = class {
|
|
2099
|
+
constructor(e) {
|
|
2100
|
+
f(this, "system", void 0), f(this, "target", void 0), f(this, "currentTarget", void 0), f(this, "nativeEvent", void 0), f(this, "type", void 0), f(this, "global", new b()), f(this, "screen", new b()), f(this, "path", void 0), this.system = e;
|
|
2101
|
+
}
|
|
2102
|
+
getLocalPosition(e, t) {
|
|
2103
|
+
return e.worldTransform.applyInverse(t || this.global);
|
|
2104
|
+
}
|
|
2105
|
+
composedPath() {
|
|
2106
|
+
return (!this.path || this.path[this.path.length - 1] !== this.target) && (this.path = this.target ? this.system.propagationPath(this.target) : []), this.path;
|
|
2107
|
+
}
|
|
2108
|
+
}, nt = 2048, rt = class {
|
|
2109
|
+
constructor(e) {
|
|
2110
|
+
f(this, "renderer", void 0), f(this, "domElement", null), f(this, "rootTarget", null), f(this, "resolution", 1), f(this, "eventPool", /* @__PURE__ */ new Map()), f(this, "_allInteractiveElements", []), f(this, "_hitElements", []), f(this, "_rootPointerEvent", void 0), f(this, "_isPointerMoveEvent", !1), f(this, "mappingState", { trackingData: {} }), this.renderer = e, this.resolution = e.resolution, this._rootPointerEvent = new J(null), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerOverOut = this._onPointerOverOut.bind(this), this.init();
|
|
2111
|
+
}
|
|
2112
|
+
get pointer() {
|
|
2113
|
+
return this._rootPointerEvent;
|
|
2114
|
+
}
|
|
2115
|
+
trackingData(e) {
|
|
2116
|
+
return this.mappingState.trackingData[e] || (this.mappingState.trackingData[e] = {
|
|
2117
|
+
pressTargetsByButton: {},
|
|
2118
|
+
clicksByButton: {},
|
|
2119
|
+
overTargets: null
|
|
2120
|
+
}), this.mappingState.trackingData[e];
|
|
2121
|
+
}
|
|
2122
|
+
init() {
|
|
2123
|
+
let e = this.renderer.canvas;
|
|
2124
|
+
this.setTargetElement(e);
|
|
2125
|
+
}
|
|
2126
|
+
setTargetElement(e) {
|
|
2127
|
+
this._removeEvents(), this.domElement = e, this._addEvents();
|
|
2128
|
+
}
|
|
2129
|
+
dispatchEvent(e, t) {
|
|
2130
|
+
if (!e.target) return;
|
|
2131
|
+
let n = e.composedPath();
|
|
2132
|
+
for (let r = 0; r < n.length - 1; ++r) e.currentTarget = n[r], this._notifyTarget(e, t);
|
|
2133
|
+
e.currentTarget = e.target, this._notifyTarget(e, t);
|
|
2134
|
+
}
|
|
2135
|
+
_notifyTarget(e, t) {
|
|
2136
|
+
t != null || (t = e.type);
|
|
2137
|
+
let n = e.currentTarget._events[t];
|
|
2138
|
+
if (n) if ("fn" in n) n.once && e.target.removeListener(t, n.fn, void 0, !0), n.fn.call(n.context, e);
|
|
2139
|
+
else for (let r = 0; r < n.length; ++r) {
|
|
2140
|
+
let i = n[r];
|
|
2141
|
+
i.once && e.target.removeListener(t, i.fn, void 0, !0), i.fn.call(i.context, e);
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
propagationPath(e) {
|
|
2145
|
+
let t = [e];
|
|
2146
|
+
for (let n = 0; n < nt && (e !== this.rootTarget || e.parent); ++n) {
|
|
2147
|
+
if (!e.parent) throw Error("Cannot find propagation path to disconnected target");
|
|
2148
|
+
t.push(e.parent), e = e.parent;
|
|
2149
|
+
}
|
|
2150
|
+
return t.reverse(), t;
|
|
2151
|
+
}
|
|
2152
|
+
_removeEvents() {
|
|
2153
|
+
let e = this.domElement;
|
|
2154
|
+
e && (globalThis.document.removeEventListener("pointermove", this._onPointerMove, !0), e.removeEventListener("pointerdown", this._onPointerDown, !0), e.removeEventListener("pointerleave", this._onPointerOverOut, !0), e.removeEventListener("pointerover", this._onPointerOverOut, !0), globalThis.document.removeEventListener("pointerup", this._onPointerUp, !0));
|
|
2155
|
+
}
|
|
2156
|
+
_addEvents() {
|
|
2157
|
+
let e = this.domElement;
|
|
2158
|
+
if (!e) return;
|
|
2159
|
+
let t = e.style;
|
|
2160
|
+
t && (t.touchAction = "none"), globalThis.document.addEventListener("pointermove", this._onPointerMove, !0), e.addEventListener("pointerdown", this._onPointerDown, !0), e.addEventListener("pointerleave", this._onPointerOverOut, !0), e.addEventListener("pointerover", this._onPointerOverOut, !0), globalThis.document.addEventListener("pointerup", this._onPointerUp, !0);
|
|
2161
|
+
}
|
|
2162
|
+
_onPointerMove(e) {
|
|
2163
|
+
var t;
|
|
2164
|
+
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
2165
|
+
this._isPointerMoveEvent = !0, this._allInteractiveElements.length = 0, this._hitElements.length = 0;
|
|
2166
|
+
let n = this._bootstrapEvent(this._rootPointerEvent, e), r = this.createPointEvent(n);
|
|
2167
|
+
this._isPointerMoveEvent = !1;
|
|
2168
|
+
let i = this.trackingData(e.pointerId), a = it(i.overTargets);
|
|
2169
|
+
if (((t = i.overTargets) == null ? void 0 : t.length) > 0 && a !== r.target) {
|
|
2170
|
+
let e = this.createPointEvent(n, "pointerout", a);
|
|
2171
|
+
this.dispatchEvent(e, "pointerout");
|
|
2172
|
+
let t = r.composedPath();
|
|
2173
|
+
if (!t.includes(a)) {
|
|
2174
|
+
let e = this.createPointEvent(n, "pointerleave", a);
|
|
2175
|
+
for (; e.target && !t.includes(e.target);) e.currentTarget = e.target, this._notifyTarget(e), e.target = e.target.parent;
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
if (a !== r.target) {
|
|
2179
|
+
let e = "pointerover", t = this.clonePointEvent(r, e);
|
|
2180
|
+
this.dispatchEvent(t, e);
|
|
2181
|
+
let n = a == null ? void 0 : a.parent;
|
|
2182
|
+
for (; n && n !== this.rootTarget.parent && n !== r.target;) n = n.parent;
|
|
2183
|
+
if (!n || n === this.rootTarget.parent) {
|
|
2184
|
+
let e = this.clonePointEvent(r, "pointerenter");
|
|
2185
|
+
for (; e.target && e.target !== a && e.target !== this.rootTarget.parent;) e.currentTarget = e.target, this._notifyTarget(e), e.target = e.target.parent;
|
|
2186
|
+
}
|
|
2187
|
+
this.freeEvent(t);
|
|
2188
|
+
}
|
|
2189
|
+
this.dispatchEvent(r, "pointermove");
|
|
2190
|
+
let o = this._allInteractiveElements;
|
|
2191
|
+
for (let e = o.length - 1; e >= 0; --e) r.currentTarget = o[e], this._notifyTarget(r, "globalpointermove");
|
|
2192
|
+
this._allInteractiveElements.length = 0, this._hitElements.length = 0, i.overTargets = r.composedPath(), this.freeEvent(r);
|
|
2193
|
+
}
|
|
2194
|
+
_onPointerDown(e) {
|
|
2195
|
+
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
2196
|
+
let t = this._bootstrapEvent(this._rootPointerEvent, e), n = this.createPointEvent(t);
|
|
2197
|
+
this.dispatchEvent(n, "pointerdown");
|
|
2198
|
+
let r = this.trackingData(e.pointerId);
|
|
2199
|
+
r.pressTargetsByButton[e.button] = n.composedPath(), this.freeEvent(n);
|
|
2200
|
+
}
|
|
2201
|
+
_onPointerOverOut(e) {
|
|
2202
|
+
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
2203
|
+
let t = this._bootstrapEvent(this._rootPointerEvent, e), n = this.createPointEvent(t);
|
|
2204
|
+
this.dispatchEvent(n, "pointerout"), this.freeEvent(n);
|
|
2205
|
+
}
|
|
2206
|
+
_onPointerUp(e) {
|
|
2207
|
+
if (this.rootTarget = this.renderer.renderedObject, !this.rootTarget) return;
|
|
2208
|
+
let t = e.target;
|
|
2209
|
+
e.composedPath && e.composedPath().length > 1 && (t = e.composedPath()[0]);
|
|
2210
|
+
let n = this._bootstrapEvent(this._rootPointerEvent, e), r = t === this.domElement ? "" : "outside", i = this.createPointEvent(n);
|
|
2211
|
+
this.dispatchEvent(i, `pointerup${r}`), this.freeEvent(i);
|
|
2212
|
+
}
|
|
2213
|
+
_isInteractive(e) {
|
|
2214
|
+
return e === "static";
|
|
2215
|
+
}
|
|
2216
|
+
_bootstrapEvent(e, t) {
|
|
2217
|
+
return e.nativeEvent = t, this.mapPositionToPoint(e.screen, t.clientX, t.clientY), e.global.copyFrom(e.screen), t.type === "pointerleave" ? e.type = "pointerout" : e.type = t.type, e;
|
|
2218
|
+
}
|
|
2219
|
+
allocateEvent(e) {
|
|
2220
|
+
this.eventPool.has(e) || this.eventPool.set(e, []);
|
|
2221
|
+
let t = this.eventPool.get(e).pop() || new e(this);
|
|
2222
|
+
return t.currentTarget = null, t.path = null, t.target = null, t;
|
|
2223
|
+
}
|
|
2224
|
+
freeEvent(e) {
|
|
2225
|
+
let t = e.constructor;
|
|
2226
|
+
this.eventPool.has(t) || this.eventPool.set(t, []), this.eventPool.get(t).push(e);
|
|
2227
|
+
}
|
|
2228
|
+
createPointEvent(e, t, n) {
|
|
2229
|
+
var r;
|
|
2230
|
+
let i = this.allocateEvent(J);
|
|
2231
|
+
return i.global.copyFrom(e.global), i.screen.copyFrom(e.screen), i.nativeEvent = e.nativeEvent, i.target = (r = n == null ? this.hitTest(i.global.x, i.global.y) : n) == null ? this._hitElements[0] : r, t && (i.type = t), i;
|
|
2232
|
+
}
|
|
2233
|
+
clonePointEvent(e, t) {
|
|
2234
|
+
let n = this.allocateEvent(J);
|
|
2235
|
+
return n.nativeEvent = e.nativeEvent, n.global = e.global, n.type = t == null ? e.type : t, n.path = e.composedPath().slice(), n.target = e.target, n;
|
|
2236
|
+
}
|
|
2237
|
+
mapPositionToPoint(e, t, n) {
|
|
2238
|
+
let r = this.domElement, i = r.isConnected ? r.getBoundingClientRect() : {
|
|
2239
|
+
x: 0,
|
|
2240
|
+
y: 0,
|
|
2241
|
+
width: r.width,
|
|
2242
|
+
height: r.height,
|
|
2243
|
+
left: 0,
|
|
2244
|
+
top: 0
|
|
2245
|
+
}, a = 1 / this.resolution;
|
|
2246
|
+
return e.x = (t - i.left) * (r.width / i.width) * a, e.y = (n - i.top) * (r.height / i.height) * a, e;
|
|
2247
|
+
}
|
|
2248
|
+
hitTest(e, t) {
|
|
2249
|
+
let n = this._isPointerMoveEvent, r = this[n ? "hitTestMoveRecursive" : "hitTestRecursive"](this.rootTarget, this.rootTarget.eventMode, new b(e, t));
|
|
2250
|
+
return r && r[0];
|
|
2251
|
+
}
|
|
2252
|
+
_interactivePrune(e) {
|
|
2253
|
+
return !e || !e.visible || !e.renderable || !e.measurable || e.eventMode === "none";
|
|
2254
|
+
}
|
|
2255
|
+
hitTestMoveRecursive(e, t, n) {
|
|
2256
|
+
let r = !1;
|
|
2257
|
+
if (this._interactivePrune(e)) return;
|
|
2258
|
+
let i = e.children;
|
|
2259
|
+
if (i && i.length > 0) for (let a = i.length - 1; a >= 0; --a) {
|
|
2260
|
+
let o = i[a], s = this.hitTestMoveRecursive(o, this._isInteractive(t) ? t : o.eventMode, n);
|
|
2261
|
+
if (s) {
|
|
2262
|
+
if (s.length > 0 && !s[s.length - 1].parent) continue;
|
|
2263
|
+
let t = this._isInteractive(e.eventMode);
|
|
2264
|
+
(s.length > 0 || t) && (t && this._allInteractiveElements.push(e), s.push(e)), this._hitElements.length === 0 && (this._hitElements = s), r = !0;
|
|
2265
|
+
}
|
|
2266
|
+
}
|
|
2267
|
+
let a = this._isInteractive(t), o = this._isInteractive(e.eventMode);
|
|
2268
|
+
if (o && this._allInteractiveElements.push(e), !(this._hitElements.length > 0)) {
|
|
2269
|
+
if (r) return this._hitElements;
|
|
2270
|
+
if (a && this.hitTestFn(e, n)) return o ? [e] : [];
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
hitTestRecursive(e, t, n) {
|
|
2274
|
+
if (this._interactivePrune(e)) return;
|
|
2275
|
+
let r = e.children;
|
|
2276
|
+
for (let i = r.length - 1; i >= 0; i--) {
|
|
2277
|
+
let a = r[i], o = this.hitTestRecursive(a, this._isInteractive(t) ? t : a.eventMode, n);
|
|
2278
|
+
if (o) {
|
|
2279
|
+
let t = this._isInteractive(e.eventMode);
|
|
2280
|
+
return (o.length > 0 || t) && o.push(e), o;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
let i = this._isInteractive(t), a = this._isInteractive(e.eventMode);
|
|
2284
|
+
return i && this.hitTestFn(e, n) ? a ? [e] : [] : null;
|
|
2285
|
+
}
|
|
2286
|
+
hitTestFn(e, t) {
|
|
2287
|
+
if (e.hitArea) return !0;
|
|
2288
|
+
if (e.containsPoint) {
|
|
2289
|
+
let n = e.worldTransform.applyInverse(t);
|
|
2290
|
+
return e.containsPoint(n);
|
|
2291
|
+
}
|
|
2292
|
+
return !1;
|
|
2293
|
+
}
|
|
2294
|
+
};
|
|
2295
|
+
f(rt, "desc", { name: "events" });
|
|
2296
|
+
function it(e) {
|
|
2297
|
+
if (!e) return;
|
|
2298
|
+
let t = e[0];
|
|
2299
|
+
for (let n = 1; n < e.length && e[n].parent === t; ++n) t = e[n];
|
|
2300
|
+
return t;
|
|
2301
|
+
}
|
|
2302
|
+
//#endregion
|
|
2303
|
+
//#region lib/scene/container/utils/updateRenderGroupTransform.ts
|
|
2304
|
+
var at = 7;
|
|
2305
|
+
function ot(e, t = !1) {
|
|
2306
|
+
let n = e.root;
|
|
2307
|
+
e.worldTransform.copyFrom(n.localTransform);
|
|
2308
|
+
let r = e.childrenToUpdate;
|
|
2309
|
+
for (let t in r) {
|
|
2310
|
+
let n = Number(t), i = r[n], a = i.list, o = i.index;
|
|
2311
|
+
for (let t = 0; t < o; ++t) {
|
|
2312
|
+
let r = a[t];
|
|
2313
|
+
r.parentRenderGroup === e && r.relativeRenderGroupDepth === n && st(r, 0);
|
|
2314
|
+
}
|
|
2315
|
+
ve(a, o), i.index = 0;
|
|
2316
|
+
}
|
|
2317
|
+
if (t) for (let n = 0; n < e.renderGroupChildren.length; ++n) ot(e.renderGroupChildren[n], t);
|
|
2318
|
+
}
|
|
2319
|
+
function st(e, t) {
|
|
2320
|
+
e.didChange = !1;
|
|
2321
|
+
let n = e.parent, r = e.localTransform;
|
|
2322
|
+
e.updateLocalTransform(), n && (t |= e._updateFlags, e.relativeGroupTransform.appendFrom(r, n.relativeGroupTransform), t & at && ct(e, n, t));
|
|
2323
|
+
let i = e.children;
|
|
2324
|
+
for (let e = 0; e < i.length; e++) st(i[e], t);
|
|
2325
|
+
}
|
|
2326
|
+
function ct(e, t, n) {
|
|
2327
|
+
if (n & 1) {
|
|
2328
|
+
e.groupColor = t.groupColor;
|
|
2329
|
+
let n = e.localAlpha * t.groupAlpha;
|
|
2330
|
+
n = n < 0 ? 0 : n > 1 ? 1 : n, e.groupAlpha = n, e.groupColorAlpha = e.groupColor + ((n * 255 | 0) << 24);
|
|
2331
|
+
}
|
|
2332
|
+
n & 4 && (e.globalDisplayStatus = e.localDisplayStatus & t.globalDisplayStatus), e._updateFlags = 0;
|
|
2333
|
+
}
|
|
2334
|
+
//#endregion
|
|
2335
|
+
//#region lib/scene/container/utils/validateRenderables.ts
|
|
2336
|
+
function lt(e, t) {
|
|
2337
|
+
let { list: n, index: r } = e.childrenRenderablesToUpdate, i = !1;
|
|
2338
|
+
for (let e = 0; e < r; ++e) {
|
|
2339
|
+
let r = n[e];
|
|
2340
|
+
if (i = t[r.renderPipeId].validateRenderable(r), i) break;
|
|
2341
|
+
}
|
|
2342
|
+
return e.structureDidChange = i, i;
|
|
2343
|
+
}
|
|
2344
|
+
//#endregion
|
|
2345
|
+
//#region lib/system/RenderGroupSystem.ts
|
|
2346
|
+
var ut = class {
|
|
2347
|
+
constructor(e) {
|
|
2348
|
+
f(this, "renderer", void 0), this.renderer = e;
|
|
2349
|
+
}
|
|
2350
|
+
_updateRenderGroup(e) {
|
|
2351
|
+
let t = this.renderer, n = t.renderPipes;
|
|
2352
|
+
e.runOnRender(t), e.instructionSet.renderPipes = n, e.structureDidChange ? ve(e.childrenRenderablesToUpdate.list, 0) : lt(e, n), ot(e), e.structureDidChange && (e.structureDidChange = !1, this._buildInstructions(e, t)), e.childrenRenderablesToUpdate.index = 0;
|
|
2353
|
+
}
|
|
2354
|
+
render({ container: e, transform: t }) {
|
|
2355
|
+
let n = this.renderer;
|
|
2356
|
+
t && e.renderGroup.localTransform.copyFrom(t), n.canvasContext.globalTransform = t ? e.renderGroup.localTransform : e.renderGroup.worldTransform, this._updateRenderGroup(e.renderGroup), dt(e.renderGroup, n.renderPipes);
|
|
2357
|
+
}
|
|
2358
|
+
_buildInstructions(e, t) {
|
|
2359
|
+
let n = t.renderPipes, r = e.root;
|
|
2360
|
+
e.instructionSet.reset(), r.sortableChildren && r.sortChildren(), n.batch.buildStart(), r.collectRenderablesWithEffects(n, e.instructionSet), n.batch.buildEnd(e.instructionSet);
|
|
2361
|
+
}
|
|
2126
2362
|
};
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2363
|
+
f(ut, "desc", { name: "renderGroup" });
|
|
2364
|
+
function dt(e, t) {
|
|
2365
|
+
let { instructionSet: n } = e, r = n.instructions;
|
|
2366
|
+
for (let e = 0; e < n.instructionSize; e++) {
|
|
2367
|
+
let n = r[e];
|
|
2368
|
+
t[n.renderPipeId].execute(n);
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
//#endregion
|
|
2372
|
+
//#region lib/renderer/index.ts
|
|
2373
|
+
var Y = [
|
|
2374
|
+
q,
|
|
2375
|
+
rt,
|
|
2376
|
+
ut,
|
|
2377
|
+
Xe,
|
|
2378
|
+
tt,
|
|
2379
|
+
Ze
|
|
2380
|
+
], ft = [
|
|
2381
|
+
m,
|
|
2382
|
+
z,
|
|
2383
|
+
V,
|
|
2384
|
+
ze,
|
|
2385
|
+
Re
|
|
2386
|
+
], pt = class extends c {
|
|
2141
2387
|
constructor() {
|
|
2142
|
-
super(), this
|
|
2388
|
+
super(), f(this, "uid", D("renderer")), f(this, "context", void 0), f(this, "background", void 0), f(this, "renderedObject", null), f(this, "_roundPixels", void 0), f(this, "resolution", void 0), f(this, "activeRenderGroup", void 0), f(this, "renderPipes", {}), this.background = { color: "#000000" };
|
|
2143
2389
|
}
|
|
2144
2390
|
get canvas() {
|
|
2145
2391
|
return this.view.canvas;
|
|
2146
2392
|
}
|
|
2147
2393
|
_addPipes() {
|
|
2148
|
-
|
|
2149
|
-
this.renderPipes[
|
|
2394
|
+
ft.forEach((e) => {
|
|
2395
|
+
this.renderPipes[e.desc.name] = new e(this);
|
|
2150
2396
|
});
|
|
2151
2397
|
}
|
|
2152
2398
|
_addSystems() {
|
|
2153
|
-
|
|
2154
|
-
this[
|
|
2399
|
+
Y.forEach((e) => {
|
|
2400
|
+
this[e.desc.name] = new e(this);
|
|
2155
2401
|
});
|
|
2156
2402
|
}
|
|
2157
|
-
async init(
|
|
2158
|
-
this.resolution =
|
|
2159
|
-
for (let
|
|
2160
|
-
var
|
|
2161
|
-
await ((
|
|
2403
|
+
async init(e) {
|
|
2404
|
+
this.resolution = e.resolution || 1, this._addSystems(), this._addPipes();
|
|
2405
|
+
for (let r = 0; r < Y.length; ++r) {
|
|
2406
|
+
var t, n;
|
|
2407
|
+
await ((t = (n = this[Y[r].desc.name]).init) == null ? void 0 : t.call(n, e));
|
|
2162
2408
|
}
|
|
2163
|
-
|
|
2409
|
+
e.backgroundColor && (this.background.color = e.backgroundColor), this._roundPixels = +!!e.roundPixels;
|
|
2164
2410
|
}
|
|
2165
2411
|
get roundPixels() {
|
|
2166
2412
|
return !!this._roundPixels;
|
|
2167
2413
|
}
|
|
2168
|
-
render(
|
|
2169
|
-
let
|
|
2170
|
-
if (
|
|
2171
|
-
|
|
2172
|
-
let
|
|
2173
|
-
if (this.activeRenderGroup =
|
|
2174
|
-
let { context:
|
|
2175
|
-
this.canvasContext.activeConext =
|
|
2414
|
+
render(e) {
|
|
2415
|
+
let t = e;
|
|
2416
|
+
if (t instanceof N && (t = { container: t }), this.renderedObject = t.container, t.transform || (t.container.updateLocalTransform(), t.transform = t.container.localTransform), t.clearColor != null || (t.clearColor = this.background.color), !t.container.visible) return;
|
|
2417
|
+
t.container.enableRenderGroup();
|
|
2418
|
+
let n = t.container.renderGroup;
|
|
2419
|
+
if (this.activeRenderGroup = n, this.canvasContext.globalTransform = n.worldTransform, this.canvasContext.activeConext = this.canvasContext.rootContext, t.target) {
|
|
2420
|
+
let { context: e } = mt(t.target.source);
|
|
2421
|
+
this.canvasContext.activeConext = e;
|
|
2176
2422
|
}
|
|
2177
|
-
this.clear(
|
|
2178
|
-
var
|
|
2179
|
-
(
|
|
2423
|
+
this.clear(t), Y.forEach((e) => {
|
|
2424
|
+
var n, r;
|
|
2425
|
+
(n = (r = this[e.desc.name]).render) == null || n.call(r, t);
|
|
2180
2426
|
});
|
|
2181
2427
|
}
|
|
2182
|
-
clear(
|
|
2183
|
-
let
|
|
2184
|
-
|
|
2428
|
+
clear(e) {
|
|
2429
|
+
let t = this.canvasContext.activeConext;
|
|
2430
|
+
t.setTransform(1, 0, 0, 1, 0, 0), t.clearRect(0, 0, this.canvas.width, this.canvas.height), t.globalAlpha = 1, t.fillStyle = e.clearColor, t.fillRect(0, 0, this.canvas.width, this.canvas.height), t.globalAlpha = 1;
|
|
2185
2431
|
}
|
|
2186
2432
|
destroy() {
|
|
2187
|
-
this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas),
|
|
2188
|
-
var
|
|
2189
|
-
(
|
|
2433
|
+
this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas), ft.forEach((e) => {
|
|
2434
|
+
var t;
|
|
2435
|
+
(t = this.renderPipes[e.desc.name]) == null || t.destroy();
|
|
2190
2436
|
}), this.renderPipes = null;
|
|
2191
2437
|
}
|
|
2192
|
-
resize(
|
|
2193
|
-
this.view.resize(
|
|
2438
|
+
resize(e, t, n) {
|
|
2439
|
+
this.view.resize(e, t, n), this.emit("resize", this.view.screen.width, this.view.screen.height, this.view.resolution);
|
|
2194
2440
|
}
|
|
2195
2441
|
};
|
|
2196
|
-
function
|
|
2197
|
-
let
|
|
2198
|
-
return
|
|
2199
|
-
canvas:
|
|
2200
|
-
context:
|
|
2442
|
+
function mt(e) {
|
|
2443
|
+
let t = e.resource;
|
|
2444
|
+
return t || (t = W(e.pixelWidth, e.pixelHeight), e.resource = t), (t.width !== e.pixelWidth || t.height !== e.pixelHeight) && (t.width = e.pixelWidth, t.height = e.pixelHeight), {
|
|
2445
|
+
canvas: t,
|
|
2446
|
+
context: t.getContext("2d")
|
|
2201
2447
|
};
|
|
2202
2448
|
}
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2449
|
+
//#endregion
|
|
2450
|
+
//#region lib/ticker/TickerListener.ts
|
|
2451
|
+
var X = class {
|
|
2452
|
+
constructor(e, t, n = 0, r = !1) {
|
|
2453
|
+
f(this, "next", null), f(this, "previous", null), f(this, "priority", 0), f(this, "_fn", void 0), f(this, "_context", void 0), f(this, "_once", void 0), f(this, "_destroyed", !1), this._fn = e, this._context = t, this.priority = n, this._once = r;
|
|
2206
2454
|
}
|
|
2207
|
-
match(
|
|
2208
|
-
return this._fn ===
|
|
2455
|
+
match(e, t) {
|
|
2456
|
+
return this._fn === e && this._context === t;
|
|
2209
2457
|
}
|
|
2210
|
-
emit(
|
|
2211
|
-
this._fn && (this._context ? this._fn.call(this._context,
|
|
2212
|
-
let
|
|
2213
|
-
return this._once && this.destroy(!0), this._destroyed && (this.next = null),
|
|
2458
|
+
emit(e) {
|
|
2459
|
+
this._fn && (this._context ? this._fn.call(this._context, e) : this._fn(e));
|
|
2460
|
+
let t = this.next;
|
|
2461
|
+
return this._once && this.destroy(!0), this._destroyed && (this.next = null), t;
|
|
2214
2462
|
}
|
|
2215
|
-
destroy(
|
|
2463
|
+
destroy(e) {
|
|
2216
2464
|
this._destroyed = !0, this._fn = null, this._context = null, this.previous && (this.previous.next = this.next), this.next && (this.next.previous = this.previous);
|
|
2217
|
-
let
|
|
2218
|
-
return this.next =
|
|
2465
|
+
let t = this.next;
|
|
2466
|
+
return this.next = e ? null : t, this.previous = null, t;
|
|
2219
2467
|
}
|
|
2220
|
-
connect(
|
|
2221
|
-
this.previous =
|
|
2468
|
+
connect(e) {
|
|
2469
|
+
this.previous = e, e.next && (e.next.previous = this), this.next = e.next, e.next = this;
|
|
2222
2470
|
}
|
|
2223
|
-
},
|
|
2471
|
+
}, Z = class e {
|
|
2224
2472
|
constructor() {
|
|
2225
|
-
this
|
|
2226
|
-
this._requestId = null, this.started && (this.update(
|
|
2473
|
+
f(this, "autoStart", !1), f(this, "deltaTime", 1), f(this, "deltaMS", void 0), f(this, "elapsedMS", void 0), f(this, "lastTime", -1), f(this, "speed", 1), f(this, "started", !1), f(this, "_tick", void 0), f(this, "_requestId", null), f(this, "_maxElapsedMS", 100), f(this, "_minElapsedMS", 0), f(this, "_lastFrame", -1), f(this, "_head", null), this._head = new X(null, null, Infinity), this.deltaMS = 1 / e.targetFPMS, this.elapsedMS = this.deltaMS, this._tick = (e) => {
|
|
2474
|
+
this._requestId = null, this.started && (this.update(e), this.started && this._requestId === null && (this._requestId = requestAnimationFrame(this._tick)));
|
|
2227
2475
|
};
|
|
2228
2476
|
}
|
|
2229
|
-
update(
|
|
2230
|
-
let
|
|
2231
|
-
if (
|
|
2232
|
-
if (
|
|
2233
|
-
let
|
|
2234
|
-
if (
|
|
2235
|
-
this._lastFrame =
|
|
2477
|
+
update(t = performance.now()) {
|
|
2478
|
+
let n;
|
|
2479
|
+
if (t > this.lastTime) {
|
|
2480
|
+
if (n = this.elapsedMS = t - this.lastTime, n > this._maxElapsedMS && (n = this._maxElapsedMS), n *= this.speed, this._minElapsedMS) {
|
|
2481
|
+
let e = t - this._lastFrame | 0;
|
|
2482
|
+
if (e < this._minElapsedMS) return;
|
|
2483
|
+
this._lastFrame = t - e % this._minElapsedMS;
|
|
2236
2484
|
}
|
|
2237
|
-
this.deltaMS =
|
|
2238
|
-
let
|
|
2239
|
-
for (;
|
|
2240
|
-
|
|
2485
|
+
this.deltaMS = n, this.deltaTime = this.deltaMS * e.targetFPMS;
|
|
2486
|
+
let r = this._head, i = r.next;
|
|
2487
|
+
for (; i;) i = i.emit(this);
|
|
2488
|
+
r.next || this._cancelIfNeeded();
|
|
2241
2489
|
} else this.deltaTime = this.deltaMS = this.elapsedMS = 0;
|
|
2242
|
-
this.lastTime =
|
|
2490
|
+
this.lastTime = t;
|
|
2243
2491
|
}
|
|
2244
2492
|
get FPS() {
|
|
2245
2493
|
return 1e3 / this.elapsedMS;
|
|
@@ -2247,27 +2495,28 @@ var TickerListener = class {
|
|
|
2247
2495
|
get maxFPS() {
|
|
2248
2496
|
return this._minElapsedMS ? Math.round(1e3 / this._minElapsedMS) : 0;
|
|
2249
2497
|
}
|
|
2250
|
-
set maxFPS(
|
|
2251
|
-
|
|
2498
|
+
set maxFPS(e) {
|
|
2499
|
+
e === 0 ? this._minElapsedMS = 0 : (e < this.minFPS && (this.minFPS = e), this._minElapsedMS = 1 / (e / 1e3));
|
|
2252
2500
|
}
|
|
2253
2501
|
get minFPS() {
|
|
2254
2502
|
return 1e3 / this._maxElapsedMS;
|
|
2255
2503
|
}
|
|
2256
|
-
set minFPS(
|
|
2257
|
-
|
|
2504
|
+
set minFPS(t) {
|
|
2505
|
+
let n = Math.min(Math.max(0, t) / 1e3, e.targetFPMS);
|
|
2506
|
+
this._maxElapsedMS = 1 / n, this._minElapsedMS && t > this.maxFPS && (this.maxFPS = t);
|
|
2258
2507
|
}
|
|
2259
|
-
add(
|
|
2260
|
-
let
|
|
2261
|
-
if (!
|
|
2508
|
+
add(e, t, n = 0) {
|
|
2509
|
+
let r = new X(e, t, n), i = this._head.next, a = this._head;
|
|
2510
|
+
if (!i) r.connect(a);
|
|
2262
2511
|
else {
|
|
2263
|
-
for (;
|
|
2264
|
-
if (
|
|
2265
|
-
|
|
2512
|
+
for (; i;) {
|
|
2513
|
+
if (r.priority > i.priority) {
|
|
2514
|
+
r.connect(a);
|
|
2266
2515
|
break;
|
|
2267
2516
|
}
|
|
2268
|
-
|
|
2517
|
+
a = i, i = i.next;
|
|
2269
2518
|
}
|
|
2270
|
-
|
|
2519
|
+
r.previous || r.connect(a);
|
|
2271
2520
|
}
|
|
2272
2521
|
return this._startIfPossible(), this;
|
|
2273
2522
|
}
|
|
@@ -2277,9 +2526,9 @@ var TickerListener = class {
|
|
|
2277
2526
|
stop() {
|
|
2278
2527
|
this.started && (this.started = !1, this._cancelIfNeeded());
|
|
2279
2528
|
}
|
|
2280
|
-
remove(
|
|
2281
|
-
let
|
|
2282
|
-
for (;
|
|
2529
|
+
remove(e, t) {
|
|
2530
|
+
let n = this._head.next;
|
|
2531
|
+
for (; n;) n = n.match(e, t) ? n.destroy() : n.next;
|
|
2283
2532
|
return this._head.next || this._cancelIfNeeded(), this;
|
|
2284
2533
|
}
|
|
2285
2534
|
_startIfPossible() {
|
|
@@ -2293,18 +2542,20 @@ var TickerListener = class {
|
|
|
2293
2542
|
}
|
|
2294
2543
|
destroy() {
|
|
2295
2544
|
this.stop();
|
|
2296
|
-
let
|
|
2297
|
-
for (;
|
|
2545
|
+
let e = this._head.next;
|
|
2546
|
+
for (; e;) e = e.destroy(!0);
|
|
2298
2547
|
this._head.destroy(), this._head = null;
|
|
2299
2548
|
}
|
|
2300
2549
|
};
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2550
|
+
f(Z, "targetFPMS", .06);
|
|
2551
|
+
//#endregion
|
|
2552
|
+
//#region lib/app/ResizePlugin.ts
|
|
2553
|
+
var Q = class {
|
|
2554
|
+
static init(e) {
|
|
2304
2555
|
Object.defineProperty(this, "resizeTo", {
|
|
2305
2556
|
configurable: !0,
|
|
2306
|
-
set(
|
|
2307
|
-
globalThis.removeEventListener("resize", this.queueResize), this._resizeTo =
|
|
2557
|
+
set(e) {
|
|
2558
|
+
globalThis.removeEventListener("resize", this.queueResize), this._resizeTo = e, e && (globalThis.addEventListener("resize", this.queueResize), this.resize());
|
|
2308
2559
|
},
|
|
2309
2560
|
get() {
|
|
2310
2561
|
return this._resizeTo;
|
|
@@ -2316,26 +2567,30 @@ var plugins = [class {
|
|
|
2316
2567
|
}, this.resize = () => {
|
|
2317
2568
|
if (!this._resizeTo) return;
|
|
2318
2569
|
this._cancelResize();
|
|
2319
|
-
let
|
|
2320
|
-
if (this._resizeTo === globalThis.window)
|
|
2570
|
+
let e, t;
|
|
2571
|
+
if (this._resizeTo === globalThis.window) e = globalThis.innerWidth, t = globalThis.innerHeight;
|
|
2321
2572
|
else {
|
|
2322
|
-
let { clientWidth:
|
|
2323
|
-
|
|
2573
|
+
let { clientWidth: n, clientHeight: r } = this._resizeTo;
|
|
2574
|
+
e = n, t = r;
|
|
2324
2575
|
}
|
|
2325
|
-
this.renderer.resize(
|
|
2326
|
-
}, this._resizeId = null, this._resizeTo = null, this.resizeTo =
|
|
2576
|
+
this.renderer.resize(e, t), this.render();
|
|
2577
|
+
}, this._resizeId = null, this._resizeTo = null, this.resizeTo = e.resizeTo || null;
|
|
2327
2578
|
}
|
|
2328
2579
|
static destroy() {
|
|
2329
2580
|
globalThis.removeEventListener("resize", this.queueResize), this._cancelResize(), this._cancelResize = null, this.queueResize = null, this.resizeTo = null, this.resize = null;
|
|
2330
2581
|
}
|
|
2331
|
-
}
|
|
2582
|
+
};
|
|
2583
|
+
f(Q, "resizeTo", void 0), f(Q, "queueResize", void 0), f(Q, "_resizeTo", void 0), f(Q, "_resizeId", void 0), f(Q, "resize", void 0), f(Q, "_cancelResize", void 0), f(Q, "renderer", void 0), f(Q, "render", void 0);
|
|
2584
|
+
//#endregion
|
|
2585
|
+
//#region lib/app/Application.ts
|
|
2586
|
+
var ht = [Q], gt = class {
|
|
2332
2587
|
constructor() {
|
|
2333
|
-
this
|
|
2588
|
+
f(this, "renderer", void 0), f(this, "stage", new N()), f(this, "_ticker", void 0);
|
|
2334
2589
|
}
|
|
2335
|
-
async init(
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
}), this.ticker = new
|
|
2590
|
+
async init(e = {}) {
|
|
2591
|
+
e = { ...e }, this.stage || (this.stage = new N()), this.renderer = new pt(), await this.renderer.init(e), ht.forEach((t) => {
|
|
2592
|
+
t.init.call(this, e);
|
|
2593
|
+
}), this.ticker = new Z(), (e.autoStart || e.autoStart == null) && this._ticker.start();
|
|
2339
2594
|
}
|
|
2340
2595
|
get canvas() {
|
|
2341
2596
|
return this.renderer.canvas;
|
|
@@ -2346,199 +2601,199 @@ var plugins = [class {
|
|
|
2346
2601
|
get ticker() {
|
|
2347
2602
|
return this._ticker;
|
|
2348
2603
|
}
|
|
2349
|
-
set ticker(
|
|
2350
|
-
this._ticker && this._ticker.remove(this.render, this), this._ticker =
|
|
2604
|
+
set ticker(e) {
|
|
2605
|
+
this._ticker && this._ticker.remove(this.render, this), this._ticker = e, e && e.add(this.render, this);
|
|
2351
2606
|
}
|
|
2352
2607
|
render() {
|
|
2353
2608
|
this.renderer.render({ container: this.stage });
|
|
2354
2609
|
}
|
|
2355
2610
|
destroy() {
|
|
2356
|
-
let
|
|
2357
|
-
if (
|
|
2358
|
-
|
|
2611
|
+
let e = ht.slice(0);
|
|
2612
|
+
if (e.reverse(), e.forEach((e) => {
|
|
2613
|
+
e.destroy.call(this);
|
|
2359
2614
|
}), this.stage.destroy(), this.stage = null, this.renderer.destroy(), this.renderer = null, this._ticker) {
|
|
2360
|
-
let
|
|
2361
|
-
this._ticker = null,
|
|
2615
|
+
let e = this._ticker;
|
|
2616
|
+
this._ticker = null, e.destroy();
|
|
2362
2617
|
}
|
|
2363
2618
|
}
|
|
2364
|
-
}
|
|
2365
|
-
const Cache = new class {
|
|
2619
|
+
}, $ = new class {
|
|
2366
2620
|
constructor() {
|
|
2367
2621
|
this._cache = /* @__PURE__ */ new Map(), this._cacheMap = /* @__PURE__ */ new Map();
|
|
2368
2622
|
}
|
|
2369
2623
|
reset() {
|
|
2370
2624
|
this._cache.clear(), this._cacheMap.clear();
|
|
2371
2625
|
}
|
|
2372
|
-
has(
|
|
2373
|
-
return this._cache.has(
|
|
2626
|
+
has(e) {
|
|
2627
|
+
return this._cache.has(e);
|
|
2374
2628
|
}
|
|
2375
|
-
get(
|
|
2376
|
-
let
|
|
2377
|
-
if (!
|
|
2378
|
-
return
|
|
2629
|
+
get(e) {
|
|
2630
|
+
let t = this._cache.get(e);
|
|
2631
|
+
if (!t) throw Error(`Asset ${e} not found`);
|
|
2632
|
+
return t;
|
|
2379
2633
|
}
|
|
2380
|
-
set(
|
|
2381
|
-
let
|
|
2382
|
-
|
|
2383
|
-
|
|
2634
|
+
set(e, t) {
|
|
2635
|
+
let n = Array.isArray(e) ? e : [e], r = /* @__PURE__ */ new Map();
|
|
2636
|
+
n.forEach((e) => {
|
|
2637
|
+
r.set(e, t);
|
|
2384
2638
|
});
|
|
2385
|
-
let
|
|
2386
|
-
cacheKeys:
|
|
2387
|
-
keys:
|
|
2639
|
+
let i = [...r.keys()], a = {
|
|
2640
|
+
cacheKeys: i,
|
|
2641
|
+
keys: n
|
|
2388
2642
|
};
|
|
2389
|
-
|
|
2390
|
-
this._cacheMap.set(
|
|
2391
|
-
}),
|
|
2392
|
-
this._cache.
|
|
2643
|
+
n.forEach((e) => {
|
|
2644
|
+
this._cacheMap.set(e, a);
|
|
2645
|
+
}), i.forEach((e) => {
|
|
2646
|
+
this._cache.set(e, r.get(e));
|
|
2393
2647
|
});
|
|
2394
2648
|
}
|
|
2395
|
-
remove(
|
|
2396
|
-
if (!this._cacheMap.has(
|
|
2397
|
-
let
|
|
2398
|
-
((
|
|
2399
|
-
this._cache.delete(
|
|
2400
|
-
}),
|
|
2401
|
-
this._cacheMap.delete(
|
|
2649
|
+
remove(e) {
|
|
2650
|
+
if (!this._cacheMap.has(e)) return;
|
|
2651
|
+
let t = this._cacheMap.get(e);
|
|
2652
|
+
((t == null ? void 0 : t.cacheKeys) || []).forEach((e) => {
|
|
2653
|
+
this._cache.delete(e);
|
|
2654
|
+
}), t == null || t.keys.forEach((e) => {
|
|
2655
|
+
this._cacheMap.delete(e);
|
|
2402
2656
|
});
|
|
2403
2657
|
}
|
|
2404
|
-
}()
|
|
2405
|
-
var _Loader, Loader = class n {
|
|
2658
|
+
}(), _t = class e {
|
|
2406
2659
|
constructor() {
|
|
2407
|
-
this
|
|
2408
|
-
}
|
|
2409
|
-
getAlias(
|
|
2410
|
-
let { alias:
|
|
2411
|
-
return (Array.isArray(
|
|
2412
|
-
var
|
|
2413
|
-
return (
|
|
2414
|
-
}) :
|
|
2415
|
-
}
|
|
2416
|
-
async load(
|
|
2417
|
-
let { onProgress:
|
|
2418
|
-
...
|
|
2660
|
+
f(this, "promiseCache", {}), f(this, "loadOptions", { ...e.defaultOptions });
|
|
2661
|
+
}
|
|
2662
|
+
getAlias(e) {
|
|
2663
|
+
let { alias: t, src: n } = e, r = t || n;
|
|
2664
|
+
return (Array.isArray(r) ? r : [r]).map((e) => typeof e == "string" ? e : Array.isArray(e) ? e.map((e) => {
|
|
2665
|
+
var t;
|
|
2666
|
+
return (t = e.src) == null ? e : t;
|
|
2667
|
+
}) : e != null && e.src ? e.src : e);
|
|
2668
|
+
}
|
|
2669
|
+
async load(t, n) {
|
|
2670
|
+
let { onProgress: r, onError: i, strategy: a, retryCount: o, retryDelay: s } = typeof n == "function" ? {
|
|
2671
|
+
...e.defaultOptions,
|
|
2419
2672
|
...this.loadOptions,
|
|
2420
|
-
onProgress:
|
|
2673
|
+
onProgress: n
|
|
2421
2674
|
} : {
|
|
2422
|
-
...
|
|
2675
|
+
...e.defaultOptions,
|
|
2423
2676
|
...this.loadOptions,
|
|
2424
|
-
...
|
|
2425
|
-
},
|
|
2426
|
-
if (
|
|
2427
|
-
let
|
|
2428
|
-
await this._loadAssetWithRetry(
|
|
2429
|
-
onProgress:
|
|
2430
|
-
onError:
|
|
2431
|
-
strategy:
|
|
2432
|
-
retryCount:
|
|
2433
|
-
retryDelay:
|
|
2434
|
-
},
|
|
2677
|
+
...n || {}
|
|
2678
|
+
}, c = 0, l = {}, u = t.reduce((e, t) => e + (t.progressSize || 1), 0), d = t.map(async (e) => {
|
|
2679
|
+
if (l[e.src]) return;
|
|
2680
|
+
let t = e.src;
|
|
2681
|
+
await this._loadAssetWithRetry(t, e, {
|
|
2682
|
+
onProgress: r,
|
|
2683
|
+
onError: i,
|
|
2684
|
+
strategy: a,
|
|
2685
|
+
retryCount: o,
|
|
2686
|
+
retryDelay: s
|
|
2687
|
+
}, l), c += e.progressSize || 1, r && r(c / u);
|
|
2435
2688
|
});
|
|
2436
|
-
return await Promise.all(
|
|
2437
|
-
}
|
|
2438
|
-
async unload(
|
|
2439
|
-
let
|
|
2440
|
-
let
|
|
2441
|
-
if (
|
|
2442
|
-
let
|
|
2443
|
-
delete this.promiseCache[
|
|
2689
|
+
return await Promise.all(d), l;
|
|
2690
|
+
}
|
|
2691
|
+
async unload(e) {
|
|
2692
|
+
let t = e.map(async (e) => {
|
|
2693
|
+
let t = e.src, n = this.promiseCache[t];
|
|
2694
|
+
if (n) {
|
|
2695
|
+
let e = await n;
|
|
2696
|
+
delete this.promiseCache[t], e.destroy(!0);
|
|
2444
2697
|
}
|
|
2445
2698
|
});
|
|
2446
|
-
await Promise.all(
|
|
2699
|
+
await Promise.all(t);
|
|
2447
2700
|
}
|
|
2448
|
-
_getLoadPromise(
|
|
2449
|
-
return (async () => await
|
|
2701
|
+
_getLoadPromise(e, t) {
|
|
2702
|
+
return (async () => await vt(e, t, this))();
|
|
2450
2703
|
}
|
|
2451
|
-
async _loadAssetWithRetry(
|
|
2452
|
-
let
|
|
2704
|
+
async _loadAssetWithRetry(e, t, n, r) {
|
|
2705
|
+
let i = 0, { onError: a, strategy: o, retryCount: s, retryDelay: c } = n, l = (e) => new Promise((t) => setTimeout(t, e));
|
|
2453
2706
|
for (;;) try {
|
|
2454
|
-
this.promiseCache[
|
|
2707
|
+
this.promiseCache[e] || (this.promiseCache[e] = this._getLoadPromise(e, t)), r[t.src] = await this.promiseCache[e];
|
|
2455
2708
|
return;
|
|
2456
|
-
} catch (
|
|
2457
|
-
if (delete this.promiseCache[
|
|
2458
|
-
|
|
2709
|
+
} catch (n) {
|
|
2710
|
+
if (delete this.promiseCache[e], delete r[t.src], i++, o === "retry" && !(o !== "retry" || i > s)) {
|
|
2711
|
+
a && a(n, t.src), await l(c);
|
|
2459
2712
|
continue;
|
|
2460
2713
|
}
|
|
2461
|
-
if (
|
|
2462
|
-
|
|
2714
|
+
if (o === "skip") {
|
|
2715
|
+
a && a(n, t.src);
|
|
2463
2716
|
return;
|
|
2464
2717
|
}
|
|
2465
|
-
|
|
2466
|
-
let
|
|
2467
|
-
throw
|
|
2718
|
+
a && a(n, t.src);
|
|
2719
|
+
let u = /* @__PURE__ */ Error(`[Loader.load] Failed to load ${e}.\n${n}`);
|
|
2720
|
+
throw n instanceof Error && n.stack && (u.stack = n.stack), u;
|
|
2468
2721
|
}
|
|
2469
2722
|
}
|
|
2470
2723
|
reset() {
|
|
2471
2724
|
this.promiseCache = {};
|
|
2472
2725
|
}
|
|
2473
2726
|
};
|
|
2474
|
-
|
|
2727
|
+
f(_t, "defaultOptions", {
|
|
2475
2728
|
strategy: "throw",
|
|
2476
2729
|
retryCount: 3,
|
|
2477
2730
|
retryDelay: 250
|
|
2478
|
-
};
|
|
2479
|
-
async function
|
|
2480
|
-
let
|
|
2481
|
-
return
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
},
|
|
2485
|
-
}),
|
|
2731
|
+
});
|
|
2732
|
+
async function vt(e, t, n) {
|
|
2733
|
+
let r = null;
|
|
2734
|
+
return r = globalThis.createImageBitmap ? await yt(e) : await new Promise((t, n) => {
|
|
2735
|
+
r = new Image(), r.crossOrigin = "anonymous", r.src = e, r.complete ? t(r) : (r.onload = () => {
|
|
2736
|
+
t(r);
|
|
2737
|
+
}, r.onerror = n);
|
|
2738
|
+
}), bt(new G({ resource: r }), n, e);
|
|
2486
2739
|
}
|
|
2487
|
-
async function
|
|
2488
|
-
let
|
|
2489
|
-
if (
|
|
2490
|
-
let
|
|
2491
|
-
return window.createImageBitmap(
|
|
2740
|
+
async function yt(e) {
|
|
2741
|
+
let t = await window.fetch(e);
|
|
2742
|
+
if (t.headers.get("content-type") === "text/html" || !t.ok) throw Error(`[loadImageBitmap] Failed to fetch ${e}: ${t.status} ${t.statusText}`);
|
|
2743
|
+
let n = await t.blob();
|
|
2744
|
+
return window.createImageBitmap(n);
|
|
2492
2745
|
}
|
|
2493
|
-
function
|
|
2494
|
-
|
|
2495
|
-
let
|
|
2496
|
-
source:
|
|
2497
|
-
label:
|
|
2498
|
-
}),
|
|
2499
|
-
delete
|
|
2746
|
+
function bt(e, t, n) {
|
|
2747
|
+
e.label = n;
|
|
2748
|
+
let r = new K({
|
|
2749
|
+
source: e,
|
|
2750
|
+
label: n
|
|
2751
|
+
}), i = () => {
|
|
2752
|
+
delete t.promiseCache[n], $.has(n) && $.remove(n);
|
|
2500
2753
|
};
|
|
2501
|
-
return
|
|
2502
|
-
|
|
2503
|
-
}),
|
|
2504
|
-
|
|
2505
|
-
}),
|
|
2754
|
+
return r.source.on("destroy", () => {
|
|
2755
|
+
t.promiseCache[n] && i();
|
|
2756
|
+
}), r.on("destroy", () => {
|
|
2757
|
+
e.destroyed || i();
|
|
2758
|
+
}), r;
|
|
2506
2759
|
}
|
|
2507
|
-
|
|
2760
|
+
//#endregion
|
|
2761
|
+
//#region lib/assets/Assets.ts
|
|
2762
|
+
var xt = class {
|
|
2508
2763
|
constructor() {
|
|
2509
|
-
this
|
|
2764
|
+
f(this, "cache", void 0), f(this, "loader", void 0), f(this, "basePath", void 0), f(this, "_initialized", !1), this.loader = new _t(), this.cache = $;
|
|
2510
2765
|
}
|
|
2511
|
-
init(
|
|
2512
|
-
this._initialized || (this._initialized = !0,
|
|
2766
|
+
init(e = {}) {
|
|
2767
|
+
this._initialized || (this._initialized = !0, e.basePath && (this.basePath = e.basePath), e.loadOptions && (this.loader.loadOptions = {
|
|
2513
2768
|
...this.loader.loadOptions,
|
|
2514
|
-
...
|
|
2769
|
+
...e.loadOptions
|
|
2515
2770
|
}));
|
|
2516
2771
|
}
|
|
2517
|
-
async load(
|
|
2772
|
+
async load(e, t) {
|
|
2518
2773
|
this._initialized || this.init();
|
|
2519
|
-
let
|
|
2520
|
-
...
|
|
2521
|
-
src:
|
|
2774
|
+
let n = e.map((e) => ({
|
|
2775
|
+
...e,
|
|
2776
|
+
src: Ct(e.src, this.basePath)
|
|
2522
2777
|
}));
|
|
2523
|
-
return await this._mapLoadToResolve(
|
|
2778
|
+
return await this._mapLoadToResolve(n, t);
|
|
2524
2779
|
}
|
|
2525
|
-
async _mapLoadToResolve(
|
|
2526
|
-
let
|
|
2527
|
-
return
|
|
2528
|
-
let
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
}),
|
|
2532
|
-
}),
|
|
2780
|
+
async _mapLoadToResolve(e, t) {
|
|
2781
|
+
let n = Object.values(e), r = await this.loader.load(n, t), i = {};
|
|
2782
|
+
return n.forEach((e) => {
|
|
2783
|
+
let t = r[e.src], n = Array.isArray(e.alias) ? e.alias : [e.alias], a = [e.src, ...n];
|
|
2784
|
+
a.forEach((e) => {
|
|
2785
|
+
i[e] = t;
|
|
2786
|
+
}), $.set(a, t);
|
|
2787
|
+
}), i;
|
|
2533
2788
|
}
|
|
2534
2789
|
reset() {
|
|
2535
2790
|
this._initialized = !1, this.cache.reset(), this.loader.reset();
|
|
2536
2791
|
}
|
|
2537
|
-
};
|
|
2538
|
-
|
|
2539
|
-
|
|
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}`;
|
|
2792
|
+
}, St = new xt();
|
|
2793
|
+
function Ct(e, t) {
|
|
2794
|
+
return e.startsWith("http") || !t ? e : e.startsWith("/") && t.endsWith("/") ? t + e.slice(1) : e.startsWith("/") && !t.endsWith("/") || !e.startsWith("/") && t.endsWith("/") ? t + e : `${t}/${e}`;
|
|
2541
2795
|
}
|
|
2542
|
-
|
|
2796
|
+
//#endregion
|
|
2797
|
+
export { gt as Application, St as Assets, xt as AssetsClass, pt as CanvasRenderer, N as Container, Le as Graphics, R as GraphicsContext, z as GraphicsPipe, _ as Matrix, g as PI_2, y as Rectangle, _e as RenderGroup, Qe as RenderTexture, $e as Sprite, et as Text, V as TextPipe, K as Texture, Z as Ticker, X as TickerListener, xe as UPDATE_BLEND, be as UPDATE_COLOR, Ce as UPDATE_TRANSFORM, Se as UPDATE_VISIBLE, b as Vector2, P as ViewContainer, B as buildShapePath, x as nextPow2 };
|
|
2543
2798
|
|
|
2544
2799
|
//# sourceMappingURL=dao.js.map
|