modern-canvas 0.4.25 → 0.4.27
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 +5 -21
- package/dist/index.d.cts +0 -4
- package/dist/index.d.mts +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.js +31 -31
- package/dist/index.mjs +5 -21
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1076,6 +1076,7 @@ class Color {
|
|
|
1076
1076
|
if (parsed.isValid()) {
|
|
1077
1077
|
this._colord = parsed;
|
|
1078
1078
|
} else {
|
|
1079
|
+
this._colord = colord("#000000");
|
|
1079
1080
|
console.warn(`Unable to convert color ${value}`);
|
|
1080
1081
|
}
|
|
1081
1082
|
}
|
|
@@ -9166,27 +9167,10 @@ __decorateClass$p([
|
|
|
9166
9167
|
], BaseElement2DShadow.prototype, "offsetX");
|
|
9167
9168
|
|
|
9168
9169
|
class BaseElement2DStyle extends Resource {
|
|
9169
|
-
_backgroundColor = new Color();
|
|
9170
9170
|
constructor(properties) {
|
|
9171
9171
|
super();
|
|
9172
9172
|
this.setProperties(properties);
|
|
9173
9173
|
}
|
|
9174
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
9175
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
9176
|
-
switch (key) {
|
|
9177
|
-
case "backgroundColor":
|
|
9178
|
-
this._backgroundColor.value = this.backgroundColor === "none" ? void 0 : this.backgroundColor;
|
|
9179
|
-
break;
|
|
9180
|
-
}
|
|
9181
|
-
}
|
|
9182
|
-
getComputedBackgroundColor() {
|
|
9183
|
-
return this._backgroundColor;
|
|
9184
|
-
}
|
|
9185
|
-
async loadBackgroundImage() {
|
|
9186
|
-
if (this.backgroundImage && this.backgroundImage !== "none") {
|
|
9187
|
-
return await assets.texture.load(this.backgroundImage);
|
|
9188
|
-
}
|
|
9189
|
-
}
|
|
9190
9174
|
}
|
|
9191
9175
|
const defaultStyles$1 = getDefaultStyle();
|
|
9192
9176
|
delete defaultStyles$1.top;
|
|
@@ -10276,7 +10260,7 @@ let Image2D = class extends Element2D {
|
|
|
10276
10260
|
if (src) {
|
|
10277
10261
|
try {
|
|
10278
10262
|
this.setResource(
|
|
10279
|
-
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)
|
|
10280
10264
|
);
|
|
10281
10265
|
this.requestRedraw();
|
|
10282
10266
|
this.emit("load");
|
|
@@ -10316,7 +10300,7 @@ let Image2D = class extends Element2D {
|
|
|
10316
10300
|
}
|
|
10317
10301
|
if (this._frameIndex !== index) {
|
|
10318
10302
|
this._frameIndex = index;
|
|
10319
|
-
this.
|
|
10303
|
+
this.requestRedraw();
|
|
10320
10304
|
}
|
|
10321
10305
|
return this;
|
|
10322
10306
|
}
|
|
@@ -10337,7 +10321,7 @@ let Image2D = class extends Element2D {
|
|
|
10337
10321
|
const tx = left * width * sx;
|
|
10338
10322
|
const ty = top * height * sy;
|
|
10339
10323
|
this.context.textureTransform = new Transform2D().scale(sx, sy).translate(tx, ty);
|
|
10340
|
-
this.geometry.
|
|
10324
|
+
this.geometry.draw();
|
|
10341
10325
|
this.context.fill();
|
|
10342
10326
|
}
|
|
10343
10327
|
}
|
|
@@ -10432,7 +10416,7 @@ let Lottie2D = class extends TextureRect2D {
|
|
|
10432
10416
|
_process(delta) {
|
|
10433
10417
|
this.animation?.goToAndStop(this.currentTime, false);
|
|
10434
10418
|
this.texture.requestUpload();
|
|
10435
|
-
this.
|
|
10419
|
+
this.requestRedraw();
|
|
10436
10420
|
super._process(delta);
|
|
10437
10421
|
}
|
|
10438
10422
|
};
|
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.27",
|
|
5
5
|
"packageManager": "pnpm@9.15.1",
|
|
6
6
|
"description": "A JavaScript WebGL rendering engine.",
|
|
7
7
|
"author": "wxm",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"earcut": "^3.0.1",
|
|
72
72
|
"modern-font": "^0.4.0",
|
|
73
73
|
"modern-idoc": "^0.2.13",
|
|
74
|
-
"modern-path2d": "^1.2.
|
|
74
|
+
"modern-path2d": "^1.2.18",
|
|
75
75
|
"modern-text": "^1.3.1",
|
|
76
76
|
"yoga-layout": "^3.2.1"
|
|
77
77
|
},
|