modern-canvas 0.12.1 → 0.12.3

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
@@ -1,4 +1,4 @@
1
- import { defineProperty, Observable, Reactivable, parseColor, property, RawWeakMap as RawWeakMap$1, isGradient, isColorFillObject, clearUndef, idGenerator, normalizeFill, isNone, normalizeBackground, normalizeForeground, normalizeOutline, normalizeShadow, normalizeShape, getDefaultStyle, normalizeText, normalizeTextContent } from 'modern-idoc';
1
+ import { defineProperty, Observable, Reactivable, parseColor, property, RawWeakMap as RawWeakMap$1, isGradient, isColorFillObject, clearUndef, idGenerator, normalizeFill, isNone, normalizeBackground, normalizeForeground, normalizeOutline, normalizeShadow, normalizeShape, getDefaultStyle, normalizeText, normalizeTextContent, getDefaultTextStyle, getDefaultLayoutStyle } from 'modern-idoc';
2
2
  import { fonts } from 'modern-font';
3
3
  import { extend } from 'colord';
4
4
  import namesPlugin from 'colord/plugins/names';
@@ -10088,9 +10088,9 @@ class BaseElement2DText extends CoreObject {
10088
10088
  this.parent = parent;
10089
10089
  this.base = new Text();
10090
10090
  this.base.setPropertyAccessor(this);
10091
+ this.update();
10091
10092
  }
10092
10093
  base;
10093
- measureResult;
10094
10094
  _texture = new CanvasTexture();
10095
10095
  _textureMap = /* @__PURE__ */ new Map();
10096
10096
  setProperties(properties) {
@@ -10181,10 +10181,6 @@ class BaseElement2DText extends CoreObject {
10181
10181
  this.update();
10182
10182
  return this.base.measure();
10183
10183
  }
10184
- updateMeasure() {
10185
- this.measureResult = this.measure();
10186
- return this;
10187
- }
10188
10184
  isValid() {
10189
10185
  return Boolean(
10190
10186
  this.enabled && !/^\s*$/.test(this.base.toString())
@@ -10325,6 +10321,8 @@ var __decorateClass$e = (decorators, target, key, kind) => {
10325
10321
  result = (decorator(result)) || result;
10326
10322
  return result;
10327
10323
  };
10324
+ const layoutStyle = new Set(Object.keys(getDefaultLayoutStyle()));
10325
+ const textStyles = new Set(Object.keys(getDefaultTextStyle()));
10328
10326
  let BaseElement2D = class extends Node2D {
10329
10327
  size = new Vector2().on("update", () => {
10330
10328
  this.updateGlobalTransform();
@@ -10485,6 +10483,12 @@ let BaseElement2D = class extends Node2D {
10485
10483
  this.requestRedraw();
10486
10484
  break;
10487
10485
  }
10486
+ if (textStyles.has(key) || layoutStyle.has(key)) {
10487
+ if (this.text.isValid()) {
10488
+ this.text.update();
10489
+ this.requestRedraw();
10490
+ }
10491
+ }
10488
10492
  }
10489
10493
  _process(delta) {
10490
10494
  this.foreground.updateFrameIndex();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-canvas",
3
3
  "type": "module",
4
- "version": "0.12.1",
4
+ "version": "0.12.3",
5
5
  "packageManager": "pnpm@10.18.1",
6
6
  "description": "A JavaScript WebGL rendering engine.",
7
7
  "author": "wxm",