@leafer/interface 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/interface",
3
- "version": "1.0.0-rc.22",
3
+ "version": "1.0.0-rc.24",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -5,7 +5,7 @@ import { ILayouter, ILayouterConfig } from '../layouter/ILayouter'
5
5
  import { ISelector, ISelectorConfig } from '../selector/ISelector'
6
6
  import { IInteraction, IInteractionCanvas, IInteractionConfig } from '../interaction/IInteraction'
7
7
  import { IWatcher, IWatcherConfig } from '../watcher/IWatcher'
8
- import { IAutoBounds, IBoundsData, IPointData, IScreenSizeData, IBounds } from '../math/IMath'
8
+ import { IAutoBounds, IBoundsData, IPointData, IScreenSizeData, IBounds, IClientPointData } from '../math/IMath'
9
9
  import { ICanvasManager } from '../canvas/ICanvasManager'
10
10
  import { IHitCanvasManager } from '../canvas/IHitCanvasManager'
11
11
  import { IEventListenerId } from '../event/IEventer'
@@ -56,6 +56,7 @@ export interface ILeaferAttrData {
56
56
  config: ILeaferConfig
57
57
 
58
58
  readonly cursorPoint: IPointData
59
+ readonly clientBounds: IBoundsData
59
60
  leafs: number
60
61
 
61
62
  __eventIds: IEventListenerId[]
@@ -69,7 +70,6 @@ export interface ILeaferAttrData {
69
70
  unlockLayout(): void
70
71
  lockLayout(): void
71
72
 
72
- forceFullRender(): void
73
73
  forceRender(bounds?: IBoundsData): void
74
74
  updateCursor(cursor?: ICursorType): void
75
75
  resize(size: IScreenSizeData): void
@@ -81,6 +81,8 @@ export interface ILeaferAttrData {
81
81
  zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean): IBoundsData
82
82
  getValidMove(moveX: number, moveY: number): IPointData
83
83
  getValidScale(changeScale: number): number
84
+
85
+ getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData
84
86
  }
85
87
 
86
88
  export type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData
@@ -189,6 +189,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
189
189
  resize(size: IScreenSizeData): void
190
190
  updateViewSize(): void
191
191
  updateClientBounds(): void
192
+ getClientBounds(update?: boolean): IBoundsData
192
193
 
193
194
  // other
194
195
  isSameSize(options: ILeaferCanvasConfig): boolean
@@ -4,8 +4,8 @@ import { IEventer } from '../event/IEventer'
4
4
  import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
5
5
  import { IRenderOptions } from '../renderer/IRenderer'
6
6
 
7
- import { IObject, INumber, IBoolean, IValue, IString, IPathString } from '../data/IData'
8
- import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutAttr, ILayoutBoundsData, IMatrixData, IMatrixWithBoundsScaleData, IMatrixWithScaleData } from '../math/IMath'
7
+ import { IObject, INumber, IBoolean, IValue, IString, IPathString, IFourNumber } from '../data/IData'
8
+ import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, ILayoutAttr, ILayoutBoundsData, IMatrixData, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAutoBoxData, IUnitPointData } from '../math/IMath'
9
9
  import { IFunction } from '../function/IFunction'
10
10
 
11
11
  import { ILeafDataProxy } from './module/ILeafDataProxy'
