@leafer/display 2.1.4 → 2.1.5
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 +12 -12
- package/src/Leaf.ts +112 -219
- package/types/index.d.ts +73 -71
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/math": "2.1.
|
|
26
|
-
"@leafer/data": "2.1.
|
|
27
|
-
"@leafer/layout": "2.1.
|
|
28
|
-
"@leafer/display-module": "2.1.
|
|
29
|
-
"@leafer/event": "2.1.
|
|
30
|
-
"@leafer/decorator": "2.1.
|
|
31
|
-
"@leafer/helper": "2.1.
|
|
32
|
-
"@leafer/image": "2.1.
|
|
33
|
-
"@leafer/debug": "2.1.
|
|
34
|
-
"@leafer/platform": "2.1.
|
|
25
|
+
"@leafer/math": "2.1.5",
|
|
26
|
+
"@leafer/data": "2.1.5",
|
|
27
|
+
"@leafer/layout": "2.1.5",
|
|
28
|
+
"@leafer/display-module": "2.1.5",
|
|
29
|
+
"@leafer/event": "2.1.5",
|
|
30
|
+
"@leafer/decorator": "2.1.5",
|
|
31
|
+
"@leafer/helper": "2.1.5",
|
|
32
|
+
"@leafer/image": "2.1.5",
|
|
33
|
+
"@leafer/debug": "2.1.5",
|
|
34
|
+
"@leafer/platform": "2.1.5"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@leafer/interface": "2.1.
|
|
37
|
+
"@leafer/interface": "2.1.5"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/src/Leaf.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { boundsType, useModule, defineDataProcessor } from '@leafer/decorator'
|
|
|
7
7
|
import { LeafHelper } from '@leafer/helper'
|
|
8
8
|
import { ChildEvent } from '@leafer/event'
|
|
9
9
|
import { ImageManager } from '@leafer/image'
|
|
10
|
-
import { Plugin } from '@leafer/debug'
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
const { LEAF, create } = IncrementId
|
|
@@ -191,10 +190,6 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
191
190
|
|
|
192
191
|
// data
|
|
193
192
|
|
|
194
|
-
public set(_data: IObject, _isTemp?: boolean): void { }
|
|
195
|
-
|
|
196
|
-
public get<K extends keyof this>(_name?: K | K[] | ILeafInputData): ILeafInputData | this[K] { return undefined }
|
|
197
|
-
|
|
198
193
|
public setAttr(name: string, value: any): void { (this as IObject)[name] = value }
|
|
199
194
|
public getAttr(name: string): any { return (this as IObject)[name] }
|
|
200
195
|
|
|
@@ -209,45 +204,13 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
209
204
|
return JSON.stringify(this.toJSON(options))
|
|
210
205
|
}
|
|
211
206
|
|
|
212
|
-
public toSVG(): string { return undefined }
|
|
213
|
-
|
|
214
|
-
public __SVG(_data: IObject): void { }
|
|
215
|
-
|
|
216
|
-
public toHTML(): string { return undefined }
|
|
217
|
-
|
|
218
|
-
// LeafDataProxy rewrite
|
|
219
|
-
|
|
220
|
-
public __setAttr(_attrName: string, _newValue: IValue): boolean { return true }
|
|
221
|
-
|
|
222
|
-
public __getAttr(_attrName: string): IValue { return undefined }
|
|
223
|
-
|
|
224
|
-
public setProxyAttr(_attrName: string, _newValue: IValue): void { }
|
|
225
|
-
|
|
226
|
-
public getProxyAttr(_attrName: string): IValue { return undefined }
|
|
227
|
-
|
|
228
|
-
// ---
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
// find
|
|
232
|
-
|
|
233
|
-
public find(_condition: number | string | IFindMethod, _options?: any): ILeaf[] { return undefined }
|
|
234
|
-
|
|
235
|
-
public findTag(_tag: string | string[]): ILeaf[] { return undefined }
|
|
236
|
-
|
|
237
|
-
public findOne(_condition: number | string | IFindMethod, _options?: any): ILeaf | undefined { return undefined }
|
|
238
|
-
|
|
239
|
-
public findId(_id: number | string): ILeaf | undefined { return undefined }
|
|
240
|
-
|
|
241
|
-
// ---
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
// @leafer-in/state rewrite
|
|
245
|
-
|
|
246
|
-
public focus(_value?: boolean): void { }
|
|
247
207
|
|
|
248
|
-
|
|
208
|
+
// @leafer-in/resize rewrite
|
|
249
209
|
|
|
250
|
-
|
|
210
|
+
public scaleResize(scaleX: number, scaleY = scaleX, _noResize?: boolean, _boundsType?: IBoundsType): void {
|
|
211
|
+
(this as ILeaf).scaleX *= scaleX;
|
|
212
|
+
(this as ILeaf).scaleY *= scaleY
|
|
213
|
+
}
|
|
251
214
|
|
|
252
215
|
|
|
253
216
|
public updateLayout(): void {
|
|
@@ -270,53 +233,6 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
270
233
|
if (this.leaferIsReady) this.leafer.layouter.addExtra(this) // add part 额外更新元素
|
|
271
234
|
}
|
|
272
235
|
|
|
273
|
-
// LeafMatrix rewrite
|
|
274
|
-
|
|
275
|
-
public __updateWorldMatrix(): void { }
|
|
276
|
-
|
|
277
|
-
public __updateLocalMatrix(): void { }
|
|
278
|
-
|
|
279
|
-
// ---
|
|
280
|
-
|
|
281
|
-
// LeafBounds rewrite
|
|
282
|
-
|
|
283
|
-
public __updateWorldBounds(): void { }
|
|
284
|
-
|
|
285
|
-
public __updateLocalBounds(): void { }
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
public __updateLocalBoxBounds(): void { }
|
|
289
|
-
|
|
290
|
-
public __updateLocalStrokeBounds(): void { }
|
|
291
|
-
|
|
292
|
-
public __updateLocalRenderBounds(): void { }
|
|
293
|
-
|
|
294
|
-
// box
|
|
295
|
-
|
|
296
|
-
public __updateBoxBounds(_secondLayout?: boolean, _bounds?: IBoundsData): void { }
|
|
297
|
-
|
|
298
|
-
public __updateContentBounds(): void { }
|
|
299
|
-
|
|
300
|
-
public __updateStrokeBounds(_bounds?: IBoundsData): void { }
|
|
301
|
-
|
|
302
|
-
public __updateRenderBounds(_bounds?: IBoundsData): void { }
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
public __updateAutoLayout(): void { }
|
|
306
|
-
|
|
307
|
-
public __updateFlowLayout(): void { }
|
|
308
|
-
|
|
309
|
-
public __updateNaturalSize(): void { }
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
public __updateStrokeSpread(): IFourNumber { return 0 }
|
|
313
|
-
|
|
314
|
-
public __updateRenderSpread(): IFourNumber { return 0 }
|
|
315
|
-
|
|
316
|
-
public __onUpdateSize(): void { }
|
|
317
|
-
|
|
318
|
-
// ---
|
|
319
|
-
|
|
320
236
|
|
|
321
237
|
public __updateEraser(value?: boolean): void {
|
|
322
238
|
this.__hasEraser = value ? true : this.children.some(item => item.__.eraser)
|
|
@@ -334,13 +250,6 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
334
250
|
this.__hasMask = this.children.some(item => item.__.mask && item.__.visible && item.__.opacity)
|
|
335
251
|
}
|
|
336
252
|
|
|
337
|
-
// LeafMask rewrite
|
|
338
|
-
|
|
339
|
-
public __renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
// ---
|
|
343
|
-
|
|
344
253
|
|
|
345
254
|
// convert
|
|
346
255
|
|
|
@@ -547,107 +456,6 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
547
456
|
}
|
|
548
457
|
|
|
549
458
|
|
|
550
|
-
// @leafer-in/resize rewrite
|
|
551
|
-
|
|
552
|
-
public scaleResize(scaleX: number, scaleY = scaleX, _noResize?: boolean, _boundsType?: IBoundsType): void {
|
|
553
|
-
(this as ILeaf).scaleX *= scaleX;
|
|
554
|
-
(this as ILeaf).scaleY *= scaleY
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
public __scaleResize(_scaleX: number, _scaleY: number): void { }
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
public resizeWidth(_width: number): void { }
|
|
561
|
-
|
|
562
|
-
public resizeHeight(_height: number): void { }
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
// @leafer-ui/hit LeafHit rewrite
|
|
566
|
-
|
|
567
|
-
public hit(_world: IPointData, _hitRadius?: number): boolean { return true }
|
|
568
|
-
|
|
569
|
-
public __hitWorld(_point: IRadiusPointData, _forceHitFill?: boolean): boolean { return true }
|
|
570
|
-
|
|
571
|
-
public __hit(_local: IRadiusPointData, _forceHitFill?: boolean): boolean { return true }
|
|
572
|
-
|
|
573
|
-
public __hitFill(_inner: IRadiusPointData): boolean { return true }
|
|
574
|
-
|
|
575
|
-
public __hitStroke(_inner: IRadiusPointData, _strokeWidth: number): boolean { return true }
|
|
576
|
-
|
|
577
|
-
public __hitPixel(_inner: IRadiusPointData): boolean { return true }
|
|
578
|
-
|
|
579
|
-
public __drawHitPath(_canvas: ILeaferCanvas): void { }
|
|
580
|
-
|
|
581
|
-
public __updateHitCanvas(): void { }
|
|
582
|
-
|
|
583
|
-
// ---
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
// LeafRender rewrite
|
|
587
|
-
|
|
588
|
-
public __render(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
589
|
-
|
|
590
|
-
public __drawFast(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
591
|
-
|
|
592
|
-
public __draw(_canvas: ILeaferCanvas, _options: IRenderOptions, _originCanvas?: ILeaferCanvas): void { }
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
public __clip(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
596
|
-
|
|
597
|
-
public __renderShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
598
|
-
|
|
599
|
-
public __drawShape(_canvas: ILeaferCanvas, _options: IRenderOptions): void { }
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
public __updateWorldOpacity(): void { }
|
|
603
|
-
|
|
604
|
-
public __updateChange(): void { }
|
|
605
|
-
|
|
606
|
-
// ---
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
// path
|
|
610
|
-
|
|
611
|
-
public __drawPath(_canvas: ILeaferCanvas): void { }
|
|
612
|
-
|
|
613
|
-
public __drawRenderPath(_canvas: ILeaferCanvas): void { }
|
|
614
|
-
|
|
615
|
-
public __updatePath(): void { }
|
|
616
|
-
|
|
617
|
-
public __updateRenderPath(_updateCache?: boolean): void { }
|
|
618
|
-
|
|
619
|
-
// ---
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
// @leafer-in/motion-path rewrite
|
|
623
|
-
|
|
624
|
-
public getMotionPathData(): IMotionPathData {
|
|
625
|
-
return Plugin.need('path')
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
public getMotionPoint(_motionDistance: number | IUnitData): IRotationPointData {
|
|
629
|
-
return Plugin.need('path')
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
public getMotionTotal(): number {
|
|
633
|
-
return 0
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
public __updateMotionPath(): void { }
|
|
637
|
-
|
|
638
|
-
// ---
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
// @leafer-in/animate rewrite
|
|
642
|
-
public __runAnimation(_type: 'in' | 'out', _complete?: IFunction): void { }
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
// Branch rewrite
|
|
646
|
-
|
|
647
|
-
public __updateSortChildren(): void { }
|
|
648
|
-
|
|
649
|
-
public add(_child: ILeaf | ILeaf[] | ILeafInputData | ILeafInputData[], _index?: number): void { }
|
|
650
|
-
|
|
651
459
|
public remove(_child?: ILeaf | number | string | IFindMethod, destroy?: boolean): void {
|
|
652
460
|
if (this.parent) this.parent.remove(this, destroy)
|
|
653
461
|
}
|
|
@@ -656,28 +464,6 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
656
464
|
drop(this, parent, index, resize)
|
|
657
465
|
}
|
|
658
466
|
|
|
659
|
-
// ---
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
// LeafEventer rewrite
|
|
663
|
-
|
|
664
|
-
public on(_type: string | string[] | IEventParams[] | IEventParamsMap, _listener?: IEventListener, _options?: IEventOption): void { }
|
|
665
|
-
|
|
666
|
-
public off(_type?: string | string[], _listener?: IEventListener, _options?: IEventOption): void { }
|
|
667
|
-
|
|
668
|
-
public on_(_type: string | string[] | IEventParams[], _listener?: IEventListener, _bind?: IObject, _options?: IEventOption): IEventListenerId { return undefined }
|
|
669
|
-
|
|
670
|
-
public off_(_id: IEventListenerId | IEventListenerId[]): void { }
|
|
671
|
-
|
|
672
|
-
public once(_type: string | string[] | IEventParams[], _listener?: IEventListener, _captureOrBind?: boolean | IObject, _capture?: boolean): void { }
|
|
673
|
-
|
|
674
|
-
public emit(_type: string, _event?: IEvent | IObject, _capture?: boolean): void { }
|
|
675
|
-
|
|
676
|
-
public emitEvent(_event?: IEvent, _capture?: boolean): void { }
|
|
677
|
-
|
|
678
|
-
public hasEvent(_type: string, _capture?: boolean): boolean { return false }
|
|
679
|
-
|
|
680
|
-
// ---
|
|
681
467
|
|
|
682
468
|
static changeAttr(attrName: string, defaultValue: IValue | IValueFunction, fn?: IAttrDecorator): void {
|
|
683
469
|
fn ? this.addAttr(attrName, defaultValue, fn) : defineDataProcessor(this.prototype, attrName, defaultValue)
|
|
@@ -710,3 +496,110 @@ export class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
710
496
|
}
|
|
711
497
|
|
|
712
498
|
}
|
|
499
|
+
|
|
500
|
+
export interface Leaf {
|
|
501
|
+
|
|
502
|
+
// UI rewrite
|
|
503
|
+
set(data: IObject, isTemp?: boolean): void
|
|
504
|
+
get<K extends keyof this>(name?: K | K[] | ILeafInputData): ILeafInputData | this[K]
|
|
505
|
+
toSVG(): string
|
|
506
|
+
__SVG(data: IObject): void
|
|
507
|
+
toHTML(): string
|
|
508
|
+
|
|
509
|
+
// LeafDataProxy rewrite
|
|
510
|
+
__setAttr(attrName: string, newValue: IValue): boolean
|
|
511
|
+
__getAttr(attrName: string): IValue
|
|
512
|
+
setProxyAttr(attrName: string, newValue: IValue): void
|
|
513
|
+
getProxyAttr(attrName: string): IValue
|
|
514
|
+
|
|
515
|
+
// find
|
|
516
|
+
find(condition: number | string | IFindMethod, options?: any): ILeaf[]
|
|
517
|
+
findTag(tag: string | string[]): ILeaf[]
|
|
518
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined
|
|
519
|
+
findId(id: number | string): ILeaf | undefined
|
|
520
|
+
|
|
521
|
+
// @leafer-in/state rewrite
|
|
522
|
+
focus(value?: boolean): void
|
|
523
|
+
updateState(): void
|
|
524
|
+
|
|
525
|
+
// LeafMatrix rewrite
|
|
526
|
+
__updateWorldMatrix(): void
|
|
527
|
+
__updateLocalMatrix(): void
|
|
528
|
+
|
|
529
|
+
// LeafBounds rewrite
|
|
530
|
+
__updateWorldBounds(): void
|
|
531
|
+
__updateLocalBounds(): void
|
|
532
|
+
__updateLocalBoxBounds(): void
|
|
533
|
+
__updateLocalStrokeBounds(): void
|
|
534
|
+
__updateLocalRenderBounds(): void
|
|
535
|
+
__updateBoxBounds(secondLayout?: boolean, bounds?: IBoundsData): void
|
|
536
|
+
__updateContentBounds(): void
|
|
537
|
+
__updateStrokeBounds(bounds?: IBoundsData): void
|
|
538
|
+
__updateRenderBounds(bounds?: IBoundsData): void
|
|
539
|
+
__updateAutoLayout(): void
|
|
540
|
+
__updateFlowLayout(): void
|
|
541
|
+
__updateNaturalSize(): void
|
|
542
|
+
__updateStrokeSpread(): IFourNumber
|
|
543
|
+
__updateRenderSpread(): IFourNumber
|
|
544
|
+
__onUpdateSize(): void
|
|
545
|
+
|
|
546
|
+
// LeafMask rewrite
|
|
547
|
+
__renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
548
|
+
|
|
549
|
+
// @leafer-in/resize rewrite
|
|
550
|
+
__scaleResize(scaleX: number, scaleY: number): void
|
|
551
|
+
resizeWidth(width: number): void
|
|
552
|
+
resizeHeight(height: number): void
|
|
553
|
+
|
|
554
|
+
// @leafer-ui/hit LeafHit rewrite
|
|
555
|
+
hit(world: IPointData, hitRadius?: number): boolean
|
|
556
|
+
__hitWorld(point: IRadiusPointData, forceHitFill?: boolean): boolean
|
|
557
|
+
__hit(local: IRadiusPointData, forceHitFill?: boolean): boolean
|
|
558
|
+
__hitFill(inner: IRadiusPointData): boolean
|
|
559
|
+
__hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean
|
|
560
|
+
__hitPixel(inner: IRadiusPointData): boolean
|
|
561
|
+
__drawHitPath(canvas: ILeaferCanvas): void
|
|
562
|
+
__updateHitCanvas(): void
|
|
563
|
+
|
|
564
|
+
// LeafRender rewrite
|
|
565
|
+
__render(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
566
|
+
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
567
|
+
__draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void
|
|
568
|
+
__clip(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
569
|
+
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
570
|
+
__drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
571
|
+
__updateWorldOpacity(): void
|
|
572
|
+
__updateChange(): void
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
// path
|
|
577
|
+
__drawPath(canvas: ILeaferCanvas): void
|
|
578
|
+
__drawRenderPath(canvas: ILeaferCanvas): void
|
|
579
|
+
__updatePath(): void
|
|
580
|
+
__updateRenderPath(updateCache?: boolean): void
|
|
581
|
+
|
|
582
|
+
// @leafer-in/motion-path rewrite
|
|
583
|
+
getMotionPathData(): IMotionPathData
|
|
584
|
+
getMotionPoint(motionDistance: number | IUnitData): IRotationPointData
|
|
585
|
+
getMotionTotal(): number
|
|
586
|
+
__updateMotionPath(): void
|
|
587
|
+
|
|
588
|
+
// @leafer-in/animate rewrite
|
|
589
|
+
__runAnimation(type: 'in' | 'out', complete?: IFunction): void
|
|
590
|
+
|
|
591
|
+
// Branch rewrite
|
|
592
|
+
__updateSortChildren(): void
|
|
593
|
+
add(child: ILeaf | ILeaf[] | ILeafInputData | ILeafInputData[], index?: number): void
|
|
594
|
+
|
|
595
|
+
// LeafEventer rewrite
|
|
596
|
+
on(type: string | string[] | IEventParams[] | IEventParamsMap, listener?: IEventListener, options?: IEventOption): void
|
|
597
|
+
off(type?: string | string[], listener?: IEventListener, options?: IEventOption): void
|
|
598
|
+
on_(type: string | string[] | IEventParams[], listener?: IEventListener, bind?: IObject, options?: IEventOption): IEventListenerId
|
|
599
|
+
off_(id: IEventListenerId | IEventListenerId[]): void
|
|
600
|
+
once(type: string | string[] | IEventParams[], listener?: IEventListener, captureOrBind?: boolean | IObject, capture?: boolean): void
|
|
601
|
+
emit(type: string, event?: IEvent | IObject, capture?: boolean): void
|
|
602
|
+
emitEvent(event?: IEvent, capture?: boolean): void
|
|
603
|
+
hasEvent(type: string, capture?: boolean): boolean
|
|
604
|
+
|
|
605
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeafInputData, ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventParamsMap, IEventListenerMap, IFunction, IObject, IJSONOptions,
|
|
1
|
+
import { ILeafInputData, ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventParamsMap, IEventListenerMap, IFunction, IObject, IJSONOptions, IBoundsType, ILeaferCanvas, IRenderOptions, IScaleFixed, IScaleData, ILocationType, ILayoutBoundsData, IPointData, ITransition, IAlign, IAxis, IFindMethod, IValue, IValueFunction, IAttrDecorator, IFourNumber, IRadiusPointData, IMotionPathData, IUnitData, IRotationPointData, IEventParams, IEventListener, IEventOption, IEventListenerId, IEvent } from '@leafer/interface';
|
|
2
2
|
import { LeafData } from '@leafer/data';
|
|
3
3
|
import { LeafLayout } from '@leafer/layout';
|
|
4
4
|
|
|
@@ -66,51 +66,19 @@ declare class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
66
66
|
nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
|
|
67
67
|
removeNextRender(item: IFunction): void;
|
|
68
68
|
__bindLeafer(leafer: ILeaferBase | null): void;
|
|
69
|
-
set(_data: IObject, _isTemp?: boolean): void;
|
|
70
|
-
get<K extends keyof this>(_name?: K | K[] | ILeafInputData): ILeafInputData | this[K];
|
|
71
69
|
setAttr(name: string, value: any): void;
|
|
72
70
|
getAttr(name: string): any;
|
|
73
71
|
getComputedAttr(name: string): any;
|
|
74
72
|
toJSON(options?: IJSONOptions): IObject;
|
|
75
73
|
toString(options?: IJSONOptions): string;
|
|
76
|
-
|
|
77
|
-
__SVG(_data: IObject): void;
|
|
78
|
-
toHTML(): string;
|
|
79
|
-
__setAttr(_attrName: string, _newValue: IValue): boolean;
|
|
80
|
-
__getAttr(_attrName: string): IValue;
|
|
81
|
-
setProxyAttr(_attrName: string, _newValue: IValue): void;
|
|
82
|
-
getProxyAttr(_attrName: string): IValue;
|
|
83
|
-
find(_condition: number | string | IFindMethod, _options?: any): ILeaf[];
|
|
84
|
-
findTag(_tag: string | string[]): ILeaf[];
|
|
85
|
-
findOne(_condition: number | string | IFindMethod, _options?: any): ILeaf | undefined;
|
|
86
|
-
findId(_id: number | string): ILeaf | undefined;
|
|
87
|
-
focus(_value?: boolean): void;
|
|
88
|
-
updateState(): void;
|
|
74
|
+
scaleResize(scaleX: number, scaleY?: number, _noResize?: boolean, _boundsType?: IBoundsType): void;
|
|
89
75
|
updateLayout(): void;
|
|
90
76
|
forceUpdate(attrName?: string): void;
|
|
91
77
|
forceRender(_bounds?: IBoundsData, _sync?: boolean): void;
|
|
92
78
|
__extraUpdate(): void;
|
|
93
|
-
__updateWorldMatrix(): void;
|
|
94
|
-
__updateLocalMatrix(): void;
|
|
95
|
-
__updateWorldBounds(): void;
|
|
96
|
-
__updateLocalBounds(): void;
|
|
97
|
-
__updateLocalBoxBounds(): void;
|
|
98
|
-
__updateLocalStrokeBounds(): void;
|
|
99
|
-
__updateLocalRenderBounds(): void;
|
|
100
|
-
__updateBoxBounds(_secondLayout?: boolean, _bounds?: IBoundsData): void;
|
|
101
|
-
__updateContentBounds(): void;
|
|
102
|
-
__updateStrokeBounds(_bounds?: IBoundsData): void;
|
|
103
|
-
__updateRenderBounds(_bounds?: IBoundsData): void;
|
|
104
|
-
__updateAutoLayout(): void;
|
|
105
|
-
__updateFlowLayout(): void;
|
|
106
|
-
__updateNaturalSize(): void;
|
|
107
|
-
__updateStrokeSpread(): IFourNumber;
|
|
108
|
-
__updateRenderSpread(): IFourNumber;
|
|
109
|
-
__onUpdateSize(): void;
|
|
110
79
|
__updateEraser(value?: boolean): void;
|
|
111
80
|
__renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
112
81
|
__updateMask(_value?: boolean): void;
|
|
113
|
-
__renderMask(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
114
82
|
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
|
|
115
83
|
getClampRenderScale(): number;
|
|
116
84
|
getRenderScaleData(abs?: boolean, scaleFixed?: IScaleFixed, unscale?: boolean): IScaleData;
|
|
@@ -148,51 +116,85 @@ declare class Leaf<TInputData = ILeafInputData> implements ILeaf {
|
|
|
148
116
|
rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
|
|
149
117
|
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
|
|
150
118
|
flip(axis: IAxis, transition?: ITransition): void;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
119
|
+
remove(_child?: ILeaf | number | string | IFindMethod, destroy?: boolean): void;
|
|
120
|
+
dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
|
|
121
|
+
static changeAttr(attrName: string, defaultValue: IValue | IValueFunction, fn?: IAttrDecorator): void;
|
|
122
|
+
static addAttr(attrName: string, defaultValue: IValue | IValueFunction, fn?: IAttrDecorator, helpValue?: IValue): void;
|
|
123
|
+
__emitLifeEvent(type: string): void;
|
|
124
|
+
destroy(): void;
|
|
125
|
+
}
|
|
126
|
+
interface Leaf {
|
|
127
|
+
set(data: IObject, isTemp?: boolean): void;
|
|
128
|
+
get<K extends keyof this>(name?: K | K[] | ILeafInputData): ILeafInputData | this[K];
|
|
129
|
+
toSVG(): string;
|
|
130
|
+
__SVG(data: IObject): void;
|
|
131
|
+
toHTML(): string;
|
|
132
|
+
__setAttr(attrName: string, newValue: IValue): boolean;
|
|
133
|
+
__getAttr(attrName: string): IValue;
|
|
134
|
+
setProxyAttr(attrName: string, newValue: IValue): void;
|
|
135
|
+
getProxyAttr(attrName: string): IValue;
|
|
136
|
+
find(condition: number | string | IFindMethod, options?: any): ILeaf[];
|
|
137
|
+
findTag(tag: string | string[]): ILeaf[];
|
|
138
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined;
|
|
139
|
+
findId(id: number | string): ILeaf | undefined;
|
|
140
|
+
focus(value?: boolean): void;
|
|
141
|
+
updateState(): void;
|
|
142
|
+
__updateWorldMatrix(): void;
|
|
143
|
+
__updateLocalMatrix(): void;
|
|
144
|
+
__updateWorldBounds(): void;
|
|
145
|
+
__updateLocalBounds(): void;
|
|
146
|
+
__updateLocalBoxBounds(): void;
|
|
147
|
+
__updateLocalStrokeBounds(): void;
|
|
148
|
+
__updateLocalRenderBounds(): void;
|
|
149
|
+
__updateBoxBounds(secondLayout?: boolean, bounds?: IBoundsData): void;
|
|
150
|
+
__updateContentBounds(): void;
|
|
151
|
+
__updateStrokeBounds(bounds?: IBoundsData): void;
|
|
152
|
+
__updateRenderBounds(bounds?: IBoundsData): void;
|
|
153
|
+
__updateAutoLayout(): void;
|
|
154
|
+
__updateFlowLayout(): void;
|
|
155
|
+
__updateNaturalSize(): void;
|
|
156
|
+
__updateStrokeSpread(): IFourNumber;
|
|
157
|
+
__updateRenderSpread(): IFourNumber;
|
|
158
|
+
__onUpdateSize(): void;
|
|
159
|
+
__renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
160
|
+
__scaleResize(scaleX: number, scaleY: number): void;
|
|
161
|
+
resizeWidth(width: number): void;
|
|
162
|
+
resizeHeight(height: number): void;
|
|
163
|
+
hit(world: IPointData, hitRadius?: number): boolean;
|
|
164
|
+
__hitWorld(point: IRadiusPointData, forceHitFill?: boolean): boolean;
|
|
165
|
+
__hit(local: IRadiusPointData, forceHitFill?: boolean): boolean;
|
|
166
|
+
__hitFill(inner: IRadiusPointData): boolean;
|
|
167
|
+
__hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean;
|
|
168
|
+
__hitPixel(inner: IRadiusPointData): boolean;
|
|
169
|
+
__drawHitPath(canvas: ILeaferCanvas): void;
|
|
162
170
|
__updateHitCanvas(): void;
|
|
163
|
-
__render(
|
|
164
|
-
__drawFast(
|
|
165
|
-
__draw(
|
|
166
|
-
__clip(
|
|
167
|
-
__renderShape(
|
|
168
|
-
__drawShape(
|
|
171
|
+
__render(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
172
|
+
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
173
|
+
__draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
|
|
174
|
+
__clip(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
175
|
+
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
176
|
+
__drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
169
177
|
__updateWorldOpacity(): void;
|
|
170
178
|
__updateChange(): void;
|
|
171
|
-
__drawPath(
|
|
172
|
-
__drawRenderPath(
|
|
179
|
+
__drawPath(canvas: ILeaferCanvas): void;
|
|
180
|
+
__drawRenderPath(canvas: ILeaferCanvas): void;
|
|
173
181
|
__updatePath(): void;
|
|
174
|
-
__updateRenderPath(
|
|
182
|
+
__updateRenderPath(updateCache?: boolean): void;
|
|
175
183
|
getMotionPathData(): IMotionPathData;
|
|
176
|
-
getMotionPoint(
|
|
184
|
+
getMotionPoint(motionDistance: number | IUnitData): IRotationPointData;
|
|
177
185
|
getMotionTotal(): number;
|
|
178
186
|
__updateMotionPath(): void;
|
|
179
|
-
__runAnimation(
|
|
187
|
+
__runAnimation(type: 'in' | 'out', complete?: IFunction): void;
|
|
180
188
|
__updateSortChildren(): void;
|
|
181
|
-
add(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
emitEvent(_event?: IEvent, _capture?: boolean): void;
|
|
191
|
-
hasEvent(_type: string, _capture?: boolean): boolean;
|
|
192
|
-
static changeAttr(attrName: string, defaultValue: IValue | IValueFunction, fn?: IAttrDecorator): void;
|
|
193
|
-
static addAttr(attrName: string, defaultValue: IValue | IValueFunction, fn?: IAttrDecorator, helpValue?: IValue): void;
|
|
194
|
-
__emitLifeEvent(type: string): void;
|
|
195
|
-
destroy(): void;
|
|
189
|
+
add(child: ILeaf | ILeaf[] | ILeafInputData | ILeafInputData[], index?: number): void;
|
|
190
|
+
on(type: string | string[] | IEventParams[] | IEventParamsMap, listener?: IEventListener, options?: IEventOption): void;
|
|
191
|
+
off(type?: string | string[], listener?: IEventListener, options?: IEventOption): void;
|
|
192
|
+
on_(type: string | string[] | IEventParams[], listener?: IEventListener, bind?: IObject, options?: IEventOption): IEventListenerId;
|
|
193
|
+
off_(id: IEventListenerId | IEventListenerId[]): void;
|
|
194
|
+
once(type: string | string[] | IEventParams[], listener?: IEventListener, captureOrBind?: boolean | IObject, capture?: boolean): void;
|
|
195
|
+
emit(type: string, event?: IEvent | IObject, capture?: boolean): void;
|
|
196
|
+
emitEvent(event?: IEvent, capture?: boolean): void;
|
|
197
|
+
hasEvent(type: string, capture?: boolean): boolean;
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
declare class Branch extends Leaf {
|