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.cjs +9 -5
- package/dist/index.d.cts +0 -2
- package/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +32 -32
- package/dist/index.mjs +10 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10094,9 +10094,9 @@ class BaseElement2DText extends CoreObject {
|
|
|
10094
10094
|
this.parent = parent;
|
|
10095
10095
|
this.base = new modernText.Text();
|
|
10096
10096
|
this.base.setPropertyAccessor(this);
|
|
10097
|
+
this.update();
|
|
10097
10098
|
}
|
|
10098
10099
|
base;
|
|
10099
|
-
measureResult;
|
|
10100
10100
|
_texture = new CanvasTexture();
|
|
10101
10101
|
_textureMap = /* @__PURE__ */ new Map();
|
|
10102
10102
|
setProperties(properties) {
|
|
@@ -10187,10 +10187,6 @@ class BaseElement2DText extends CoreObject {
|
|
|
10187
10187
|
this.update();
|
|
10188
10188
|
return this.base.measure();
|
|
10189
10189
|
}
|
|
10190
|
-
updateMeasure() {
|
|
10191
|
-
this.measureResult = this.measure();
|
|
10192
|
-
return this;
|
|
10193
|
-
}
|
|
10194
10190
|
isValid() {
|
|
10195
10191
|
return Boolean(
|
|
10196
10192
|
this.enabled && !/^\s*$/.test(this.base.toString())
|
|
@@ -10331,6 +10327,8 @@ var __decorateClass$e = (decorators, target, key, kind) => {
|
|
|
10331
10327
|
result = (decorator(result)) || result;
|
|
10332
10328
|
return result;
|
|
10333
10329
|
};
|
|
10330
|
+
const layoutStyle = new Set(Object.keys(modernIdoc.getDefaultLayoutStyle()));
|
|
10331
|
+
const textStyles = new Set(Object.keys(modernIdoc.getDefaultTextStyle()));
|
|
10334
10332
|
exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
10335
10333
|
size = new Vector2().on("update", () => {
|
|
10336
10334
|
this.updateGlobalTransform();
|
|
@@ -10491,6 +10489,12 @@ exports.BaseElement2D = class BaseElement2D extends exports.Node2D {
|
|
|
10491
10489
|
this.requestRedraw();
|
|
10492
10490
|
break;
|
|
10493
10491
|
}
|
|
10492
|
+
if (textStyles.has(key) || layoutStyle.has(key)) {
|
|
10493
|
+
if (this.text.isValid()) {
|
|
10494
|
+
this.text.update();
|
|
10495
|
+
this.requestRedraw();
|
|
10496
|
+
}
|
|
10497
|
+
}
|
|
10494
10498
|
}
|
|
10495
10499
|
_process(delta) {
|
|
10496
10500
|
this.foreground.updateFrameIndex();
|
package/dist/index.d.cts
CHANGED
|
@@ -2104,7 +2104,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2104
2104
|
measureDom: Text['measureDom'];
|
|
2105
2105
|
fonts: Text['fonts'];
|
|
2106
2106
|
readonly base: Text;
|
|
2107
|
-
measureResult?: MeasureResult;
|
|
2108
2107
|
protected _texture: CanvasTexture;
|
|
2109
2108
|
protected _textureMap: Map<string, {
|
|
2110
2109
|
texture: Texture2D | undefined;
|
|
@@ -2119,7 +2118,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2119
2118
|
protected _loadTexture(fill: NormalizedFill, box: any): Promise<Texture2D | undefined>;
|
|
2120
2119
|
setContent(content: TextContent): void;
|
|
2121
2120
|
measure(): MeasureResult;
|
|
2122
|
-
updateMeasure(): this;
|
|
2123
2121
|
isValid(): boolean;
|
|
2124
2122
|
protected _createVertTransform(): Transform2D | undefined;
|
|
2125
2123
|
useTextureDraw(): boolean;
|
package/dist/index.d.mts
CHANGED
|
@@ -2104,7 +2104,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2104
2104
|
measureDom: Text['measureDom'];
|
|
2105
2105
|
fonts: Text['fonts'];
|
|
2106
2106
|
readonly base: Text;
|
|
2107
|
-
measureResult?: MeasureResult;
|
|
2108
2107
|
protected _texture: CanvasTexture;
|
|
2109
2108
|
protected _textureMap: Map<string, {
|
|
2110
2109
|
texture: Texture2D | undefined;
|
|
@@ -2119,7 +2118,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2119
2118
|
protected _loadTexture(fill: NormalizedFill, box: any): Promise<Texture2D | undefined>;
|
|
2120
2119
|
setContent(content: TextContent): void;
|
|
2121
2120
|
measure(): MeasureResult;
|
|
2122
|
-
updateMeasure(): this;
|
|
2123
2121
|
isValid(): boolean;
|
|
2124
2122
|
protected _createVertTransform(): Transform2D | undefined;
|
|
2125
2123
|
useTextureDraw(): boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -2104,7 +2104,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2104
2104
|
measureDom: Text['measureDom'];
|
|
2105
2105
|
fonts: Text['fonts'];
|
|
2106
2106
|
readonly base: Text;
|
|
2107
|
-
measureResult?: MeasureResult;
|
|
2108
2107
|
protected _texture: CanvasTexture;
|
|
2109
2108
|
protected _textureMap: Map<string, {
|
|
2110
2109
|
texture: Texture2D | undefined;
|
|
@@ -2119,7 +2118,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2119
2118
|
protected _loadTexture(fill: NormalizedFill, box: any): Promise<Texture2D | undefined>;
|
|
2120
2119
|
setContent(content: TextContent): void;
|
|
2121
2120
|
measure(): MeasureResult;
|
|
2122
|
-
updateMeasure(): this;
|
|
2123
2121
|
isValid(): boolean;
|
|
2124
2122
|
protected _createVertTransform(): Transform2D | undefined;
|
|
2125
2123
|
useTextureDraw(): boolean;
|