modern-canvas 0.4.24 → 0.4.26
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 +4 -20
- 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 +4 -20
- 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;
|
|
@@ -9752,11 +9736,11 @@ let Element2D = class extends BaseElement2D {
|
|
|
9752
9736
|
break;
|
|
9753
9737
|
case "width":
|
|
9754
9738
|
this.size.width = Number(value);
|
|
9755
|
-
this.
|
|
9739
|
+
this.requestRedraw();
|
|
9756
9740
|
break;
|
|
9757
9741
|
case "height":
|
|
9758
9742
|
this.size.height = Number(value);
|
|
9759
|
-
this.
|
|
9743
|
+
this.requestRedraw();
|
|
9760
9744
|
break;
|
|
9761
9745
|
}
|
|
9762
9746
|
}
|
|
@@ -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
|
}
|
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.26",
|
|
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
|
},
|