modern-canvas 0.5.0 → 0.5.2
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 +14 -22
- package/dist/index.d.cts +0 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +20 -20
- package/dist/index.mjs +14 -22
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -4294,7 +4294,7 @@ function parseCSSFilter(filter) {
|
|
|
4294
4294
|
|
|
4295
4295
|
function parseCSSTransform(transform, width, height, output = new Transform2D()) {
|
|
4296
4296
|
transform = !transform || transform === "none" ? "" : transform;
|
|
4297
|
-
parseCssFunctions(transform, { width, height }).forEach(({ name, args }) => {
|
|
4297
|
+
parseCssFunctions(transform, { width, height }).reverse().forEach(({ name, args }) => {
|
|
4298
4298
|
const values = args.map((arg) => arg.normalizedIntValue);
|
|
4299
4299
|
switch (name) {
|
|
4300
4300
|
case "translate":
|
|
@@ -9312,7 +9312,6 @@ class BaseElement2DText extends CoreObject {
|
|
|
9312
9312
|
this.parent = parent;
|
|
9313
9313
|
}
|
|
9314
9314
|
base = new Text();
|
|
9315
|
-
texture = new CanvasTexture();
|
|
9316
9315
|
measureResult;
|
|
9317
9316
|
setProperties(properties) {
|
|
9318
9317
|
return super.setProperties(
|
|
@@ -9351,29 +9350,23 @@ class BaseElement2DText extends CoreObject {
|
|
|
9351
9350
|
}
|
|
9352
9351
|
canDraw() {
|
|
9353
9352
|
return Boolean(
|
|
9354
|
-
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9353
|
+
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
9355
9354
|
);
|
|
9356
9355
|
}
|
|
9357
9356
|
draw() {
|
|
9358
|
-
this.base.render({
|
|
9359
|
-
pixelRatio: this.texture.pixelRatio,
|
|
9360
|
-
view: this.texture.source
|
|
9361
|
-
});
|
|
9362
|
-
this.texture.requestUpload();
|
|
9363
|
-
const textWidth = this.measureResult?.boundingBox.width ?? this.parent.size.width;
|
|
9364
|
-
const textHeight = this.measureResult?.boundingBox.height ?? this.parent.size.height;
|
|
9365
9357
|
const ctx = this.parent.context;
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9358
|
+
this.base.update();
|
|
9359
|
+
this.base.paragraphs.forEach((p) => {
|
|
9360
|
+
p.fragments.forEach((f) => {
|
|
9361
|
+
f.characters.forEach((c) => {
|
|
9362
|
+
ctx.fillStyle = c.computedStyle.color;
|
|
9363
|
+
ctx.addPath(c.path);
|
|
9364
|
+
ctx.style.fillRule = "evenodd";
|
|
9365
|
+
ctx.closePath();
|
|
9366
|
+
ctx.fill();
|
|
9367
|
+
});
|
|
9368
|
+
});
|
|
9369
|
+
});
|
|
9377
9370
|
}
|
|
9378
9371
|
}
|
|
9379
9372
|
__decorateClass$o([
|
|
@@ -9784,7 +9777,6 @@ let BaseElement2D = class extends Node2D {
|
|
|
9784
9777
|
}
|
|
9785
9778
|
if (this._text.canDraw()) {
|
|
9786
9779
|
this._tree?.log(this.name, "draw text");
|
|
9787
|
-
this._shape.drawRect();
|
|
9788
9780
|
this._text.draw();
|
|
9789
9781
|
}
|
|
9790
9782
|
this._drawContent();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modern-canvas",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "A JavaScript WebGL rendering engine.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -78,10 +78,10 @@
|
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@antfu/eslint-config": "^4.16.1",
|
|
80
80
|
"@types/earcut": "^3.0.0",
|
|
81
|
-
"@types/node": "^24.0.
|
|
81
|
+
"@types/node": "^24.0.7",
|
|
82
82
|
"bumpp": "^10.2.0",
|
|
83
83
|
"conventional-changelog-cli": "^5.0.0",
|
|
84
|
-
"eslint": "^9.
|
|
84
|
+
"eslint": "^9.30.0",
|
|
85
85
|
"lint-staged": "^16.1.2",
|
|
86
86
|
"lottie-web": "^5.13.0",
|
|
87
87
|
"modern-gif": "^2.0.4",
|