modern-canvas 0.27.14 → 0.27.16

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 +11 -8
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -2199,7 +2199,10 @@ void main(void) {
2199
2199
  this._vertexCount + r > this._batchSize && this.flush(), this._vertexCount += r, this._indexCount += n.length, this._batchables.push(e);
2200
2200
  }
2201
2201
  flush() {
2202
- if (super.flush(), this._vertexCount === 0) return;
2202
+ if (super.flush(), this._vertexCount === 0) {
2203
+ this._batchables = [], this._indexCount = 0;
2204
+ return;
2205
+ }
2203
2206
  let e = this._vertexCount, t = this._indexCount, n = this._batchables;
2204
2207
  this._batchables = [], this._vertexCount = 0, this._indexCount = 0;
2205
2208
  let r = this._renderer.texture.maxTextureImageUnits, i = this._getProgram(r), a = this._slotIndex >= Cn, o = this._getSlot(), s = this._effects.some((e) => e.name === "flowStreak" && e.uvNormalized), c = o.refs, l = !a && o.drawCalls.length > 0 && o.effectsRevision === this._effectsRevision && c.length === n.length * Sn;
@@ -7381,7 +7384,7 @@ var Qi = class extends w {
7381
7384
  let { data: n, ...r } = e, i = new ue();
7382
7385
  i.style = r, i.addData(n), this._path2DSet.paths[t] = i;
7383
7386
  });
7384
- if (!e) {
7387
+ if (e ??= this.viewBox, !e) {
7385
7388
  let t = this._path2DSet.getBoundingBox();
7386
7389
  e = t ? [
7387
7390
  t.x,
@@ -10354,22 +10357,22 @@ async function Do(e = 100) {
10354
10357
  }
10355
10358
  }
10356
10359
  async function Oo(e) {
10357
- let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], imagePipelineResolver: s, onBefore: c, onKeyframe: l, ...u } = e, d = Math.max(1, Math.floor(r)), f = Math.max(1, Math.floor(i)), p = Eo();
10358
- if (p.resetProperties(), p.setProperties(u), p.debug = t, p.fonts = n, p.timeline.currentTime = 0, p.resizeForExport(d, f), p.imagePipelineResolver = s, p.root.removeChildren(!0), p.root.append(a), await c?.(p), await p.waitUntilProcessed(), o.length) {
10360
+ let { debug: t = !1, fonts: n, width: r, height: i, data: a, keyframes: o = [], imagePipelineResolver: s, onBefore: c, onKeyframe: l, ...u } = e, d = (e) => Number.isFinite(e) ? Math.floor(e) : 0, f = Math.max(1, d(r)), p = Math.max(1, d(i)), m = Eo();
10361
+ if (m.resetProperties(), m.setProperties(u), m.debug = t, m.fonts = n, m.timeline.currentTime = 0, m.resizeForExport(f, p), m.imagePipelineResolver = s, m.root.removeChildren(!0), m.root.append(a), await c?.(m), await m.waitUntilProcessed(), o.length) {
10359
10362
  let e = o.length, t = o[e - 1];
10360
10363
  for (let n = 0; n < e; n++) {
10361
10364
  let e = o[n], r = (o[n + 1] || e) - e;
10362
- p.timeline.currentTime = e, await p.waitUntilProcessed(), await l?.(p.toPixels(), {
10365
+ m.timeline.currentTime = e, await m.waitUntilProcessed(), await l?.(m.toPixels(), {
10363
10366
  currentTime: e,
10364
10367
  duration: r,
10365
10368
  progress: t === 0 ? 1 : e / t
10366
10369
  });
10367
10370
  }
10368
10371
  }
10369
- let m = p.toPixels();
10372
+ let h = m.toPixels();
10370
10373
  return {
10371
- pixels: m,
10372
- toCanvas2D: () => p.toCanvas2D(new ImageData(m, d, f))
10374
+ pixels: h,
10375
+ toCanvas2D: () => m.toCanvas2D(new ImageData(h, f, p))
10373
10376
  };
10374
10377
  }
10375
10378
  async function ko(e) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.27.14",
4
+ "version": "0.27.16",
5
5
  "packageManager": "pnpm@10.19.0",
6
6
  "description": "A JavaScript WebGL rendering engine. only the ESM.",
7
7
  "author": "wxm",
@@ -62,10 +62,10 @@
62
62
  "dependencies": {
63
63
  "colord": "^2.9.3",
64
64
  "earcut": "^3.2.0",
65
- "modern-font": "^0.6.2",
65
+ "modern-font": "^0.6.3",
66
66
  "modern-idoc": "^0.12.4",
67
67
  "modern-path2d": "^1.8.8",
68
- "modern-text": "^2.1.3"
68
+ "modern-text": "^2.2.3"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "echarts": "^5 || ^6",