@leafer/display 1.0.0-rc.22 → 1.0.0-rc.24

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/display",
3
- "version": "1.0.0-rc.22",
3
+ "version": "1.0.0-rc.24",
4
4
  "description": "@leafer/display",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,16 +22,16 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "dependencies": {
25
- "@leafer/math": "1.0.0-rc.22",
26
- "@leafer/data": "1.0.0-rc.22",
27
- "@leafer/layout": "1.0.0-rc.22",
28
- "@leafer/display-module": "1.0.0-rc.22",
29
- "@leafer/event": "1.0.0-rc.22",
30
- "@leafer/decorator": "1.0.0-rc.22",
31
- "@leafer/helper": "1.0.0-rc.22",
32
- "@leafer/platform": "1.0.0-rc.22"
25
+ "@leafer/math": "1.0.0-rc.24",
26
+ "@leafer/data": "1.0.0-rc.24",
27
+ "@leafer/layout": "1.0.0-rc.24",
28
+ "@leafer/display-module": "1.0.0-rc.24",
29
+ "@leafer/event": "1.0.0-rc.24",
30
+ "@leafer/decorator": "1.0.0-rc.24",
31
+ "@leafer/helper": "1.0.0-rc.24",
32
+ "@leafer/platform": "1.0.0-rc.24"
33
33
  },
34
34
  "devDependencies": {
35
- "@leafer/interface": "1.0.0-rc.22"
35
+ "@leafer/interface": "1.0.0-rc.24"
36
36
  }
37
37
  }
