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 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;
@@ -9758,11 +9742,11 @@ exports.Element2D = class Element2D extends exports.BaseElement2D {
9758
9742
  break;
9759
9743
  case "width":
9760
9744
  this.size.width = Number(value);
9761
- this.requestRelayout();
9745
+ this.requestRedraw();
9762
9746
  break;
9763
9747
  case "height":
9764
9748
  this.size.height = Number(value);
9765
- this.requestRelayout();
9749
+ this.requestRedraw();
9766
9750
  break;
9767
9751
  }
9768
9752
  }
@@ -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.drawRect();
10330
+ this.geometry.draw();
10347
10331
  this.context.fill();
10348
10332
  }
10349
10333
  }
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;