@@ -35,15 +35,14 @@ export interface ILeafAttrData {
35
35
 
36
36
  blendMode: IBlendMode
37
37
  opacity: INumber
38
- visible: IBoolean
38
+ visible: IBoolean | 0 // 0 = display: none
39
39
  selected: IBoolean
40
40
  disabled: IBoolean
41
41
  locked: IBoolean
42
42
  zIndex: INumber
43
43
 
44
- mask: IBoolean
45
- maskType: IMaskType
46
- eraser: IBoolean
44
+ mask: IBoolean | IMaskType
45
+ eraser: IBoolean | IEraserType
47
46
 
48
47
  // layout data
49
48
  x: INumber
@@ -57,20 +56,43 @@ export interface ILeafAttrData {
57
56
  skewY: INumber
58
57
 
59
58
  scale: INumber | IPointData // helper
60
- around: IAround
59
+
60
+ offsetX: INumber
61
+ offsetY: INumber
62
+ scrollX: INumber
63
+ scrollY: INumber
64
+
65
+ origin: IAlign | IUnitPointData
66
+ around: IAlign | IUnitPointData
61
67
 
62
68
  lazy: IBoolean
63
69
  pixelRatio: INumber
64
70
 
65
- draggable: IBoolean | 'x' | 'y'
66
- dragBounds?: IBoundsData | 'parent'
67
-
68
71
  path: IPathCommandData | IPathString
69
72
  windingRule: IWindingRule
70
73
  closed: boolean
71
74
 
75
+ // auto layout
76
+ flow: IFlowType
77
+ padding: IFourNumber
78
+ gap: IGap | IPointGap
79
+ align: IFlowAlign | IFlowAxisAlign
80
+ wrap: IWrap
81
+ itemBox: IFlowBoxType
82
+
83
+ inFlow: IBoolean
84
+ autoWidth: IAutoSize
85
+ autoHeight: IAutoSize
86
+ autoBox: IAutoBoxData | IConstraint
87
+
88
+ widthRange: IRangeSize
89
+ heightRange: IRangeSize
90
+
91
+ // interactive
92
+ draggable: IBoolean | IAxis
93
+ dragBounds?: IBoundsData | 'parent'
94
+
72
95
  editable: IBoolean
73
- editSize: IEditSize
74
96
 
75
97
  hittable: IBoolean
76
98
  hitFill: IHitType
@@ -90,6 +112,48 @@ export interface ILeafAttrData {
90
112
  disabledStyle: ILeafInputData
91
113
  }
92
114
 
115
+
116
+ export type IAxis = 'x' | 'y'
117
+
118
+ export type IAxisReverse = 'x-reverse' | 'y-reverse'
119
+
120
+ export type IFlowType = boolean | IAxis | IAxisReverse
121
+
122
+ export type IFlowBoxType = 'box' | 'stroke'
123
+
124
+ export type IGap = INumber | 'auto' | 'fit'
125
+
126
+ export interface IPointGap { x?: IGap, y?: IGap }
127
+
128
+ export type IAxisAlign = 'from' | 'center' | 'to'
129
+
130
+ export interface IFlowAxisAlign { content?: IFlowAlign, rowX?: IAxisAlign, rowY?: IAxisAlign }
131
+
132
+ export type IWrap = boolean | 'reverse'
133
+
134
+ export type IAutoSize = IBoolean | INumber | IPercentData
135
+
136
+ export interface IRangeSize {
137
+ min?: number
138
+ max?: number
139
+ }
140
+
141
+ export interface IUnitData {
142
+ type: 'percent' | 'px'
143
+ value: number
144
+ }
145
+
146
+ export interface IPercentData extends IUnitData {
147
+ type: 'percent'
148
+ }
149
+
150
+ export interface IConstraint {
151
+ x: IConstraintType
152
+ y: IConstraintType
153
+ }
154
+
155
+ export type IConstraintType = 'from' | 'center' | 'to' | 'from-to' | 'scale'
156
+
93
157
  export type IHitType =
94
158
  | 'path'
95
159
  | 'pixel'
@@ -101,6 +165,10 @@ export type IMaskType =
101
165
  | 'pixel'
102
166
  | 'clipping'
103
167
 
168
+ export type IEraserType =
169
+ | 'path'
170
+ | 'pixel'
171
+
104
172
  export type IBlendMode =
105
173
  | 'pass-through'
106
174
  | 'normal'
@@ -129,7 +197,7 @@ export type IBlendMode =
129
197
  | 'destination-atop'
130
198
  | 'xor'
131
199
 
132
- export type IEditSize = 'size' | 'scale'
200
+ export type IEditSize = 'size' | 'font-size' | 'scale'
133
201
  export interface IImageCursor {
134
202
  url: string
135
203
  x?: number
@@ -138,19 +206,31 @@ export interface IImageCursor {
138
206
  }
139
207
 
140
208
  export type IDirection =
141
- | 'topLeft'
209
+ | 'top-left'
142
210
  | 'top'
143
- | 'topRight'
211
+ | 'top-right'
144
212
  | 'right'
145
- | 'bottomRight'
213
+ | 'bottom-right'
146
214
  | 'bottom'
147
- | 'bottomLeft'
215
+ | 'bottom-left'
148
216
  | 'left'
149
217
  | 'center'
150
218
 
219
+ export type IAlign = IDirection
220
+
221
+ export type IBaseLineAlign =
222
+ | 'baseline-left'
223
+ | 'baseline-center'
224
+ | 'baseline-right'
225
+
226
+ export type IFlowAlign =
227
+ | IAlign
228
+ | IBaseLineAlign
229
+
230
+
151
231
  export type IAround =
152
- | IDirection
153
- | IPointData
232
+ | IAlign
233
+ | IUnitPointData
154
234
 
155
235
  export type ICursorType =
156
236
  | IImageCursor
@@ -209,15 +289,14 @@ export interface ILeafInputData {
209
289
 
210
290
  blendMode?: IBlendMode
211
291
  opacity?: INumber
212
- visible?: IBoolean
292
+ visible?: IBoolean | 0
213
293
  selected?: IBoolean
214
294
  disabled?: IBoolean
215
295
  locked?: IBoolean
216
296
  zIndex?: INumber
217
297
 
218
- mask?: IBoolean
219
- maskType?: IMaskType
220
- eraser?: IBoolean
298
+ mask?: IBoolean | IMaskType
299
+ eraser?: IBoolean | IEraserType
221
300
 
222
301
  // layout data
223
302
  x?: INumber
@@ -231,20 +310,43 @@ export interface ILeafInputData {
231
310
  skewY?: INumber
232
311
 
233
312
  scale?: INumber | IPointData // helper
234
- around?: IAround
313
+
314
+ offsetX?: INumber
315
+ offsetY?: INumber
316
+ scrollX?: INumber
317
+ scrollY?: INumber
318
+
319
+ origin?: IAlign | IUnitPointData
320
+ around?: IAlign | IUnitPointData
235
321
 
236
322
  lazy?: IBoolean
237
323
  pixelRatio?: INumber
238
324
 
239
- draggable?: IBoolean | 'x' | 'y'
240
- dragBounds?: IBoundsData | 'parent'
241
-
242
325
  path?: IPathCommandData | IPathString
243
326
  windingRule?: IWindingRule
244
327
  closed?: boolean
245
328
 
329
+ // auto layout
330
+ flow?: IFlowType
331
+ padding?: IFourNumber
332
+ gap?: IGap | IPointGap
333
+ align?: IFlowAlign | IFlowAxisAlign
334
+ wrap?: IWrap
335
+ itemBox?: IFlowBoxType
336
+
337
+ inFlow?: IBoolean
338
+ autoWidth?: IAutoSize
339
+ autoHeight?: IAutoSize
340
+ autoBox?: IAutoBoxData | IConstraint
341
+
342
+ widthRange?: IRangeSize
343
+ heightRange?: IRangeSize
344
+
345
+ // interactive
346
+ draggable?: IBoolean | IAxis
347
+ dragBounds?: IBoundsData | 'parent'
348
+
246
349
  editable?: IBoolean
247
- editSize?: IEditSize
248
350
 
249
351
  hittable?: IBoolean
250
352
  hitFill?: IHitType
@@ -276,15 +378,14 @@ export interface ILeafComputedData {
276
378
 
277
379
  blendMode?: IBlendMode
278
380
  opacity?: number
279
- visible?: boolean
381
+ visible?: boolean | 0
280
382
  selected?: boolean
281
383
  disabled?: boolean
282
384
  locked?: boolean
283
385
  zIndex?: number
284
386
 
285
- mask?: boolean
286
- maskType?: IMaskType
287
- eraser?: boolean
387
+ mask?: boolean | IMaskType
388
+ eraser?: boolean | IEraserType
288
389
 
289
390
  // layout data
290
391
  x?: number
@@ -297,7 +398,13 @@ export interface ILeafComputedData {
297
398
  skewX?: number
298
399
  skewY?: number
299
400
 
300
- around?: IAround
401
+ offsetX?: number
402
+ offsetY?: number
403
+ scrollX?: number
404
+ scrollY?: number
405
+
406
+ origin?: IAlign | IUnitPointData
407
+ around?: IAlign | IUnitPointData
301
408
 
302
409
  lazy?: boolean
303
410
  pixelRatio?: number
@@ -306,11 +413,27 @@ export interface ILeafComputedData {
306
413
  windingRule?: IWindingRule
307
414
  closed?: boolean
308
415
 
309
- draggable?: boolean | 'x' | 'y'
416
+ // auto layout
417
+ flow?: IFlowType
418
+ padding?: IFourNumber
419
+ gap?: IGap | IPointGap
420
+ align?: IFlowAlign | IFlowAxisAlign
421
+ wrap?: IWrap
422
+ itemBox?: IFlowBoxType
423
+
424
+ inFlow?: boolean
425
+ autoWidth?: IAutoSize
426
+ autoHeight?: IAutoSize
427
+ autoBox?: IAutoBoxData | IConstraint
428
+
429
+ widthRange?: IRangeSize
430
+ heightRange?: IRangeSize
431
+
432
+ // interactive
433
+ draggable?: boolean | IAxis
310
434
  dragBounds?: IBoundsData | 'parent'
311
435
 
312
436
  editable?: boolean
313
- editSize?: IEditSize
314
437
 
315
438
  hittable?: boolean
316
439
  hitFill?: IHitType
@@ -332,8 +455,17 @@ export interface ILeafComputedData {
332
455
  // other
333
456
  __childBranchNumber?: number // 存在子分支的个数
334
457
  __complex?: boolean // 外观是否复杂
458
+
335
459
  __naturalWidth?: number
336
460
  __naturalHeight?: number
461
+
462
+ readonly __autoWidth?: boolean
463
+ readonly __autoHeight?: boolean
464
+ readonly __autoSide?: boolean
465
+ readonly __autoSize?: boolean
466
+
467
+ readonly __useNaturalRatio: boolean // 宽高存在一个值时,另一个自动值是否采用natural尺寸比例
468
+ readonly __isLinePath: boolean
337
469
  readonly __blendMode: string
338
470
 
339
471
  __useArrow?: boolean
@@ -404,6 +536,11 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
404
536
  __hasEraser?: boolean
405
537
  __hitCanvas?: IHitCanvas
406
538
 
539
+ __flowBounds?: IBoundsData // localBoxBounds or localStrokeBounds
540
+ __widthGrow?: number
541
+ __heightGrow?: number
542
+ __hasGrow?: boolean
543
+
407
544
  readonly __onlyHitMask: boolean
408
545
  readonly __ignoreHitWorld: boolean
409
546
 
@@ -439,7 +576,9 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
439
576
 
440
577
  // find
441
578
  find(condition: number | string | IFindMethod, options?: any): ILeaf[]
579
+ findTag(tag: string | string[]): ILeaf[]
442
580
  findOne(condition: number | string | IFindMethod, options?: any): ILeaf
581
+ findId(id: number | string): ILeaf
443
582
 
444
583
  focus(value?: boolean): void
445
584
  forceUpdate(attrName?: string): void
@@ -458,11 +597,13 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
458
597
  __updateLocalStrokeBounds(): void
459
598
  __updateLocalRenderBounds(): void
460
599
 
600
+ __updateContentBounds(): void
461
601
  __updateBoxBounds(): void
462
602
  __updateStrokeBounds(): void
463
603
  __updateRenderBounds(): void
464
604
 
465
605
  __updateAutoLayout(): void
606
+ __updateFlowLayout(): void
466
607
  __updateNaturalSize(): void
467
608
 
468
609
  __updateStrokeSpread(): number
@@ -474,6 +615,7 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
474
615
  __updateEraser(value?: boolean): void
475
616
  __updateMask(value?: boolean): void
476
617
  __renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void
618
+ __renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void
477
619
 
478
620
  // convert
479
621
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData // when render use other matrix
@@ -15,6 +15,7 @@ export interface ILeafBounds {
15
15
  __updateRenderBounds?(): void
16
16
 
17
17
  __updateAutoLayout?(): void
18
+ __updateFlowLayout?(): void
18
19
  __updateNaturalSize?(): void
19
20
 
20
21
  __updateStrokeSpread?(): number
@@ -8,7 +8,7 @@ export type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>
8
8
 
9
9
  export interface ILeafEventer {
10
10
  on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
11
- off?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
11
+ off?(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void
12
12
  on_?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
13
13
  off_?(id: IEventListenerId | IEventListenerId[]): void
14
14
  once?(type: string | string[], listener: IEventListener, capture?: boolean): void
@@ -36,7 +36,7 @@ export interface IEventer extends ILeafEventer {
36
36
  __bubbleMap?: IEventListenerMap
37
37
 
38
38
  on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
39
- off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
39
+ off(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void
40
40
  on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
41
41
  off_(id: IEventListenerId | IEventListenerId[]): void
42
42
  once(type: string | string[], listener: IEventListener): void
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { IAppBase } from './app/IApp'
2
2
  export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator, IZoomType } from './app/ILeafer'
3
- export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IMaskType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IDirection, IAround, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
3
+ export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, IAxis, IGap, IPointGap, IAxisReverse, IBaseLineAlign, IWrap, IAutoSize, IRangeSize, IPercentData, IUnitData, IConstraint, IConstraintType, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IDirection, IAround, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
4
4
  export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
6
6
 
@@ -19,7 +19,7 @@ export { IBranchRender, IBranchRenderModule } from './display/module/IBranchRend
19
19
  export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'
20
20
  export { IWatcher, IWatchEventData, IWatcherConfig } from './watcher/IWatcher'
21
21
  export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
22
- export { ISelector, ISelectorConfig, ISelectorProxy, IFindMethod, IPickResult, IPickOptions, IPickBottom, IAnswer } from './selector/ISelector'
22
+ export { ISelector, ISelectorConfig, ISelectorProxy, IFindCondition, IFindMethod, IPickResult, IPickOptions, IPickBottom, IAnswer } from './selector/ISelector'
23
23
 
24
24
  export { ICanvasManager } from './canvas/ICanvasManager'
25
25
  export { IHitCanvasManager } from './canvas/IHitCanvasManager'
@@ -52,5 +52,5 @@ export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPo
52
52
 
53
53
  export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IPointDataMap, IDataTypeHandle } from './data/IData'
54
54
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
55
- export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithOptionScaleData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
55
+ export { IPoint, IPointData, IFromToData, IUnitPointData, IScrollPointData, IClientPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataFn, IOffsetBoundsData, ITwoPointBoundsData, IAutoBounds, IAutoBoxData, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithScaleData, IMatrixWithOptionScaleData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IScaleRotationData, IScaleData, ISkewData, ILayoutBoundsData, ILayoutData, ILayoutAttr } from './math/IMath'
56
56
  export { IFunction, IStringFunction, INumberFunction, IObjectFunction, IPointDataFunction, IAttrDecorator } from './function/IFunction'
@@ -2,7 +2,7 @@ import { INumberFunction, IPointDataFunction } from '../function/IFunction'
2
2
  import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent, IUIEvent, IKeyEvent } from '../event/IUIEvent'
3
3
  import { ILeaf, ICursorType } from '../display/ILeaf'
4
4
  import { ILeafList } from '../data/IList'
5
- import { IPointData } from '../math/IMath'
5
+ import { IClientPointData, IPointData } from '../math/IMath'
6
6
  import { ISelector, IPickOptions, IPickBottom } from '../selector/ISelector'
7
7
  import { IBounds } from '../math/IMath'
8
8
  import { IControl } from '../control/IControl'
@@ -70,6 +70,8 @@ export interface IInteraction extends IControl {
70
70
  updateCursor(hoverData?: IPointerEvent): void
71
71
  setCursor(cursor: ICursorType | ICursorType[]): void
72
72
 
73
+ getLocal(clientPoint: IClientPointData, updateClient?: boolean): IPointData
74
+
73
75
  emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
74
76
  }
75
77
 
@@ -2,7 +2,7 @@ import { IBoundsData, IMatrixData, ILayoutBoundsData, IPointData } from '../math
2
2
  import { ILeaf } from '../display/ILeaf'
3
3
 
4
4
  export type ILocationType = 'world' | 'page' | 'local' | 'inner'
5
- export type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render'
5
+ export type IBoundsType = 'content' | 'box' | 'stroke' | 'render'
6
6
 
7
7
  export interface ILeafLayout {
8
8
 
@@ -12,19 +12,24 @@ export interface ILeafLayout {
12
12
 
13
13
  // inner
14
14
 
15
+ contentBounds: IBoundsData // | content |
15
16
  boxBounds: IBoundsData // | content + padding |
16
17
  strokeBounds: IBoundsData // | boxBounds + border |
17
18
  renderBounds: IBoundsData // | strokeBounds + shadow |
18
19
 
19
- // auto layout
20
- marginBounds: IBoundsData // | strokeBounds + margin |
21
- contentBounds: IBoundsData // | content |
22
-
23
20
  // local
24
21
 
25
- //localBoxBounds: IBoundsData = leaf.__local
26
- localStrokeBounds?: IBoundsData
27
- localRenderBounds?: IBoundsData
22
+ localContentBounds: IBoundsData
23
+ // localBoxBounds: IBoundsData // use leaf.__localBoxBounds
24
+ localStrokeBounds: IBoundsData
25
+ localRenderBounds: IBoundsData
26
+
27
+ // world
28
+
29
+ worldContentBounds: IBoundsData
30
+ worldBoxBounds: IBoundsData
31
+ worldStrokeBounds: IBoundsData
32
+ // worldRenderBounds: IBoundsData // use leaf.__world
28
33
 
29
34
  // state
30
35
  resized: boolean
@@ -58,8 +63,8 @@ export interface ILeafLayout {
58
63
  affectChildrenSort?: boolean
59
64
 
60
65
  strokeSpread: number
61
- renderSpread: number // -1 表示监视变化,不影响实际renderBounds,目前用在Box上
62
- strokeBoxSpread: number
66
+ strokeBoxSpread: number // 用于生成strokeBounds
67
+ renderSpread: number // -1 表示需监视变化,不影响实际renderBounds,目前用在Box上
63
68
  renderShapeSpread: number
64
69
 
65
70
  // temp local
@@ -84,8 +89,10 @@ export interface ILeafLayout {
84
89
  getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[]
85
90
 
86
91
  // 独立 / 引用 boxBounds
92
+ shrinkContent(): void
87
93
  spreadStroke(): void
88
94
  spreadRender(): void
95
+ shrinkContentCancel(): void
89
96
  spreadStrokeCancel(): void
90
97
  spreadRenderCancel(): void
91
98
 
package/src/math/IMath.ts CHANGED
@@ -5,6 +5,27 @@ export interface IPointData {
5
5
  y: number
6
6
  }
7
7
 
8
+ export interface IUnitPointData {
9
+ type?: 'percent' | 'px'
10
+ x: number
11
+ y: number
12
+ }
13
+
14
+ export interface IFromToData {
15
+ from: IPointData
16
+ to: IPointData
17
+ }
18
+
19
+ export interface IScrollPointData {
20
+ scrollX: number
21
+ scrollY: number
22
+ }
23
+
24
+ export interface IClientPointData {
25
+ clientX: number
26
+ clientY: number
27
+ }
28
+
8
29
  export interface IPoint extends IPointData {
9
30
  set(x?: number | IPointData, y?: number): IPoint
10
31
  get(): IPointData
@@ -70,7 +91,7 @@ export interface IBounds extends IBoundsData, ITwoPointBoundsData {
70
91
  toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds
71
92
  getFitMatrix(put: IBoundsData, baseScale?: number): IMatrix
72
93
 
73
- spread(fourNumber: IFourNumber, spreadY?: number): IBounds
94
+ spread(fourNumber: IFourNumber): IBounds
74
95
  shrink(fourNumber: IFourNumber): IBounds
75
96
  ceil(): IBounds
76
97
  unsign(): IBounds
@@ -106,13 +127,15 @@ export interface ITwoPointBoundsData {
106
127
  maxY: number
107
128
  }
108
129
 
109
-
110
- export interface IAutoBoundsData {
130
+ export interface IAutoBoxData {
111
131
  top?: number
112
132
  right?: number
113
133
  bottom?: number
114
134
  left?: number
135
+ }
136
+
115
137
 
138
+ export interface IAutoBoundsData extends IAutoBoxData {
116
139
  width?: number
117
140
  height?: number
118
141
  }
@@ -31,6 +31,12 @@ export interface ISelectorConfig {
31
31
 
32
32
  export type IAnswer = 0 | 1 | 2 | 3
33
33
 
34
+ export interface IFindCondition {
35
+ id?: number | string,
36
+ className?: string,
37
+ tag?: string | string[]
38
+ }
39
+
34
40
  export interface IFindMethod {
35
41
  (leaf: ILeaf, options?: any): IAnswer
36
42
  }
package/types/index.d.ts CHANGED
@@ -4,6 +4,23 @@ interface IPointData {
4
4
  x: number;
5
5
  y: number;
6
6
  }
7
+ interface IUnitPointData {
8
+ type?: 'percent' | 'px';
9
+ x: number;
10
+ y: number;
11
+ }
12
+ interface IFromToData {
13
+ from: IPointData;
14
+ to: IPointData;
15
+ }
16
+ interface IScrollPointData {
17
+ scrollX: number;
18
+ scrollY: number;
19
+ }
20
+ interface IClientPointData {
21
+ clientX: number;
22
+ clientY: number;
23
+ }
7
24
  interface IPoint extends IPointData {
8
25
  set(x?: number | IPointData, y?: number): IPoint;
9
26
  get(): IPointData;
@@ -55,7 +72,7 @@ interface IBounds extends IBoundsData, ITwoPointBoundsData {
55
72
  toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
56
73
  toInnerOf(matrix: IMatrixData, to?: IBoundsData): IBounds;
57
74
  getFitMatrix(put: IBoundsData, baseScale?: number): IMatrix;
58
- spread(fourNumber: IFourNumber, spreadY?: number): IBounds;
75
+ spread(fourNumber: IFourNumber): IBounds;
59
76
  shrink(fourNumber: IFourNumber): IBounds;
60
77
  ceil(): IBounds;
61
78
  unsign(): IBounds;
@@ -84,11 +101,13 @@ interface ITwoPointBoundsData {
84
101
  maxX: number;
85
102
  maxY: number;
86
103
  }
87
- interface IAutoBoundsData {
104
+ interface IAutoBoxData {
88
105
  top?: number;
89
106
  right?: number;
90
107
  bottom?: number;
91
108
  left?: number;
109
+ }
110
+ interface IAutoBoundsData extends IAutoBoxData {
92
111
  width?: number;
93
112
  height?: number;
94
113
  }
@@ -368,7 +387,7 @@ interface IKeepTouchData {
368
387
  type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>;
369
388
  interface ILeafEventer {
370
389
  on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
371
- off?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
390
+ off?(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void;
372
391
  on_?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId;
373
392
  off_?(id: IEventListenerId | IEventListenerId[]): void;
374
393
  once?(type: string | string[], listener: IEventListener, capture?: boolean): void;
@@ -422,7 +441,7 @@ interface IEventer extends ILeafEventer {
422
441
  __captureMap?: IEventListenerMap;
423
442
  __bubbleMap?: IEventListenerMap;
424
443
  on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
425
- off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void;
444
+ off(type?: string | string[], listener?: IEventListener, options?: IEventListenerOptions | boolean): void;
426
445
  on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId;
427
446
  off_(id: IEventListenerId | IEventListenerId[]): void;
428
447
  once(type: string | string[], listener: IEventListener): void;
@@ -786,17 +805,20 @@ type IExportImageType = 'jpg' | 'png' | 'webp';
786
805
  type IExportFileType = IExportImageType | 'svg' | 'pdf' | 'json';
787
806
 
788
807
  type ILocationType = 'world' | 'page' | 'local' | 'inner';
789
- type IBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render';
808
+ type IBoundsType = 'content' | 'box' | 'stroke' | 'render';
790
809
  interface ILeafLayout {
791
810
  leaf: ILeaf;
792
811
  proxyZoom: boolean;
812
+ contentBounds: IBoundsData;
793
813
  boxBounds: IBoundsData;
794
814
  strokeBounds: IBoundsData;
795
815
  renderBounds: IBoundsData;
796
- marginBounds: IBoundsData;
797
- contentBounds: IBoundsData;
798
- localStrokeBounds?: IBoundsData;
799
- localRenderBounds?: IBoundsData;
816
+ localContentBounds: IBoundsData;
817
+ localStrokeBounds: IBoundsData;
818
+ localRenderBounds: IBoundsData;
819
+ worldContentBounds: IBoundsData;
820
+ worldBoxBounds: IBoundsData;
821
+ worldStrokeBounds: IBoundsData;
800
822
  resized: boolean;
801
823
  waitAutoLayout: boolean;
802
824
  matrixChanged: boolean;
@@ -815,8 +837,8 @@ interface ILeafLayout {
815
837
  affectRotation: boolean;
816
838
  affectChildrenSort?: boolean;
817
839
  strokeSpread: number;
818
- renderSpread: number;
819
840
  strokeBoxSpread: number;
841
+ renderSpread: number;
820
842
  renderShapeSpread: number;
821
843
  a: number;
822
844
  b: number;
@@ -834,8 +856,10 @@ interface ILeafLayout {
834
856
  getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData;
835
857
  getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData;
836
858
  getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[];
859
+ shrinkContent(): void;
837
860
  spreadStroke(): void;
838
861
  spreadRender(): void;
862
+ shrinkContentCancel(): void;
839
863
  spreadStrokeCancel(): void;
840
864
  spreadRenderCancel(): void;
841
865
  boxChange(): void;
@@ -1005,6 +1029,7 @@ interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
1005
1029
  resize(size: IScreenSizeData): void;
1006
1030
  updateViewSize(): void;
1007
1031
  updateClientBounds(): void;
1032
+ getClientBounds(update?: boolean): IBoundsData;
1008
1033
  isSameSize(options: ILeaferCanvasConfig): boolean;
1009
1034
  getSameCanvas(useSameWorldTransform?: boolean, useSameSmooth?: boolean): ILeaferCanvas;
1010
1035
  recycle(clearBounds?: IBoundsData): void;
@@ -1084,6 +1109,7 @@ interface ILeafBounds {
1084
1109
  __updateStrokeBounds?(): void;
1085
1110
  __updateRenderBounds?(): void;
1086
1111
  __updateAutoLayout?(): void;
1112
+ __updateFlowLayout?(): void;
1087
1113
  __updateNaturalSize?(): void;
1088
1114
  __updateStrokeSpread?(): number;
1089
1115
  __updateRenderSpread?(): number;
@@ -1166,6 +1192,11 @@ interface IPickBottom {
1166
1192
  interface ISelectorConfig {
1167
1193
  }
1168
1194
  type IAnswer = 0 | 1 | 2 | 3;
1195
+ interface IFindCondition {
1196
+ id?: number | string;
1197
+ className?: string;
1198
+ tag?: string | string[];
1199
+ }
1169
1200
  interface IFindMethod {
1170
1201
  (leaf: ILeaf, options?: any): IAnswer;
1171
1202
  }
@@ -1197,14 +1228,13 @@ interface ILeafAttrData {
1197
1228
  className: IString;
1198
1229
  blendMode: IBlendMode;
1199
1230
  opacity: INumber;
1200
- visible: IBoolean;
1231
+ visible: IBoolean | 0;
1201
1232
  selected: IBoolean;
1202
1233
  disabled: IBoolean;
1203
1234
  locked: IBoolean;
1204
1235
  zIndex: INumber;
1205
- mask: IBoolean;
1206
- maskType: IMaskType;
1207
- eraser: IBoolean;
1236
+ mask: IBoolean | IMaskType;
1237
+ eraser: IBoolean | IEraserType;
1208
1238
  x: INumber;
1209
1239
  y: INumber;
1210
1240
  width: INumber;
@@ -1215,16 +1245,32 @@ interface ILeafAttrData {
1215
1245
  skewX: INumber;
1216
1246
  skewY: INumber;
1217
1247
  scale: INumber | IPointData;
1218
- around: IAround;
1248
+ offsetX: INumber;
1249
+ offsetY: INumber;
1250
+ scrollX: INumber;
1251
+ scrollY: INumber;
1252
+ origin: IAlign | IUnitPointData;
1253
+ around: IAlign | IUnitPointData;
1219
1254
  lazy: IBoolean;
1220
1255
  pixelRatio: INumber;
1221
- draggable: IBoolean | 'x' | 'y';
1222
- dragBounds?: IBoundsData | 'parent';
1223
1256
  path: IPathCommandData | IPathString;
1224
1257
  windingRule: IWindingRule;
1225
1258
  closed: boolean;
1259
+ flow: IFlowType;
1260
+ padding: IFourNumber;
1261
+ gap: IGap | IPointGap;
1262
+ align: IFlowAlign | IFlowAxisAlign;
1263
+ wrap: IWrap;
1264
+ itemBox: IFlowBoxType;
1265
+ inFlow: IBoolean;
1266
+ autoWidth: IAutoSize;
1267
+ autoHeight: IAutoSize;
1268
+ autoBox: IAutoBoxData | IConstraint;
1269
+ widthRange: IRangeSize;
1270
+ heightRange: IRangeSize;
1271
+ draggable: IBoolean | IAxis;
1272
+ dragBounds?: IBoundsData | 'parent';
1226
1273
  editable: IBoolean;
1227
- editSize: IEditSize;
1228
1274
  hittable: IBoolean;
1229
1275
  hitFill: IHitType;
1230
1276
  hitStroke: IHitType;
@@ -1240,18 +1286,55 @@ interface ILeafAttrData {
1240
1286
  selectedStyle: ILeafInputData;
1241
1287
  disabledStyle: ILeafInputData;
1242
1288
  }
1289
+ type IAxis = 'x' | 'y';
1290
+ type IAxisReverse = 'x-reverse' | 'y-reverse';
1291
+ type IFlowType = boolean | IAxis | IAxisReverse;
1292
+ type IFlowBoxType = 'box' | 'stroke';
1293
+ type IGap = INumber | 'auto' | 'fit';
1294
+ interface IPointGap {
1295
+ x?: IGap;
1296
+ y?: IGap;
1297
+ }
1298
+ type IAxisAlign = 'from' | 'center' | 'to';
1299
+ interface IFlowAxisAlign {
1300
+ content?: IFlowAlign;
1301
+ rowX?: IAxisAlign;
1302
+ rowY?: IAxisAlign;
1303
+ }
1304
+ type IWrap = boolean | 'reverse';
1305
+ type IAutoSize = IBoolean | INumber | IPercentData;
1306
+ interface IRangeSize {
1307
+ min?: number;
1308
+ max?: number;
1309
+ }
1310
+ interface IUnitData {
1311
+ type: 'percent' | 'px';
1312
+ value: number;
1313
+ }
1314
+ interface IPercentData extends IUnitData {
1315
+ type: 'percent';
1316
+ }
1317
+ interface IConstraint {
1318
+ x: IConstraintType;
1319
+ y: IConstraintType;
1320
+ }
1321
+ type IConstraintType = 'from' | 'center' | 'to' | 'from-to' | 'scale';
1243
1322
  type IHitType = 'path' | 'pixel' | 'all' | 'none';
1244
1323
  type IMaskType = 'path' | 'pixel' | 'clipping';
1324
+ type IEraserType = 'path' | 'pixel';
1245
1325
  type IBlendMode = 'pass-through' | 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity' | 'source-over' | 'source-in' | 'source-out' | 'source-atop' | 'destination-over' | 'destination-in' | 'destination-out' | 'destination-atop' | 'xor';
1246
- type IEditSize = 'size' | 'scale';
1326
+ type IEditSize = 'size' | 'font-size' | 'scale';
1247
1327
  interface IImageCursor {
1248
1328
  url: string;
1249
1329
  x?: number;
1250
1330
  y?: number;
1251
1331
  rotation?: number;
1252
1332
  }
1253
- type IDirection = 'topLeft' | 'top' | 'topRight' | 'right' | 'bottomRight' | 'bottom' | 'bottomLeft' | 'left' | 'center';
1254
- type IAround = IDirection | IPointData;
1333
+ type IDirection = 'top-left' | 'top' | 'top-right' | 'right' | 'bottom-right' | 'bottom' | 'bottom-left' | 'left' | 'center';
1334
+ type IAlign = IDirection;
1335
+ type IBaseLineAlign = 'baseline-left' | 'baseline-center' | 'baseline-right';
1336
+ type IFlowAlign = IAlign | IBaseLineAlign;
1337
+ type IAround = IAlign | IUnitPointData;
1255
1338
  type ICursorType = IImageCursor | '' | 'auto' | 'default' | 'none' | 'context-menu' | 'help' | 'pointer' | 'progress' | 'wait' | 'cell' | 'crosshair' | 'text' | 'vertical-text' | 'alias' | 'copy' | 'move' | 'no-drop' | 'not-allowed' | 'grab' | 'grabbing' | 'e-resize' | 'n-resize' | 'ne-resize' | 'nw-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'w-resize' | 'ew-resize' | 'ns-resize' | 'nesw-resize' | 'nwse-resize' | 'col-resize' | 'row-resize' | 'all-scroll' | 'zoom-in' | 'zoom-out';
1256
1339
  type IStateStyleType = 'hoverStyle' | 'pressStyle' | 'focusStyle' | 'selectedStyle' | 'disabledStyle';
1257
1340
  interface ILeafInputData {
@@ -1261,14 +1344,13 @@ interface ILeafInputData {
1261
1344
  className?: IString;
1262
1345
  blendMode?: IBlendMode;
1263
1346
  opacity?: INumber;
1264
- visible?: IBoolean;
1347
+ visible?: IBoolean | 0;
1265
1348
  selected?: IBoolean;
1266
1349
  disabled?: IBoolean;
1267
1350
  locked?: IBoolean;
1268
1351
  zIndex?: INumber;
1269
- mask?: IBoolean;
1270
- maskType?: IMaskType;
1271
- eraser?: IBoolean;
1352
+ mask?: IBoolean | IMaskType;
1353
+ eraser?: IBoolean | IEraserType;
1272
1354
  x?: INumber;
1273
1355
  y?: INumber;
1274
1356
  width?: INumber;
@@ -1279,16 +1361,32 @@ interface ILeafInputData {
1279
1361
  skewX?: INumber;
1280
1362
  skewY?: INumber;
1281
1363
  scale?: INumber | IPointData;
1282
- around?: IAround;
1364
+ offsetX?: INumber;
1365
+ offsetY?: INumber;
1366
+ scrollX?: INumber;
1367
+ scrollY?: INumber;
1368
+ origin?: IAlign | IUnitPointData;
1369
+ around?: IAlign | IUnitPointData;
1283
1370
  lazy?: IBoolean;
1284
1371
  pixelRatio?: INumber;
1285
- draggable?: IBoolean | 'x' | 'y';
1286
- dragBounds?: IBoundsData | 'parent';
1287
1372
  path?: IPathCommandData | IPathString;
1288
1373
  windingRule?: IWindingRule;
1289
1374
  closed?: boolean;
1375
+ flow?: IFlowType;
1376
+ padding?: IFourNumber;
1377
+ gap?: IGap | IPointGap;
1378
+ align?: IFlowAlign | IFlowAxisAlign;
1379
+ wrap?: IWrap;
1380
+ itemBox?: IFlowBoxType;
1381
+ inFlow?: IBoolean;
1382
+ autoWidth?: IAutoSize;
1383
+ autoHeight?: IAutoSize;
1384
+ autoBox?: IAutoBoxData | IConstraint;
1385
+ widthRange?: IRangeSize;
1386
+ heightRange?: IRangeSize;
1387
+ draggable?: IBoolean | IAxis;
1388
+ dragBounds?: IBoundsData | 'parent';
1290
1389
  editable?: IBoolean;
1291
- editSize?: IEditSize;
1292
1390
  hittable?: IBoolean;
1293
1391
  hitFill?: IHitType;
1294
1392
  hitStroke?: IHitType;
@@ -1312,14 +1410,13 @@ interface ILeafComputedData {
1312
1410
  className?: string;
1313
1411
  blendMode?: IBlendMode;
1314
1412
  opacity?: number;
1315
- visible?: boolean;
1413
+ visible?: boolean | 0;
1316
1414
  selected?: boolean;
1317
1415
  disabled?: boolean;
1318
1416
  locked?: boolean;
1319
1417
  zIndex?: number;
1320
- mask?: boolean;
1321
- maskType?: IMaskType;
1322
- eraser?: boolean;
1418
+ mask?: boolean | IMaskType;
1419
+ eraser?: boolean | IEraserType;
1323
1420
  x?: number;
1324
1421
  y?: number;
1325
1422
  width?: number;
@@ -1329,16 +1426,32 @@ interface ILeafComputedData {
1329
1426
  rotation?: number;
1330
1427
  skewX?: number;
1331
1428
  skewY?: number;
1332
- around?: IAround;
1429
+ offsetX?: number;
1430
+ offsetY?: number;
1431
+ scrollX?: number;
1432
+ scrollY?: number;
1433
+ origin?: IAlign | IUnitPointData;
1434
+ around?: IAlign | IUnitPointData;
1333
1435
  lazy?: boolean;
1334
1436
  pixelRatio?: number;
1335
1437
  path?: IPathCommandData;
1336
1438
  windingRule?: IWindingRule;
1337
1439
  closed?: boolean;
1338
- draggable?: boolean | 'x' | 'y';
1440
+ flow?: IFlowType;
1441
+ padding?: IFourNumber;
1442
+ gap?: IGap | IPointGap;
1443
+ align?: IFlowAlign | IFlowAxisAlign;
1444
+ wrap?: IWrap;
1445
+ itemBox?: IFlowBoxType;
1446
+ inFlow?: boolean;
1447
+ autoWidth?: IAutoSize;
1448
+ autoHeight?: IAutoSize;
1449
+ autoBox?: IAutoBoxData | IConstraint;
1450
+ widthRange?: IRangeSize;
1451
+ heightRange?: IRangeSize;
1452
+ draggable?: boolean | IAxis;
1339
1453
  dragBounds?: IBoundsData | 'parent';
1340
1454
  editable?: boolean;
1341
- editSize?: IEditSize;
1342
1455
  hittable?: boolean;
1343
1456
  hitFill?: IHitType;
1344
1457
  hitStroke?: IHitType;
@@ -1357,6 +1470,12 @@ interface ILeafComputedData {
1357
1470
  __complex?: boolean;
1358
1471
  __naturalWidth?: number;
1359
1472
  __naturalHeight?: number;
1473
+ readonly __autoWidth?: boolean;
1474
+ readonly __autoHeight?: boolean;
1475
+ readonly __autoSide?: boolean;
1476
+ readonly __autoSize?: boolean;
1477
+ readonly __useNaturalRatio: boolean;
1478
+ readonly __isLinePath: boolean;
1360
1479
  readonly __blendMode: string;
1361
1480
  __useArrow?: boolean;
1362
1481
  __useEffect?: boolean;
@@ -1406,6 +1525,10 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1406
1525
  __hasMask?: boolean;
1407
1526
  __hasEraser?: boolean;
1408
1527
  __hitCanvas?: IHitCanvas;
1528
+ __flowBounds?: IBoundsData;
1529
+ __widthGrow?: number;
1530
+ __heightGrow?: number;
1531
+ __hasGrow?: boolean;
1409
1532
  readonly __onlyHitMask: boolean;
1410
1533
  readonly __ignoreHitWorld: boolean;
1411
1534
  readonly pathInputed: boolean;
@@ -1430,7 +1553,9 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1430
1553
  setProxyAttr(name: string, newValue: IValue): void;
1431
1554
  getProxyAttr(name: string): IValue;
1432
1555
  find(condition: number | string | IFindMethod, options?: any): ILeaf[];
1556
+ findTag(tag: string | string[]): ILeaf[];
1433
1557
  findOne(condition: number | string | IFindMethod, options?: any): ILeaf;
1558
+ findId(id: number | string): ILeaf;
1434
1559
  focus(value?: boolean): void;
1435
1560
  forceUpdate(attrName?: string): void;
1436
1561
  updateLayout(): void;
@@ -1441,10 +1566,12 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1441
1566
  __updateLocalBoxBounds(): void;
1442
1567
  __updateLocalStrokeBounds(): void;
1443
1568
  __updateLocalRenderBounds(): void;
1569
+ __updateContentBounds(): void;
1444
1570
  __updateBoxBounds(): void;
1445
1571
  __updateStrokeBounds(): void;
1446
1572
  __updateRenderBounds(): void;
1447
1573
  __updateAutoLayout(): void;
1574
+ __updateFlowLayout(): void;
1448
1575
  __updateNaturalSize(): void;
1449
1576
  __updateStrokeSpread(): number;
1450
1577
  __updateRenderSpread(): number;
@@ -1452,6 +1579,7 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1452
1579
  __updateEraser(value?: boolean): void;
1453
1580
  __updateMask(value?: boolean): void;
1454
1581
  __renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void;
1582
+ __renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void;
1455
1583
  __getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData;
1456
1584
  getWorld(attrName: ILayoutAttr): number;
1457
1585
  getTransform(relative?: ILocationType | ILeaf): IMatrixData;
@@ -1661,6 +1789,7 @@ interface IInteraction extends IControl {
1661
1789
  updateHoverData(data: IPointerEvent): void;
1662
1790
  updateCursor(hoverData?: IPointerEvent): void;
1663
1791
  setCursor(cursor: ICursorType | ICursorType[]): void;
1792
+ getLocal(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
1664
1793
  emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void;
1665
1794
  }
1666
1795
  interface IInteractionCanvas extends ILeaferCanvas {
@@ -1757,6 +1886,7 @@ interface ILeaferAttrData {
1757
1886
  lazyBounds: IBounds;
1758
1887
  config: ILeaferConfig;
1759
1888
  readonly cursorPoint: IPointData;
1889
+ readonly clientBounds: IBoundsData;
1760
1890
  leafs: number;
1761
1891
  __eventIds: IEventListenerId[];
1762
1892
  __nextRenderWait: IFunction[];
@@ -1765,7 +1895,6 @@ interface ILeaferAttrData {
1765
1895
  stop(): void;
1766
1896
  unlockLayout(): void;
1767
1897
  lockLayout(): void;
1768
- forceFullRender(): void;
1769
1898
  forceRender(bounds?: IBoundsData): void;
1770
1899
  updateCursor(cursor?: ICursorType): void;
1771
1900
  resize(size: IScreenSizeData): void;
@@ -1775,6 +1904,7 @@ interface ILeaferAttrData {
1775
1904
  zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean): IBoundsData;
1776
1905
  getValidMove(moveX: number, moveY: number): IPointData;
1777
1906
  getValidScale(changeScale: number): number;
1907
+ getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
1778
1908
  }
1779
1909
  type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData;
1780
1910
  interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
@@ -1980,4 +2110,4 @@ interface ICursorRotateMap {
1980
2110
  [name: string]: ICursorRotate;
1981
2111
  }
1982
2112
 
1983
- export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IControl, ICreator, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDragEvent, IDropEvent, IEditSize, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindMethod, IFourNumber, IFunction, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IScaleData, IScaleRotationData, IScreenSizeData, ISelector, ISelectorConfig, ISelectorProxy, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBoundsData, IUICreator, IUIEvent, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
2113
+ export type { ACommandData, ArcCommandData, ArcToCommandData, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFourNumber, IFromToData, IFunction, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMoveEvent, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IWrap, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, MCommandData, PointerType, QCommandData, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };