modern-canvas 0.6.9 → 0.6.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.
- package/dist/index.cjs +33 -39
- package/dist/index.js +46 -95
- package/dist/index.mjs +33 -39
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -7095,29 +7095,26 @@ class CanvasContext extends Path2D {
|
|
|
7095
7095
|
}
|
|
7096
7096
|
}
|
|
7097
7097
|
stroke(options) {
|
|
7098
|
-
|
|
7099
|
-
|
|
7100
|
-
if (this.strokeStyle) {
|
|
7101
|
-
texture = this._toTexture(this.strokeStyle);
|
|
7102
|
-
}
|
|
7103
|
-
if (this.curves.length) {
|
|
7104
|
-
this._draws.push({
|
|
7105
|
-
...options,
|
|
7106
|
-
type: "stroke",
|
|
7107
|
-
path,
|
|
7108
|
-
texture,
|
|
7109
|
-
uvTransform: this.uvTransform,
|
|
7110
|
-
vertTransform: this.vertTransform,
|
|
7111
|
-
style: {
|
|
7112
|
-
alignment: 0.5,
|
|
7113
|
-
cap: this.lineCap ?? "butt",
|
|
7114
|
-
join: this.lineJoin ?? "miter",
|
|
7115
|
-
width: this.lineWidth ?? 1,
|
|
7116
|
-
miterLimit: this.miterLimit ?? 10
|
|
7117
|
-
}
|
|
7118
|
-
});
|
|
7119
|
-
super.reset();
|
|
7098
|
+
if (!this.curves.length) {
|
|
7099
|
+
return;
|
|
7120
7100
|
}
|
|
7101
|
+
const strokeStyle = this.strokeStyle ?? (typeof this.style.stroke === "string" ? this.style.stroke : void 0);
|
|
7102
|
+
this._draws.push({
|
|
7103
|
+
...options,
|
|
7104
|
+
type: "stroke",
|
|
7105
|
+
path: new Path2D(this),
|
|
7106
|
+
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
7107
|
+
uvTransform: this.uvTransform,
|
|
7108
|
+
vertTransform: this.vertTransform,
|
|
7109
|
+
style: {
|
|
7110
|
+
alignment: 0.5,
|
|
7111
|
+
cap: this.lineCap ?? "butt",
|
|
7112
|
+
join: this.lineJoin ?? "miter",
|
|
7113
|
+
width: this.lineWidth ?? 1,
|
|
7114
|
+
miterLimit: this.miterLimit ?? 10
|
|
7115
|
+
}
|
|
7116
|
+
});
|
|
7117
|
+
super.reset();
|
|
7121
7118
|
}
|
|
7122
7119
|
fillRect(x, y, width, height) {
|
|
7123
7120
|
this.rect(x, y, width, height).fill();
|
|
@@ -7126,16 +7123,15 @@ class CanvasContext extends Path2D {
|
|
|
7126
7123
|
this.rect(x, y, width, height).stroke();
|
|
7127
7124
|
}
|
|
7128
7125
|
fill(options) {
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
if (this.fillStyle) {
|
|
7132
|
-
texture = this._toTexture(this.fillStyle);
|
|
7126
|
+
if (!this.curves.length) {
|
|
7127
|
+
return;
|
|
7133
7128
|
}
|
|
7129
|
+
const fillStyle = this.fillStyle ?? (typeof this.style.fill === "string" ? this.style.fill : void 0);
|
|
7134
7130
|
this._draws.push({
|
|
7135
7131
|
...options,
|
|
7136
7132
|
type: "fill",
|
|
7137
|
-
path,
|
|
7138
|
-
texture,
|
|
7133
|
+
path: new Path2D(this),
|
|
7134
|
+
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
7139
7135
|
uvTransform: this.uvTransform,
|
|
7140
7136
|
vertTransform: this.vertTransform
|
|
7141
7137
|
});
|
|
@@ -9326,15 +9322,13 @@ class BaseElement2DText extends CoreObject {
|
|
|
9326
9322
|
draw() {
|
|
9327
9323
|
const ctx = this.parent.context;
|
|
9328
9324
|
this.base.update();
|
|
9329
|
-
this.base.
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
ctx.fill();
|
|
9337
|
-
});
|
|
9325
|
+
this.base.pathSets.forEach((pathSet) => {
|
|
9326
|
+
pathSet.paths.forEach((path) => {
|
|
9327
|
+
ctx.addPath(path);
|
|
9328
|
+
ctx.style = { ...path.style };
|
|
9329
|
+
ctx.fillStyle = void 0;
|
|
9330
|
+
ctx.strokeStyle = void 0;
|
|
9331
|
+
ctx.fill();
|
|
9338
9332
|
});
|
|
9339
9333
|
});
|
|
9340
9334
|
}
|
|
@@ -9383,7 +9377,7 @@ let Node2D = class extends CanvasItem {
|
|
|
9383
9377
|
super._updateProperty(key, value, oldValue, declaration);
|
|
9384
9378
|
switch (key) {
|
|
9385
9379
|
case "rotation":
|
|
9386
|
-
this.
|
|
9380
|
+
this.requestRelayout();
|
|
9387
9381
|
break;
|
|
9388
9382
|
}
|
|
9389
9383
|
}
|
|
@@ -13578,7 +13572,7 @@ let CanvasItemEditor = class extends Control {
|
|
|
13578
13572
|
style: {
|
|
13579
13573
|
width: 500,
|
|
13580
13574
|
height: 500,
|
|
13581
|
-
backgroundColor: "#
|
|
13575
|
+
backgroundColor: "#00FFFFFF",
|
|
13582
13576
|
// overflow: 'hidden',
|
|
13583
13577
|
pointerEvents: "none"
|
|
13584
13578
|
// boxShadow: '2px 2px 2px 1px rgba(0, 0, 0, 0.2)',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-canvas",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.10",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "A JavaScript WebGL rendering engine.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -70,15 +70,15 @@
|
|
|
70
70
|
"colord": "^2.9.3",
|
|
71
71
|
"earcut": "^3.0.1",
|
|
72
72
|
"modern-font": "^0.4.1",
|
|
73
|
-
"modern-idoc": "^0.8.
|
|
74
|
-
"modern-path2d": "^1.4.
|
|
75
|
-
"modern-text": "^1.6.
|
|
73
|
+
"modern-idoc": "^0.8.4",
|
|
74
|
+
"modern-path2d": "^1.4.3",
|
|
75
|
+
"modern-text": "^1.6.4",
|
|
76
76
|
"yoga-layout": "^3.2.1"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@antfu/eslint-config": "^4.16.2",
|
|
80
80
|
"@types/earcut": "^3.0.0",
|
|
81
|
-
"@types/node": "^24.0.
|
|
81
|
+
"@types/node": "^24.0.12",
|
|
82
82
|
"bumpp": "^10.2.0",
|
|
83
83
|
"conventional-changelog-cli": "^5.0.0",
|
|
84
84
|
"eslint": "^9.30.1",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"simple-git-hooks": "^2.13.0",
|
|
89
89
|
"typescript": "^5.8.3",
|
|
90
90
|
"unbuild": "^3.5.0",
|
|
91
|
-
"vite": "^7.0.
|
|
91
|
+
"vite": "^7.0.3",
|
|
92
92
|
"vitest": "^3.2.4"
|
|
93
93
|
},
|
|
94
94
|
"simple-git-hooks": {
|