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.cjs
CHANGED
|
@@ -1082,6 +1082,7 @@ class Color {
|
|
|
1082
1082
|
if (parsed.isValid()) {
|
|
1083
1083
|
this._colord = parsed;
|
|
1084
1084
|
} else {
|
|
1085
|
+
this._colord = colord.colord("#000000");
|
|
1085
1086
|
console.warn(`Unable to convert color ${value}`);
|
|
1086
1087
|
}
|
|
1087
1088
|
}
|
|
@@ -9172,27 +9173,10 @@ __decorateClass$p([
|
|
|
9172
9173
|
], BaseElement2DShadow.prototype, "offsetX");
|
|
9173
9174
|
|
|
9174
9175
|
class BaseElement2DStyle extends Resource {
|
|
9175
|
-
_backgroundColor = new Color();
|
|
9176
9176
|
constructor(properties) {
|
|
9177
9177
|
super();
|
|
9178
9178
|
this.setProperties(properties);
|
|
9179
9179
|
}
|
|
9180
|
-
_updateProperty(key, value, oldValue, declaration) {
|
|
9181
|
-
super._updateProperty(key, value, oldValue, declaration);
|
|
9182
|
-
switch (key) {
|
|
9183
|
-
case "backgroundColor":
|
|
9184
|
-
this._backgroundColor.value = this.backgroundColor === "none" ? void 0 : this.backgroundColor;
|
|
9185
|
-
break;
|
|
9186
|
-
}
|
|
9187
|
-
}
|
|
9188
|
-
getComputedBackgroundColor() {
|
|
9189
|
-
return this._backgroundColor;
|
|
9190
|
-
}
|
|
9191
|
-
async loadBackgroundImage() {
|
|
9192
|
-
if (this.backgroundImage && this.backgroundImage !== "none") {
|
|
9193
|
-
return await assets.texture.load(this.backgroundImage);
|
|
9194
|
-
}
|
|
9195
|
-
}
|
|
9196
9180
|
}
|
|
9197
9181
|
const defaultStyles$1 = modernIdoc.getDefaultStyle();
|
|
9198
9182
|
delete defaultStyles$1.top;
|
|
@@ -10282,7 +10266,7 @@ exports.Image2D = class Image2D extends exports.Element2D {
|
|
|
10282
10266
|
if (src) {
|
|
10283
10267
|
try {
|
|
10284
10268
|
this.setResource(
|
|
10285
|
-
this.gif ? await assets.gif.load(src) : await assets.texture.load(src)
|
|
10269
|
+
this.gif || src?.includes(".gif") ? await assets.gif.load(src) : await assets.texture.load(src)
|
|
10286
10270
|
);
|
|
10287
10271
|
this.requestRedraw();
|
|
10288
10272
|
this.emit("load");
|
|
@@ -10322,7 +10306,7 @@ exports.Image2D = class Image2D extends exports.Element2D {
|
|
|
10322
10306
|
}
|
|
10323
10307
|
if (this._frameIndex !== index) {
|
|
10324
10308
|
this._frameIndex = index;
|
|
10325
|
-
this.
|
|
10309
|
+
this.requestRedraw();
|
|
10326
10310
|
}
|
|
10327
10311
|
return this;
|
|
10328
10312
|
}
|
|
@@ -10343,7 +10327,7 @@ exports.Image2D = class Image2D extends exports.Element2D {
|
|
|
10343
10327
|
const tx = left * width * sx;
|
|
10344
10328
|
const ty = top * height * sy;
|
|
10345
10329
|
this.context.textureTransform = new Transform2D().scale(sx, sy).translate(tx, ty);
|
|
10346
|
-
this.geometry.
|
|
10330
|
+
this.geometry.draw();
|
|
10347
10331
|
this.context.fill();
|
|
10348
10332
|
}
|
|
10349
10333
|
}
|
|
@@ -10438,7 +10422,7 @@ exports.Lottie2D = class Lottie2D extends TextureRect2D {
|
|
|
10438
10422
|
_process(delta) {
|
|
10439
10423
|
this.animation?.goToAndStop(this.currentTime, false);
|
|
10440
10424
|
this.texture.requestUpload();
|
|
10441
|
-
this.
|
|
10425
|
+
this.requestRedraw();
|
|
10442
10426
|
super._process(delta);
|
|
10443
10427
|
}
|
|
10444
10428
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1920,11 +1920,7 @@ interface BaseElement2DStyleProperties extends Omit<StyleDeclaration, 'left' | '
|
|
|
1920
1920
|
interface BaseElement2DStyle extends BaseElement2DStyleProperties {
|
|
1921
1921
|
}
|
|
1922
1922
|
declare class BaseElement2DStyle extends Resource {
|
|
1923
|
-
protected _backgroundColor: Color;
|
|
1924
1923
|
constructor(properties?: Partial<BaseElement2DStyleProperties>);
|
|
1925
|
-
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1926
|
-
getComputedBackgroundColor(): Color;
|
|
1927
|
-
loadBackgroundImage(): Promise<Texture2D<ImageBitmap> | undefined>;
|
|
1928
1924
|
}
|
|
1929
1925
|
|
|
1930
1926
|
type BaseElement2DTextProperties = TextOptions;
|
package/dist/index.d.mts
CHANGED
|
@@ -1920,11 +1920,7 @@ interface BaseElement2DStyleProperties extends Omit<StyleDeclaration, 'left' | '
|
|
|
1920
1920
|
interface BaseElement2DStyle extends BaseElement2DStyleProperties {
|
|
1921
1921
|
}
|
|
1922
1922
|
declare class BaseElement2DStyle extends Resource {
|
|
1923
|
-
protected _backgroundColor: Color;
|
|
1924
1923
|
constructor(properties?: Partial<BaseElement2DStyleProperties>);
|
|
1925
|
-
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1926
|
-
getComputedBackgroundColor(): Color;
|
|
1927
|
-
loadBackgroundImage(): Promise<Texture2D<ImageBitmap> | undefined>;
|
|
1928
1924
|
}
|
|
1929
1925
|
|
|
1930
1926
|
type BaseElement2DTextProperties = TextOptions;
|
package/dist/index.d.ts
CHANGED
|
@@ -1920,11 +1920,7 @@ interface BaseElement2DStyleProperties extends Omit<StyleDeclaration, 'left' | '
|
|
|
1920
1920
|
interface BaseElement2DStyle extends BaseElement2DStyleProperties {
|
|
1921
1921
|
}
|
|
1922
1922
|
declare class BaseElement2DStyle extends Resource {
|
|
1923
|
-
protected _backgroundColor: Color;
|
|
1924
1923
|
constructor(properties?: Partial<BaseElement2DStyleProperties>);
|
|
1925
|
-
protected _updateProperty(key: PropertyKey, value: any, oldValue: any, declaration?: PropertyDeclaration): void;
|
|
1926
|
-
getComputedBackgroundColor(): Color;
|
|
1927
|
-
loadBackgroundImage(): Promise<Texture2D<ImageBitmap> | undefined>;
|
|
1928
1924
|
}
|
|
1929
1925
|
|
|
1930
1926
|
type BaseElement2DTextProperties = TextOptions;
|