modern-canvas 0.4.48 → 0.4.50
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.cjs +7 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -29
- package/dist/index.mjs +7 -4
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -9164,7 +9164,7 @@ class BaseElement2DOutline extends BaseElement2DFill {
|
|
|
9164
9164
|
draw() {
|
|
9165
9165
|
const ctx = this.parent.context;
|
|
9166
9166
|
const { textureTransform, disableWrapMode } = this._getDrawOptions();
|
|
9167
|
-
ctx.lineWidth = this.width;
|
|
9167
|
+
ctx.lineWidth = this.width || 1;
|
|
9168
9168
|
ctx.textureTransform = textureTransform;
|
|
9169
9169
|
ctx.strokeStyle = this._texture ?? this.color;
|
|
9170
9170
|
ctx.stroke({ disableWrapMode });
|
|
@@ -9276,9 +9276,8 @@ class BaseElement2DShape extends CoreObject {
|
|
|
9276
9276
|
if (this.svg) {
|
|
9277
9277
|
const dom = svgToDOM(this.svg);
|
|
9278
9278
|
this._path2DSet = svgToPath2DSet(dom);
|
|
9279
|
-
viewBox = this._path2DSet.viewBox
|
|
9279
|
+
viewBox = this._path2DSet.viewBox;
|
|
9280
9280
|
} else {
|
|
9281
|
-
viewBox = this.viewBox;
|
|
9282
9281
|
this.paths?.forEach((path, i) => {
|
|
9283
9282
|
const { data, ...style } = path;
|
|
9284
9283
|
const path2D = new Path2D();
|
|
@@ -9287,6 +9286,10 @@ class BaseElement2DShape extends CoreObject {
|
|
|
9287
9286
|
this._path2DSet.paths[i] = path2D;
|
|
9288
9287
|
});
|
|
9289
9288
|
}
|
|
9289
|
+
if (!viewBox) {
|
|
9290
|
+
const bbox = this._path2DSet.getBoundingBox();
|
|
9291
|
+
viewBox = bbox ? [bbox.x, bbox.y, bbox.width, bbox.height] : [0, 0, 1, 1];
|
|
9292
|
+
}
|
|
9290
9293
|
const [x, y, w, h] = viewBox;
|
|
9291
9294
|
this._path2DSet.paths.forEach((path) => {
|
|
9292
9295
|
path.applyTransform(new Matrix3$1().translate(-x, -y).scale(1 / w, 1 / h));
|
|
@@ -9323,7 +9326,7 @@ __decorateClass$p([
|
|
|
9323
9326
|
property()
|
|
9324
9327
|
], BaseElement2DShape.prototype, "svg");
|
|
9325
9328
|
__decorateClass$p([
|
|
9326
|
-
property(
|
|
9329
|
+
property()
|
|
9327
9330
|
], BaseElement2DShape.prototype, "viewBox");
|
|
9328
9331
|
__decorateClass$p([
|
|
9329
9332
|
property({ default: () => [] })
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-canvas",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.50",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "A JavaScript WebGL rendering engine.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -71,18 +71,18 @@
|
|
|
71
71
|
"earcut": "^3.0.1",
|
|
72
72
|
"modern-font": "^0.4.1",
|
|
73
73
|
"modern-idoc": "^0.6.9",
|
|
74
|
-
"modern-path2d": "^1.3.
|
|
74
|
+
"modern-path2d": "^1.3.2",
|
|
75
75
|
"modern-text": "^1.4.2",
|
|
76
76
|
"yoga-layout": "^3.2.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@antfu/eslint-config": "^4.13.2",
|
|
80
80
|
"@types/earcut": "^3.0.0",
|
|
81
|
-
"@types/node": "^22.15.
|
|
81
|
+
"@types/node": "^22.15.23",
|
|
82
82
|
"bumpp": "^10.1.1",
|
|
83
83
|
"conventional-changelog-cli": "^5.0.0",
|
|
84
84
|
"eslint": "^9.27.0",
|
|
85
|
-
"lint-staged": "^16.
|
|
85
|
+
"lint-staged": "^16.1.0",
|
|
86
86
|
"lottie-web": "^5.13.0",
|
|
87
87
|
"modern-gif": "^2.0.4",
|
|
88
88
|
"simple-git-hooks": "^2.13.0",
|