modern-canvas 0.24.8 → 0.24.10

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.
Files changed (2) hide show
  1. package/dist/index.js +18 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4758,7 +4758,7 @@ var U = class extends V {
4758
4758
  this.width = e, this.height = t;
4759
4759
  }
4760
4760
  activate(e, t) {
4761
- return this.valid ? (this.flush(e), this.renderTarget.activate(e, t), e.shader.uniforms.viewMatrix = this.canvasTransform.toArray(!0), e.shader.markGlobalUniformsDirty(), this._tree?.setCurrentViewport(this), !0) : !1;
4761
+ return this.valid ? (this.flush(e), e.shader.uniforms.viewMatrix = this.canvasTransform.toArray(!0), e.shader.markGlobalUniformsDirty(), this.renderTarget.activate(e, t), this._tree?.setCurrentViewport(this), !0) : !1;
4762
4762
  }
4763
4763
  redraw(e, t) {
4764
4764
  if (this.valid) {
@@ -9712,7 +9712,7 @@ async function no(e = 100) {
9712
9712
  }
9713
9713
  }
9714
9714
  async function ro(e) {
9715
- 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 = to();
9715
+ let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], onBefore: s, onKeyframe: c, ...l } = e, u = Math.max(1, Math.floor(r)), d = Math.max(1, Math.floor(i)), f = to();
9716
9716
  if (f.resetProperties(), f.setProperties(l), f.debug = t, f.fonts = n, f.timeline.currentTime = 0, f.resizeForExport(u, d), f.root.removeChildren(!0), f.root.append(a), await s?.(f), await f.waitUntilProcessed(), o.length) {
9717
9717
  let e = o.length, t = o[e - 1];
9718
9718
  for (let n = 0; n < e; n++) {
@@ -9731,13 +9731,25 @@ async function ro(e) {
9731
9731
  };
9732
9732
  }
9733
9733
  async function io(e) {
9734
- return new Promise((t) => {
9735
- $a.push(async () => t(await ro(e).then((e) => e.toCanvas2D()))), no();
9734
+ return new Promise((t, n) => {
9735
+ $a.push(async () => {
9736
+ try {
9737
+ t(await ro(e).then((e) => e.toCanvas2D()));
9738
+ } catch (e) {
9739
+ n(e);
9740
+ }
9741
+ }), no();
9736
9742
  });
9737
9743
  }
9738
9744
  async function ao(e) {
9739
- return new Promise((t) => {
9740
- $a.push(async () => t(await ro(e).then((e) => e.pixels))), no();
9745
+ return new Promise((t, n) => {
9746
+ $a.push(async () => {
9747
+ try {
9748
+ t(await ro(e).then((e) => e.pixels));
9749
+ } catch (e) {
9750
+ n(e);
9751
+ }
9752
+ }), no();
9741
9753
  });
9742
9754
  }
9743
9755
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.24.8",
4
+ "version": "0.24.10",
5
5
  "packageManager": "pnpm@10.19.0",
6
6
  "description": "A JavaScript WebGL rendering engine. only the ESM.",
7
7
  "author": "wxm",