modern-canvas 0.9.1 → 0.9.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 +18 -34
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +44 -44
- package/dist/index.mjs +18 -34
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -876,6 +876,12 @@ class Input extends modernIdoc.Observable {
|
|
|
876
876
|
let IID = 0;
|
|
877
877
|
class CoreObject extends modernIdoc.Reactivable {
|
|
878
878
|
instanceId = ++IID;
|
|
879
|
+
get json() {
|
|
880
|
+
return this.toJSON();
|
|
881
|
+
}
|
|
882
|
+
set json(val) {
|
|
883
|
+
this.setProperties(val);
|
|
884
|
+
}
|
|
879
885
|
_nextTick() {
|
|
880
886
|
return nextTick();
|
|
881
887
|
}
|
|
@@ -9701,17 +9707,7 @@ class BaseElement2DText extends CoreObject {
|
|
|
9701
9707
|
constructor(parent) {
|
|
9702
9708
|
super();
|
|
9703
9709
|
this.parent = parent;
|
|
9704
|
-
this.base.
|
|
9705
|
-
switch (args[0]) {
|
|
9706
|
-
case "content":
|
|
9707
|
-
case "effects":
|
|
9708
|
-
case "fill":
|
|
9709
|
-
case "outline":
|
|
9710
|
-
this.setProperty(args[0], args[1]);
|
|
9711
|
-
break;
|
|
9712
|
-
}
|
|
9713
|
-
this._updateProperty(...args);
|
|
9714
|
-
});
|
|
9710
|
+
this.base.setPropertyAccessor(this);
|
|
9715
9711
|
}
|
|
9716
9712
|
base = new modernText.Text();
|
|
9717
9713
|
measureResult;
|
|
@@ -9737,17 +9733,8 @@ class BaseElement2DText extends CoreObject {
|
|
|
9737
9733
|
break;
|
|
9738
9734
|
}
|
|
9739
9735
|
}
|
|
9740
|
-
_update() {
|
|
9741
|
-
this.base.style = {
|
|
9742
|
-
justifyContent: "center",
|
|
9743
|
-
alignItems: "center",
|
|
9744
|
-
textAlign: "center",
|
|
9745
|
-
...this.parent.style.toJSON()
|
|
9746
|
-
};
|
|
9747
|
-
this.base.update();
|
|
9748
|
-
}
|
|
9749
9736
|
_updateTextureMap() {
|
|
9750
|
-
this.
|
|
9737
|
+
this.base.update();
|
|
9751
9738
|
this._textureMap.clear();
|
|
9752
9739
|
const pGlyphBoxs = [];
|
|
9753
9740
|
this.base.paragraphs.forEach((p, pIndex) => {
|
|
@@ -9803,12 +9790,6 @@ class BaseElement2DText extends CoreObject {
|
|
|
9803
9790
|
this.content = modernIdoc.normalizeTextContent(content);
|
|
9804
9791
|
}
|
|
9805
9792
|
measure() {
|
|
9806
|
-
this.base.style = {
|
|
9807
|
-
justifyContent: "center",
|
|
9808
|
-
alignItems: "center",
|
|
9809
|
-
textAlign: "center",
|
|
9810
|
-
...this.parent.style.toJSON()
|
|
9811
|
-
};
|
|
9812
9793
|
return this.base.measure();
|
|
9813
9794
|
}
|
|
9814
9795
|
updateMeasure() {
|
|
@@ -9831,7 +9812,7 @@ class BaseElement2DText extends CoreObject {
|
|
|
9831
9812
|
}
|
|
9832
9813
|
draw() {
|
|
9833
9814
|
const ctx = this.parent.context;
|
|
9834
|
-
this.
|
|
9815
|
+
this.base.update();
|
|
9835
9816
|
this.base.pathSets.forEach((pathSet) => {
|
|
9836
9817
|
pathSet.paths.forEach((path) => {
|
|
9837
9818
|
const meta = path.getMeta();
|
|
@@ -9902,22 +9883,25 @@ __decorateClass$m([
|
|
|
9902
9883
|
modernIdoc.property({ fallback: true })
|
|
9903
9884
|
], BaseElement2DText.prototype, "enabled");
|
|
9904
9885
|
__decorateClass$m([
|
|
9905
|
-
modernIdoc.property({
|
|
9886
|
+
modernIdoc.property({ fallback: () => [] })
|
|
9906
9887
|
], BaseElement2DText.prototype, "content");
|
|
9907
9888
|
__decorateClass$m([
|
|
9908
|
-
modernIdoc.property({ alias: "
|
|
9889
|
+
modernIdoc.property({ alias: "parent.style.json" })
|
|
9890
|
+
], BaseElement2DText.prototype, "style");
|
|
9891
|
+
__decorateClass$m([
|
|
9892
|
+
modernIdoc.property()
|
|
9909
9893
|
], BaseElement2DText.prototype, "effects");
|
|
9910
9894
|
__decorateClass$m([
|
|
9911
|
-
modernIdoc.property(
|
|
9895
|
+
modernIdoc.property()
|
|
9912
9896
|
], BaseElement2DText.prototype, "fill");
|
|
9913
9897
|
__decorateClass$m([
|
|
9914
|
-
modernIdoc.property(
|
|
9898
|
+
modernIdoc.property()
|
|
9915
9899
|
], BaseElement2DText.prototype, "outline");
|
|
9916
9900
|
__decorateClass$m([
|
|
9917
|
-
modernIdoc.property({
|
|
9901
|
+
modernIdoc.property({ alias: "base.measureDom" })
|
|
9918
9902
|
], BaseElement2DText.prototype, "measureDom");
|
|
9919
9903
|
__decorateClass$m([
|
|
9920
|
-
modernIdoc.property({
|
|
9904
|
+
modernIdoc.property({ alias: "base.fonts" })
|
|
9921
9905
|
], BaseElement2DText.prototype, "fonts");
|
|
9922
9906
|
|
|
9923
9907
|
var __getOwnPropDesc$k = Object.getOwnPropertyDescriptor;
|
package/dist/index.d.cts
CHANGED
|
@@ -255,6 +255,8 @@ interface CoreObject {
|
|
|
255
255
|
}
|
|
256
256
|
declare class CoreObject extends Reactivable {
|
|
257
257
|
readonly instanceId: number;
|
|
258
|
+
get json(): Record<string, any>;
|
|
259
|
+
set json(val: Record<string, any>);
|
|
258
260
|
protected _nextTick(): Promise<void>;
|
|
259
261
|
equal(target: CoreObject | undefined | null): boolean;
|
|
260
262
|
}
|
|
@@ -2063,6 +2065,7 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2063
2065
|
parent: BaseElement2D;
|
|
2064
2066
|
enabled: boolean;
|
|
2065
2067
|
content: Text['content'];
|
|
2068
|
+
style: Text['style'];
|
|
2066
2069
|
effects: Text['effects'];
|
|
2067
2070
|
fill: Text['fill'];
|
|
2068
2071
|
outline: Text['outline'];
|
|
@@ -2077,7 +2080,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2077
2080
|
constructor(parent: BaseElement2D);
|
|
2078
2081
|
setProperties(properties?: Text$1): this;
|
|
2079
2082
|
protected _updateProperty(key: string, value: any, oldValue: any): void;
|
|
2080
|
-
protected _update(): void;
|
|
2081
2083
|
protected _updateTextureMap(): void;
|
|
2082
2084
|
protected _updateTexture(key: string, fill: NormalizedFill | undefined, box: any): Promise<void>;
|
|
2083
2085
|
protected _loadTexture(fill: NormalizedFill, box: any): Promise<Texture2D | undefined>;
|
package/dist/index.d.mts
CHANGED
|
@@ -255,6 +255,8 @@ interface CoreObject {
|
|
|
255
255
|
}
|
|
256
256
|
declare class CoreObject extends Reactivable {
|
|
257
257
|
readonly instanceId: number;
|
|
258
|
+
get json(): Record<string, any>;
|
|
259
|
+
set json(val: Record<string, any>);
|
|
258
260
|
protected _nextTick(): Promise<void>;
|
|
259
261
|
equal(target: CoreObject | undefined | null): boolean;
|
|
260
262
|
}
|
|
@@ -2063,6 +2065,7 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2063
2065
|
parent: BaseElement2D;
|
|
2064
2066
|
enabled: boolean;
|
|
2065
2067
|
content: Text['content'];
|
|
2068
|
+
style: Text['style'];
|
|
2066
2069
|
effects: Text['effects'];
|
|
2067
2070
|
fill: Text['fill'];
|
|
2068
2071
|
outline: Text['outline'];
|
|
@@ -2077,7 +2080,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2077
2080
|
constructor(parent: BaseElement2D);
|
|
2078
2081
|
setProperties(properties?: Text$1): this;
|
|
2079
2082
|
protected _updateProperty(key: string, value: any, oldValue: any): void;
|
|
2080
|
-
protected _update(): void;
|
|
2081
2083
|
protected _updateTextureMap(): void;
|
|
2082
2084
|
protected _updateTexture(key: string, fill: NormalizedFill | undefined, box: any): Promise<void>;
|
|
2083
2085
|
protected _loadTexture(fill: NormalizedFill, box: any): Promise<Texture2D | undefined>;
|
package/dist/index.d.ts
CHANGED
|
@@ -255,6 +255,8 @@ interface CoreObject {
|
|
|
255
255
|
}
|
|
256
256
|
declare class CoreObject extends Reactivable {
|
|
257
257
|
readonly instanceId: number;
|
|
258
|
+
get json(): Record<string, any>;
|
|
259
|
+
set json(val: Record<string, any>);
|
|
258
260
|
protected _nextTick(): Promise<void>;
|
|
259
261
|
equal(target: CoreObject | undefined | null): boolean;
|
|
260
262
|
}
|
|
@@ -2063,6 +2065,7 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2063
2065
|
parent: BaseElement2D;
|
|
2064
2066
|
enabled: boolean;
|
|
2065
2067
|
content: Text['content'];
|
|
2068
|
+
style: Text['style'];
|
|
2066
2069
|
effects: Text['effects'];
|
|
2067
2070
|
fill: Text['fill'];
|
|
2068
2071
|
outline: Text['outline'];
|
|
@@ -2077,7 +2080,6 @@ declare class BaseElement2DText extends CoreObject {
|
|
|
2077
2080
|
constructor(parent: BaseElement2D);
|
|
2078
2081
|
setProperties(properties?: Text$1): this;
|
|
2079
2082
|
protected _updateProperty(key: string, value: any, oldValue: any): void;
|
|
2080
|
-
protected _update(): void;
|
|
2081
2083
|
protected _updateTextureMap(): void;
|
|
2082
2084
|
protected _updateTexture(key: string, fill: NormalizedFill | undefined, box: any): Promise<void>;
|
|
2083
2085
|
protected _loadTexture(fill: NormalizedFill, box: any): Promise<Texture2D | undefined>;
|