modern-canvas 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +15 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7190,7 +7190,7 @@ var Qi, $i = class extends Ji {
|
|
|
7190
7190
|
let t = new AbortController();
|
|
7191
7191
|
this._loadAbort = t;
|
|
7192
7192
|
let { signal: n } = t, r = await $.video.load(e);
|
|
7193
|
-
n.aborted || (this.texture = r, this._updateVideoCurrentTime(),
|
|
7193
|
+
n.aborted || (this.texture = r, this._updateVideoCurrentTime(), this.requestDraw());
|
|
7194
7194
|
}
|
|
7195
7195
|
_destroy() {
|
|
7196
7196
|
this._loadAbort?.abort(), super._destroy();
|
|
@@ -7199,7 +7199,7 @@ var Qi, $i = class extends Ji {
|
|
|
7199
7199
|
let e = this.texture;
|
|
7200
7200
|
if (e && !e.isPlaying && !e.seeking) {
|
|
7201
7201
|
let t = ~~Math.max(0, this.currentTime % this.videoDuration) / 1e3;
|
|
7202
|
-
e.currentTime !== t && (e.currentTime = t);
|
|
7202
|
+
e.currentTime !== t && (e.currentTime = t, $.awaitBy(() => e.waitSeek(this._loadAbort?.signal)));
|
|
7203
7203
|
}
|
|
7204
7204
|
}
|
|
7205
7205
|
_process(e) {
|
|
@@ -8401,7 +8401,7 @@ var Va = "WeakRef" in globalThis, Ha = class extends e {
|
|
|
8401
8401
|
return r === void 0 && (r = n.type?.split(";")[0] ?? void 0), ((r ? this._handlers.get(r) : void 0) ?? this.defaultHandler)(n, t);
|
|
8402
8402
|
}
|
|
8403
8403
|
async waitUntilLoad() {
|
|
8404
|
-
await Promise.all(Array.from(this._handleing.values()).map((e) => e.catch((e) => {
|
|
8404
|
+
for (; this._handleing.size > 0;) await Promise.all(Array.from(this._handleing.values()).map((e) => e.catch((e) => {
|
|
8405
8405
|
console.error(e);
|
|
8406
8406
|
})));
|
|
8407
8407
|
}
|
|
@@ -8495,7 +8495,7 @@ var Va = "WeakRef" in globalThis, Ha = class extends e {
|
|
|
8495
8495
|
await $.waitUntilLoad(), await this.nextTick();
|
|
8496
8496
|
}
|
|
8497
8497
|
async waitAndRender(e = 0) {
|
|
8498
|
-
await $.waitUntilLoad(), this._process(e), await this.nextTick(), this._render(this.renderer);
|
|
8498
|
+
await $.waitUntilLoad(), this._process(e), await $.waitUntilLoad(), await this.nextTick(), this._render(this.renderer);
|
|
8499
8499
|
}
|
|
8500
8500
|
render(e, t = 0) {
|
|
8501
8501
|
e ? this.renderStack.push(e) : (this._process(t), this._render(this.renderer));
|
|
@@ -8568,19 +8568,17 @@ async function Ya(e = 100) {
|
|
|
8568
8568
|
}
|
|
8569
8569
|
async function Xa(e) {
|
|
8570
8570
|
let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.floor(r), d = Math.floor(i), f = Ja();
|
|
8571
|
-
f.resetProperties(), f.setProperties(l), f.debug = t, f.fonts = n, f.timeline.currentTime = 0, f.resize(u, d, !0), f.root.removeChildren(!0), f.root.append(a), await s?.(f), await f.waitAndRender(), o.length
|
|
8572
|
-
let
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
i();
|
|
8583
|
-
});
|
|
8571
|
+
if (f.resetProperties(), f.setProperties(l), f.debug = t, f.fonts = n, f.timeline.currentTime = 0, f.resize(u, d, !0), f.root.removeChildren(!0), f.root.append(a), await s?.(f), await f.waitAndRender(), o.length) {
|
|
8572
|
+
let e = o.length, t = o[e - 1];
|
|
8573
|
+
for (let n = 0; n < e; n++) {
|
|
8574
|
+
let e = o[n], r = (o[n + 1] || e) - e;
|
|
8575
|
+
f.timeline.currentTime = e, await f.waitAndRender(), await c?.(f.toPixels(), {
|
|
8576
|
+
currentTime: e,
|
|
8577
|
+
duration: r,
|
|
8578
|
+
progress: t === 0 ? 1 : e / t
|
|
8579
|
+
});
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8584
8582
|
let p = f.toPixels();
|
|
8585
8583
|
return {
|
|
8586
8584
|
pixels: p,
|