@leafer/data 1.0.0-rc.12 → 1.0.0-rc.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/data",
3
- "version": "1.0.0-rc.12",
3
+ "version": "1.0.0-rc.17",
4
4
  "description": "@leafer/data",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,6 +22,6 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "devDependencies": {
25
- "@leafer/interface": "1.0.0-rc.12"
25
+ "@leafer/interface": "1.0.0-rc.17"
26
26
  }
27
27
  }
package/src/LeafData.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeafData, ILeaf, IObject, IValue } from '@leafer/interface'
1
+ import { ILeafData, ILeaf, IObject, IValue, IPathCommandData } from '@leafer/interface'
2
2
 
3
3
 
4
4
  export class LeafData implements ILeafData {
@@ -12,6 +12,9 @@ export class LeafData implements ILeafData {
12
12
  public __naturalWidth?: number
13
13
  public __naturalHeight?: number
14
14
 
15
+ public __pathInputed?: number
16
+ public __pathForRender?: IPathCommandData
17
+
15
18
  public get __blendMode(): string {
16
19
  if ((this as ILeafData).eraser) return 'destination-out'
17
20
  const { blendMode } = (this as ILeafData)
@@ -52,6 +55,9 @@ export class LeafData implements ILeafData {
52
55
  const value = this.__input[name]
53
56
  if (value !== undefined) return value
54
57
  }
58
+
59
+ if (name === 'path' && !this.__pathInputed) return // no path mode
60
+
55
61
  return (this as IObject)['_' + name]
56
62
  }
57
63
 
@@ -66,6 +72,9 @@ export class LeafData implements ILeafData {
66
72
  if (key[0] !== '_') {
67
73
  value = (this as IObject)['_' + key]
68
74
  if (value !== undefined) {
75
+
76
+ if (key === 'path' && !this.__pathInputed) continue // no path mode
77
+
69
78
  inputValue = __input ? __input[key] : undefined
70
79
  data[key] = (inputValue === undefined) ? value : inputValue
71
80
  }
@@ -97,6 +106,10 @@ export class LeafData implements ILeafData {
97
106
  }
98
107
  }
99
108
 
109
+ public __removeNaturalSize(): void {
110
+ this.__naturalWidth = this.__naturalHeight = undefined
111
+ }
112
+
100
113
  public destroy(): void {
101
114
  this.__input = this.__middle = null
102
115
  }
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IObject, ILeafData, ILeaf } from '@leafer/interface';
1
+ import { IObject, ILeafData, ILeaf, IPathCommandData } from '@leafer/interface';
2
2
 
3
3
  declare const DataHelper: {
4
4
  default<T>(t: T, defaultData: IObject): T;
@@ -14,6 +14,8 @@ declare class LeafData implements ILeafData {
14
14
  __single: boolean;
15
15
  __naturalWidth?: number;
16
16
  __naturalHeight?: number;
17
+ __pathInputed?: number;
18
+ __pathForRender?: IPathCommandData;
17
19
  get __blendMode(): string;
18
20
  constructor(leaf: ILeaf);
19
21
  __get(name: string): any;
@@ -25,6 +27,7 @@ declare class LeafData implements ILeafData {
25
27
  __setMiddle(name: string, value: any): void;
26
28
  __getMiddle(name: string): any;
27
29
  __checkSingle(): void;
30
+ __removeNaturalSize(): void;
28
31
  destroy(): void;
29
32
  }
30
33