modern-canvas 0.4.26 → 0.4.28

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.mjs CHANGED
@@ -10260,7 +10260,7 @@ let Image2D = class extends Element2D {
10260
10260
  if (src) {
10261
10261
  try {
10262
10262
  this.setResource(
10263
- this.gif ? await assets.gif.load(src) : await assets.texture.load(src)
10263
+ this.gif || src?.includes(".gif") ? await assets.gif.load(src) : await assets.texture.load(src)
10264
10264
  );
10265
10265
  this.requestRedraw();
10266
10266
  this.emit("load");
@@ -10300,7 +10300,7 @@ let Image2D = class extends Element2D {
10300
10300
  }
10301
10301
  if (this._frameIndex !== index) {
10302
10302
  this._frameIndex = index;
10303
- this.requestRepaint();
10303
+ this.requestRedraw();
10304
10304
  }
10305
10305
  return this;
10306
10306
  }
@@ -10416,7 +10416,7 @@ let Lottie2D = class extends TextureRect2D {
10416
10416
  _process(delta) {
10417
10417
  this.animation?.goToAndStop(this.currentTime, false);
10418
10418
  this.texture.requestUpload();
10419
- this.requestRepaint();
10419
+ this.requestRedraw();
10420
10420
  super._process(delta);
10421
10421
  }
10422
10422
  };
@@ -10532,13 +10532,12 @@ let Text2D = class extends TextureRect2D {
10532
10532
  }
10533
10533
  updateMeasure() {
10534
10534
  this.measureResult = this.measure();
10535
- const textWidth = this.measureResult.boundingBox.width;
10536
- const textHeight = this.measureResult.boundingBox.height;
10537
- const { left, top, width, height = textHeight } = this.style;
10538
- this.position.x = left + Math.min(0, ((width || textWidth) - textWidth) / 2);
10539
- this.position.y = top + Math.min(0, ((height || textHeight) - textHeight) / 2);
10540
- this.size.width = textWidth;
10541
- this.size.height = textHeight;
10535
+ const { boundingBox } = this.measureResult;
10536
+ const { left, top } = this.style;
10537
+ this.position.x = left + Math.min(0, boundingBox.left);
10538
+ this.position.y = top + Math.min(0, boundingBox.top);
10539
+ this.size.width = boundingBox.width;
10540
+ this.size.height = boundingBox.height;
10542
10541
  return this;
10543
10542
  }
10544
10543
  _updateSplit() {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.4.26",
4
+ "version": "0.4.28",
5
5
  "packageManager": "pnpm@9.15.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",
@@ -69,27 +69,27 @@
69
69
  "dependencies": {
70
70
  "colord": "^2.9.3",
71
71
  "earcut": "^3.0.1",
72
- "modern-font": "^0.4.0",
72
+ "modern-font": "^0.4.1",
73
73
  "modern-idoc": "^0.2.13",
74
74
  "modern-path2d": "^1.2.18",
75
- "modern-text": "^1.3.1",
75
+ "modern-text": "^1.3.2",
76
76
  "yoga-layout": "^3.2.1"
77
77
  },
78
78
  "devDependencies": {
79
- "@antfu/eslint-config": "^4.8.1",
79
+ "@antfu/eslint-config": "^4.11.0",
80
80
  "@types/earcut": "^3.0.0",
81
- "@types/node": "^22.13.10",
82
- "bumpp": "^10.0.3",
81
+ "@types/node": "^22.13.14",
82
+ "bumpp": "^10.1.0",
83
83
  "conventional-changelog-cli": "^5.0.0",
84
- "eslint": "^9.22.0",
85
- "lint-staged": "^15.4.3",
84
+ "eslint": "^9.23.0",
85
+ "lint-staged": "^15.5.0",
86
86
  "lottie-web": "^5.12.2",
87
87
  "modern-gif": "^2.0.4",
88
- "simple-git-hooks": "^2.11.1",
88
+ "simple-git-hooks": "^2.12.1",
89
89
  "typescript": "^5.8.2",
90
90
  "unbuild": "^3.5.0",
91
- "vite": "^6.2.1",
92
- "vitest": "^3.0.8"
91
+ "vite": "^6.2.3",
92
+ "vitest": "^3.0.9"
93
93
  },
94
94
  "simple-git-hooks": {
95
95
  "pre-commit": "pnpm lint-staged"