modern-canvas 0.6.9 → 0.6.11
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 +36 -40
- 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 +46 -95
- package/dist/index.mjs +36 -40
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -5593,7 +5593,6 @@ function getNodeIid(key) {
|
|
|
5593
5593
|
return iid;
|
|
5594
5594
|
}
|
|
5595
5595
|
let Node = class extends CoreObject {
|
|
5596
|
-
meta = {};
|
|
5597
5596
|
_readyed = false;
|
|
5598
5597
|
constructor(properties, nodes = []) {
|
|
5599
5598
|
super();
|
|
@@ -6082,6 +6081,9 @@ __decorateClass$R([
|
|
|
6082
6081
|
__decorateClass$R([
|
|
6083
6082
|
property({ fallback: "default" })
|
|
6084
6083
|
], Node.prototype, "internalMode", 2);
|
|
6084
|
+
__decorateClass$R([
|
|
6085
|
+
property({ default: () => ({}) })
|
|
6086
|
+
], Node.prototype, "meta", 2);
|
|
6085
6087
|
__decorateClass$R([
|
|
6086
6088
|
property({ protected: true })
|
|
6087
6089
|
], Node.prototype, "mask", 2);
|
|
@@ -7095,29 +7097,26 @@ class CanvasContext extends Path2D {
|
|
|
7095
7097
|
}
|
|
7096
7098
|
}
|
|
7097
7099
|
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();
|
|
7100
|
+
if (!this.curves.length) {
|
|
7101
|
+
return;
|
|
7120
7102
|
}
|
|
7103
|
+
const strokeStyle = this.strokeStyle ?? (typeof this.style.stroke === "string" ? this.style.stroke : void 0);
|
|
7104
|
+
this._draws.push({
|
|
7105
|
+
...options,
|
|
7106
|
+
type: "stroke",
|
|
7107
|
+
path: new Path2D(this),
|
|
7108
|
+
texture: strokeStyle ? this._toTexture(strokeStyle) : this._defaultStyle,
|
|
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();
|
|
7121
7120
|
}
|
|
7122
7121
|
fillRect(x, y, width, height) {
|
|
7123
7122
|
this.rect(x, y, width, height).fill();
|
|
@@ -7126,16 +7125,15 @@ class CanvasContext extends Path2D {
|
|
|
7126
7125
|
this.rect(x, y, width, height).stroke();
|
|
7127
7126
|
}
|
|
7128
7127
|
fill(options) {
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
if (this.fillStyle) {
|
|
7132
|
-
texture = this._toTexture(this.fillStyle);
|
|
7128
|
+
if (!this.curves.length) {
|
|
7129
|
+
return;
|
|
7133
7130
|
}
|
|
7131
|
+
const fillStyle = this.fillStyle ?? (typeof this.style.fill === "string" ? this.style.fill : void 0);
|
|
7134
7132
|
this._draws.push({
|
|
7135
7133
|
...options,
|
|
7136
7134
|
type: "fill",
|
|
7137
|
-
path,
|
|
7138
|
-
texture,
|
|
7135
|
+
path: new Path2D(this),
|
|
7136
|
+
texture: fillStyle ? this._toTexture(fillStyle) : this._defaultStyle,
|
|
7139
7137
|
uvTransform: this.uvTransform,
|
|
7140
7138
|
vertTransform: this.vertTransform
|
|
7141
7139
|
});
|
|
@@ -9326,15 +9324,13 @@ class BaseElement2DText extends CoreObject {
|
|
|
9326
9324
|
draw() {
|
|
9327
9325
|
const ctx = this.parent.context;
|
|
9328
9326
|
this.base.update();
|
|
9329
|
-
this.base.
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
ctx.fill();
|
|
9337
|
-
});
|
|
9327
|
+
this.base.pathSets.forEach((pathSet) => {
|
|
9328
|
+
pathSet.paths.forEach((path) => {
|
|
9329
|
+
ctx.addPath(path);
|
|
9330
|
+
ctx.style = { ...path.style };
|
|
9331
|
+
ctx.fillStyle = void 0;
|
|
9332
|
+
ctx.strokeStyle = void 0;
|
|
9333
|
+
ctx.fill();
|
|
9338
9334
|
});
|
|
9339
9335
|
});
|
|
9340
9336
|
}
|
|
@@ -9383,7 +9379,7 @@ let Node2D = class extends CanvasItem {
|
|
|
9383
9379
|
super._updateProperty(key, value, oldValue, declaration);
|
|
9384
9380
|
switch (key) {
|
|
9385
9381
|
case "rotation":
|
|
9386
|
-
this.
|
|
9382
|
+
this.requestRelayout();
|
|
9387
9383
|
break;
|
|
9388
9384
|
}
|
|
9389
9385
|
}
|
|
@@ -13578,7 +13574,7 @@ let CanvasItemEditor = class extends Control {
|
|
|
13578
13574
|
style: {
|
|
13579
13575
|
width: 500,
|
|
13580
13576
|
height: 500,
|
|
13581
|
-
backgroundColor: "#
|
|
13577
|
+
backgroundColor: "#00FFFFFF",
|
|
13582
13578
|
// overflow: 'hidden',
|
|
13583
13579
|
pointerEvents: "none"
|
|
13584
13580
|
// 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.11",
|
|
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": {
|