package/src/Leaf.ts CHANGED
@@ -80,7 +80,7 @@ export class Leaf implements ILeaf {
80
80
  public get __onlyHitMask(): boolean { return this.__hasMask && !this.__.hitChildren }
81
81
  public get __ignoreHitWorld(): boolean { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren }
82
82
 
83
- public get pathInputed(): boolean { return !!this.__.__pathInputed }
83
+ public get pathInputed(): boolean { return this.__.__pathInputed as unknown as boolean }
84
84
 
85
85
  // event
86
86
  public __captureMap?: IEventListenerMap
@@ -198,8 +198,12 @@ export class Leaf implements ILeaf {
198
198
 
199
199
  public find(_condition: number | string | IFindMethod, _options?: any): ILeaf[] { return undefined }
200
200
 
201
+ public findTag(_tag: string | string[]): ILeaf[] { return undefined }
202
+
201
203
  public findOne(_condition: number | string | IFindMethod, _options?: any): ILeaf { return undefined }
202
204
 
205
+ public findId(_id: number | string): ILeaf { return undefined }
206
+
203
207
  // ---
204
208
 
205
209
 
@@ -248,12 +252,17 @@ export class Leaf implements ILeaf {
248
252
 
249
253
  public __updateBoxBounds(): void { }
250
254
 
255
+ public __updateContentBounds(): void { }
256
+
251
257
  public __updateStrokeBounds(): void { }
252
258
 
253
259
  public __updateRenderBounds(): void { }
254
260
 
255
261
 
256
262
  public __updateAutoLayout(): void { }
263
+
264
+ public __updateFlowLayout(): void { }
265
+
257
266
  public __updateNaturalSize(): void { }
258
267
 
259
268
 
@@ -266,16 +275,24 @@ export class Leaf implements ILeaf {
266
275
  // ---
267
276
 
268
277
 
269
- // LeafMask rewrite
270
-
271
278
  public __updateEraser(value?: boolean): void {
272
279
  this.__hasEraser = value ? true : this.children.some(item => item.__.eraser)
273
280
  }
274
281
 
282
+ public __renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void { // path eraser
283
+ canvas.save()
284
+ this.__clip(canvas, options)
285
+ const { renderBounds: r } = this.__layout
286
+ canvas.clearRect(r.x, r.y, r.width, r.height)
287
+ canvas.restore()
288
+ }
289
+
275
290
  public __updateMask(value?: boolean): void {
276
291
  this.__hasMask = value ? true : this.children.some(item => item.__.mask)
277
292
  }
278
293
 
294
+ // LeafMask rewrite
295
+
279
296
  public __renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
280
297
 
281
298
 
@@ -533,7 +550,7 @@ export class Leaf implements ILeaf {
533
550
 
534
551
  public on(_type: string | string[], _listener: IEventListener, _options?: IEventListenerOptions | boolean): void { }
535
552
 
536
- public off(_type: string | string[], _listener: IEventListener, _options?: IEventListenerOptions | boolean): void { }
553
+ public off(_type?: string | string[], _listener?: IEventListener, _options?: IEventListenerOptions | boolean): void { }
537
554
 
538
555
  public on_(_type: string | string[], _listener: IEventListener, _bind?: IObject, _options?: IEventListenerOptions | boolean): IEventListenerId { return undefined }
539
556
 
@@ -549,8 +566,8 @@ export class Leaf implements ILeaf {
549
566
 
550
567
  // ---
551
568
 
552
- static changeAttr(attrName: string, defaultValue: IValue): void {
553
- defineDataProcessor(this.prototype, attrName, defaultValue)
569
+ static changeAttr(attrName: string, defaultValue: IValue, fn?: IAttrDecorator): void {
570
+ fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue)
554
571
  }
555
572
 
556
573
  static addAttr(attrName: string, defaultValue: IValue, fn?: IAttrDecorator): void {
package/types/index.d.ts CHANGED
@@ -66,7 +66,9 @@ declare class Leaf implements ILeaf {
66
66
  setProxyAttr(_attrName: string, _newValue: IValue): void;
67
67
  getProxyAttr(_attrName: string): IValue;
68
68
  find(_condition: number | string | IFindMethod, _options?: any): ILeaf[];
69
+ findTag(_tag: string | string[]): ILeaf[];
69
70
  findOne(_condition: number | string | IFindMethod, _options?: any): ILeaf;
71
+ findId(_id: number | string): ILeaf;
70
72
  focus(_value?: boolean): void;
71
73
  forceUpdate(attrName?: string): void;
72
74
  updateLayout(): void;
@@ -78,14 +80,17 @@ declare class Leaf implements ILeaf {
78
80
  __updateLocalStrokeBounds(): void;
79
81
  __updateLocalRenderBounds(): void;
80
82
  __updateBoxBounds(): void;
83
+ __updateContentBounds(): void;
81
84
  __updateStrokeBounds(): void;
82
85
  __updateRenderBounds(): void;
83
86
  __updateAutoLayout(): void;
87
+ __updateFlowLayout(): void;
84
88
  __updateNaturalSize(): void;
85
89
  __updateStrokeSpread(): number;
86
90
  __updateRenderSpread(): number;
87
91
  __onUpdateSize(): void;
88
92
  __updateEraser(value?: boolean): void;
93
+ __renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void;
89
94
  __updateMask(value?: boolean): void;
90
95
  __renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
91
96
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
@@ -143,14 +148,14 @@ declare class Leaf implements ILeaf {
143
148
  remove(_child?: ILeaf, destroy?: boolean): void;
144
149
  dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
145
150
  on(_type: string | string[], _listener: IEventListener, _options?: IEventListenerOptions | boolean): void;
146
- off(_type: string | string[], _listener: IEventListener, _options?: IEventListenerOptions | boolean): void;
151
+ off(_type?: string | string[], _listener?: IEventListener, _options?: IEventListenerOptions | boolean): void;
147
152
  on_(_type: string | string[], _listener: IEventListener, _bind?: IObject, _options?: IEventListenerOptions | boolean): IEventListenerId;
148
153
  off_(_id: IEventListenerId | IEventListenerId[]): void;
149
154
  once(_type: string | string[], _listener: IEventListener, _capture?: boolean): void;
150
155
  emit(_type: string, _event?: IEvent | IObject, _capture?: boolean): void;
151
156
  emitEvent(_event?: IEvent, _capture?: boolean): void;
152
157
  hasEvent(_type: string, _capture?: boolean): boolean;
153
- static changeAttr(attrName: string, defaultValue: IValue): void;
158
+ static changeAttr(attrName: string, defaultValue: IValue, fn?: IAttrDecorator): void;
154
159
  static addAttr(attrName: string, defaultValue: IValue, fn?: IAttrDecorator): void;
155
160
  destroy(): void;
156
161
  }