modern-canvas 0.23.8 → 0.23.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +20 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6692,14 +6692,26 @@ function Di(e) {
6692
6692
  };
6693
6693
  }
6694
6694
  function Oi(e, t, n, r, i = {}) {
6695
- let a = Math.max(1, Math.round(n)), o = Math.max(1, Math.round(r)), s = S(a, o), c = Ci(s);
6696
- for (let n of t) {
6697
- let t = e;
6698
- n.fill && (n.fill.color || n.fill.linearGradient || n.fill.image) && (t = Ti(t, a, o, n.fill, i)), n.outline?.width && n.outline.color && (t = Ei(t, a, o, n.outline.width, n.outline.color));
6699
- let { x: r, y: s } = Di(n.transform);
6700
- c.save(), c.globalCompositeOperation = "destination-over", n.shadow && (c.shadowColor = n.shadow.color, c.shadowBlur = n.shadow.blur ?? 0, c.shadowOffsetX = n.shadow.offsetX ?? 0, c.shadowOffsetY = n.shadow.offsetY ?? 0), c.drawImage(t, r, s, a, o), c.restore();
6701
- }
6702
- return s;
6695
+ let a = Math.max(1, Math.round(n)), o = Math.max(1, Math.round(r)), s = 0;
6696
+ for (let e of t) {
6697
+ e.outline?.width && e.outline.color && (s = Math.max(s, e.outline.width));
6698
+ let t = Di(e.transform);
6699
+ s = Math.max(s, Math.abs(t.x), Math.abs(t.y));
6700
+ }
6701
+ s = Math.min(Math.ceil(s), Math.floor(Math.min(a, o) * .2));
6702
+ let c = e;
6703
+ if (s > 0) {
6704
+ let t = S(a, o);
6705
+ Ci(t).drawImage(e, s, s, Math.max(1, a - s * 2), Math.max(1, o - s * 2)), c = t;
6706
+ }
6707
+ let l = S(a, o), u = Ci(l);
6708
+ for (let e of t) {
6709
+ let t = c;
6710
+ e.fill && (e.fill.color || e.fill.linearGradient || e.fill.image) && (t = Ti(t, a, o, e.fill, i)), e.outline?.width && e.outline.color && (t = Ei(t, a, o, e.outline.width, e.outline.color));
6711
+ let { x: n, y: r } = Di(e.transform);
6712
+ u.save(), u.globalCompositeOperation = "destination-over", e.shadow && (u.shadowColor = e.shadow.color, u.shadowBlur = e.shadow.blur ?? 0, u.shadowOffsetX = e.shadow.offsetX ?? 0, u.shadowOffsetY = e.shadow.offsetY ?? 0), u.drawImage(t, n, r, a, o), u.restore();
6713
+ }
6714
+ return l;
6703
6715
  }
6704
6716
  //#endregion
6705
6717
  //#region src/scene/2d/element/Element2DForeground.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.23.8",
4
+ "version": "0.23.9",
5
5
  "packageManager": "pnpm@10.19.0",
6
6
  "description": "A JavaScript WebGL rendering engine. only the ESM.",
7
7
  "author": "wxm",