@leafer/interface 1.0.0-rc.9 → 1.0.1
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 +1 -1
- package/src/app/ILeafer.ts +22 -11
- package/src/canvas/ICanvas.ts +7 -2
- package/src/canvas/IHitCanvasManager.ts +3 -3
- package/src/canvas/ILeaferCanvas.ts +24 -11
- package/src/data/IData.ts +15 -1
- package/src/data/ILeafData.ts +5 -5
- package/src/display/IBranch.ts +2 -1
- package/src/display/ILeaf.ts +388 -91
- package/src/display/IView.ts +2 -3
- package/src/display/module/IBranchRender.ts +2 -2
- package/src/display/module/ILeafBounds.ts +1 -0
- package/src/display/module/ILeafDataProxy.ts +1 -1
- package/src/display/module/ILeafEventer.ts +1 -1
- package/src/display/module/ILeafHit.ts +4 -1
- package/src/display/module/ILeafRender.ts +2 -1
- package/src/event/IEventer.ts +10 -4
- package/src/event/IUIEvent.ts +10 -2
- package/src/file/IExport.ts +41 -0
- package/src/file/IFileType.ts +1 -1
- package/src/function/IFunction.ts +9 -0
- package/src/image/IImageManager.ts +2 -1
- package/src/image/ILeaferImage.ts +13 -0
- package/src/index.ts +12 -11
- package/src/interaction/ICursor.ts +16 -0
- package/src/interaction/IInteraction.ts +45 -6
- package/src/layout/ILeafLayout.ts +24 -11
- package/src/math/IMath.ts +54 -9
- package/src/path/IPathDrawer.ts +6 -3
- package/src/platform/IPlatform.ts +10 -4
- package/src/renderer/IRenderer.ts +3 -2
- package/src/selector/ISelector.ts +21 -10
- package/types/index.d.ts +703 -322
- package/src/display/module/ILeafMask.ts +0 -12
package/src/display/ILeaf.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ILeaferBase } from '../app/ILeafer'
|
|
2
|
-
import { IEventer } from '../event/IEventer'
|
|
2
|
+
import { IEventer, IEventMap } from '../event/IEventer'
|
|
3
3
|
|
|
4
4
|
import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
|
|
5
5
|
import { IRenderOptions } from '../renderer/IRenderer'
|
|
6
6
|
|
|
7
|
-
import { IObject, INumber, IBoolean, IValue, IString } from '../data/IData'
|
|
8
|
-
import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData,
|
|
7
|
+
import { IObject, INumber, IBoolean, IValue, IString, IPathString, IFourNumber } from '../data/IData'
|
|
8
|
+
import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IRadiusPointData, 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'
|
|
@@ -14,9 +14,11 @@ import { ILeafBounds } from './module/ILeafBounds'
|
|
|
14
14
|
import { ILeafLayout, IBoundsType, ILocationType } from '../layout/ILeafLayout'
|
|
15
15
|
import { ILeafHit } from './module/ILeafHit'
|
|
16
16
|
import { ILeafRender } from './module/ILeafRender'
|
|
17
|
-
import { ILeafMask } from './module/ILeafMask'
|
|
18
17
|
import { ILeafData } from '../data/ILeafData'
|
|
19
18
|
import { IFindMethod } from '../selector/ISelector'
|
|
19
|
+
import { IPathCommandData } from '../path/IPathCommand'
|
|
20
|
+
import { IWindingRule, IPath2D } from '../canvas/ICanvas'
|
|
21
|
+
import { IJSONOptions } from '../file/IExport'
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
export interface ICachedLeaf {
|
|
@@ -28,54 +30,152 @@ export interface ICachedLeaf {
|
|
|
28
30
|
|
|
29
31
|
export interface ILeafAttrData {
|
|
30
32
|
// layer data
|
|
31
|
-
id
|
|
32
|
-
name
|
|
33
|
-
className
|
|
34
|
-
|
|
35
|
-
blendMode
|
|
36
|
-
opacity
|
|
37
|
-
visible:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
locked
|
|
41
|
-
zIndex
|
|
33
|
+
id?: IString
|
|
34
|
+
name?: IString
|
|
35
|
+
className?: IString
|
|
36
|
+
|
|
37
|
+
blendMode?: IBlendMode
|
|
38
|
+
opacity?: INumber
|
|
39
|
+
visible?: IBoolean | 0 // 0 = display: none
|
|
40
|
+
selected?: IBoolean
|
|
41
|
+
disabled?: IBoolean
|
|
42
|
+
locked?: IBoolean
|
|
43
|
+
zIndex?: INumber
|
|
44
|
+
|
|
45
|
+
mask?: IBoolean | IMaskType
|
|
46
|
+
eraser?: IBoolean | IEraserType
|
|
42
47
|
|
|
43
48
|
// layout data
|
|
44
|
-
x
|
|
45
|
-
y
|
|
46
|
-
width
|
|
47
|
-
height
|
|
48
|
-
scaleX
|
|
49
|
-
scaleY
|
|
50
|
-
rotation
|
|
51
|
-
skewX
|
|
52
|
-
skewY
|
|
53
|
-
|
|
54
|
-
scale
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
49
|
+
x?: INumber
|
|
50
|
+
y?: INumber
|
|
51
|
+
width?: INumber
|
|
52
|
+
height?: INumber
|
|
53
|
+
scaleX?: INumber
|
|
54
|
+
scaleY?: INumber
|
|
55
|
+
rotation?: INumber
|
|
56
|
+
skewX?: INumber
|
|
57
|
+
skewY?: INumber
|
|
58
|
+
|
|
59
|
+
scale?: INumber | IPointData // helper
|
|
60
|
+
|
|
61
|
+
offsetX?: INumber
|
|
62
|
+
offsetY?: INumber
|
|
63
|
+
scrollX?: INumber
|
|
64
|
+
scrollY?: INumber
|
|
65
|
+
|
|
66
|
+
origin?: IAlign | IUnitPointData
|
|
67
|
+
around?: IAlign | IUnitPointData
|
|
68
|
+
|
|
69
|
+
lazy?: IBoolean
|
|
70
|
+
pixelRatio?: INumber
|
|
71
|
+
|
|
72
|
+
path?: IPathCommandData | IPathString
|
|
73
|
+
windingRule?: IWindingRule
|
|
74
|
+
closed?: IBoolean
|
|
75
|
+
|
|
76
|
+
// auto layout
|
|
77
|
+
flow?: IFlowType
|
|
78
|
+
padding?: IFourNumber
|
|
79
|
+
gap?: IGap | IPointGap
|
|
80
|
+
flowAlign?: IFlowAlign | IFlowAxisAlign
|
|
81
|
+
flowWrap?: IFlowWrap
|
|
82
|
+
itemBox?: IFlowBoxType
|
|
83
|
+
|
|
84
|
+
inFlow?: IBoolean
|
|
85
|
+
autoWidth?: IAutoSize
|
|
86
|
+
autoHeight?: IAutoSize
|
|
87
|
+
lockRatio?: IBoolean
|
|
88
|
+
autoBox?: IAutoBoxData | IConstraint
|
|
89
|
+
|
|
90
|
+
widthRange?: IRangeSize
|
|
91
|
+
heightRange?: IRangeSize
|
|
92
|
+
|
|
93
|
+
// interactive
|
|
94
|
+
draggable?: IBoolean | IAxis
|
|
95
|
+
dragBounds?: IBoundsData | 'parent'
|
|
96
|
+
|
|
97
|
+
editable?: IBoolean
|
|
98
|
+
|
|
99
|
+
hittable?: IBoolean
|
|
100
|
+
hitFill?: IHitType
|
|
101
|
+
hitStroke?: IHitType
|
|
102
|
+
hitBox?: IBoolean
|
|
103
|
+
hitChildren?: IBoolean
|
|
104
|
+
hitSelf?: IBoolean
|
|
105
|
+
hitRadius?: INumber
|
|
106
|
+
|
|
107
|
+
cursor?: ICursorType | ICursorType[]
|
|
108
|
+
|
|
109
|
+
event?: IEventMap
|
|
110
|
+
|
|
111
|
+
normalStyle?: ILeafInputData // restore hover / press / focus / selected / disabled style
|
|
112
|
+
hoverStyle?: ILeafInputData
|
|
113
|
+
pressStyle?: ILeafInputData
|
|
114
|
+
focusStyle?: ILeafInputData
|
|
115
|
+
selectedStyle?: ILeafInputData
|
|
116
|
+
disabledStyle?: ILeafInputData
|
|
117
|
+
|
|
118
|
+
// 预留给用户使用的数据对象
|
|
119
|
+
data: IObject
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
export type IAxis = 'x' | 'y'
|
|
124
|
+
|
|
125
|
+
export type IAxisReverse = 'x-reverse' | 'y-reverse'
|
|
126
|
+
|
|
127
|
+
export type IFlowType = boolean | IAxis | IAxisReverse
|
|
128
|
+
|
|
129
|
+
export type IFlowBoxType = 'box' | 'stroke'
|
|
130
|
+
|
|
131
|
+
export type IGap = INumber | 'auto' | 'fit'
|
|
132
|
+
|
|
133
|
+
export interface IPointGap { x?: IGap, y?: IGap }
|
|
134
|
+
|
|
135
|
+
export type IAxisAlign = 'from' | 'center' | 'to'
|
|
136
|
+
|
|
137
|
+
export interface IFlowAxisAlign { content?: IFlowAlign, x?: IAxisAlign, y?: IAxisAlign }
|
|
138
|
+
|
|
139
|
+
export type IFlowWrap = boolean | 'reverse'
|
|
140
|
+
|
|
141
|
+
export type IAutoSize = IBoolean | INumber | IPercentData
|
|
142
|
+
|
|
143
|
+
export interface IRangeSize {
|
|
144
|
+
min?: number
|
|
145
|
+
max?: number
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface IUnitData {
|
|
149
|
+
type: 'percent' | 'px'
|
|
150
|
+
value: number
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface IPercentData extends IUnitData {
|
|
154
|
+
type: 'percent'
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface IConstraint {
|
|
158
|
+
x: IConstraintType
|
|
159
|
+
y: IConstraintType
|
|
71
160
|
}
|
|
72
161
|
|
|
162
|
+
export type IConstraintType = 'from' | 'center' | 'to' | 'from-to' | 'scale'
|
|
163
|
+
|
|
73
164
|
export type IHitType =
|
|
74
165
|
| 'path'
|
|
75
166
|
| 'pixel'
|
|
76
167
|
| 'all'
|
|
77
168
|
| 'none'
|
|
78
169
|
|
|
170
|
+
export type IMaskType =
|
|
171
|
+
| 'path'
|
|
172
|
+
| 'pixel'
|
|
173
|
+
| 'clipping'
|
|
174
|
+
|
|
175
|
+
export type IEraserType =
|
|
176
|
+
| 'path'
|
|
177
|
+
| 'pixel'
|
|
178
|
+
|
|
79
179
|
export type IBlendMode =
|
|
80
180
|
| 'pass-through'
|
|
81
181
|
| 'normal'
|
|
@@ -104,24 +204,46 @@ export type IBlendMode =
|
|
|
104
204
|
| 'destination-atop'
|
|
105
205
|
| 'xor'
|
|
106
206
|
|
|
107
|
-
export type IEditSize = 'size' | 'scale'
|
|
207
|
+
export type IEditSize = 'size' | 'font-size' | 'scale'
|
|
108
208
|
export interface IImageCursor {
|
|
109
209
|
url: string
|
|
110
210
|
x?: number
|
|
111
211
|
y?: number
|
|
212
|
+
rotation?: number
|
|
112
213
|
}
|
|
113
214
|
|
|
114
|
-
export type
|
|
115
|
-
| '
|
|
215
|
+
export type IDirection =
|
|
216
|
+
| 'top-left'
|
|
116
217
|
| 'top'
|
|
117
|
-
| '
|
|
218
|
+
| 'top-right'
|
|
118
219
|
| 'right'
|
|
119
|
-
| '
|
|
220
|
+
| 'bottom-right'
|
|
120
221
|
| 'bottom'
|
|
121
|
-
| '
|
|
222
|
+
| 'bottom-left'
|
|
122
223
|
| 'left'
|
|
123
224
|
| 'center'
|
|
124
|
-
|
|
225
|
+
|
|
226
|
+
export type IDirection4 =
|
|
227
|
+
| 'top'
|
|
228
|
+
| 'right'
|
|
229
|
+
| 'bottom'
|
|
230
|
+
| 'left'
|
|
231
|
+
|
|
232
|
+
export type IAlign = IDirection
|
|
233
|
+
|
|
234
|
+
export type IBaseLineAlign =
|
|
235
|
+
| 'baseline-left'
|
|
236
|
+
| 'baseline-center'
|
|
237
|
+
| 'baseline-right'
|
|
238
|
+
|
|
239
|
+
export type IFlowAlign =
|
|
240
|
+
| IAlign
|
|
241
|
+
| IBaseLineAlign
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
export type IAround =
|
|
245
|
+
| IAlign
|
|
246
|
+
| IUnitPointData
|
|
125
247
|
|
|
126
248
|
export type ICursorType =
|
|
127
249
|
| IImageCursor
|
|
@@ -160,12 +282,16 @@ export type ICursorType =
|
|
|
160
282
|
| 'col-resize'
|
|
161
283
|
| 'row-resize'
|
|
162
284
|
| 'all-scroll'
|
|
163
|
-
| 'zoom
|
|
285
|
+
| 'zoom-in'
|
|
164
286
|
| 'zoom-out'
|
|
165
287
|
|
|
166
|
-
export
|
|
167
|
-
|
|
168
|
-
|
|
288
|
+
export type IStateStyleType =
|
|
289
|
+
| 'hoverStyle'
|
|
290
|
+
| 'pressStyle'
|
|
291
|
+
| 'focusStyle'
|
|
292
|
+
| 'selectedStyle'
|
|
293
|
+
| 'disabledStyle'
|
|
294
|
+
|
|
169
295
|
export interface ILeafInputData {
|
|
170
296
|
tag?: string
|
|
171
297
|
|
|
@@ -176,12 +302,15 @@ export interface ILeafInputData {
|
|
|
176
302
|
|
|
177
303
|
blendMode?: IBlendMode
|
|
178
304
|
opacity?: INumber
|
|
179
|
-
visible?: IBoolean
|
|
180
|
-
|
|
181
|
-
|
|
305
|
+
visible?: IBoolean | 0
|
|
306
|
+
selected?: IBoolean
|
|
307
|
+
disabled?: IBoolean
|
|
182
308
|
locked?: IBoolean
|
|
183
309
|
zIndex?: INumber
|
|
184
310
|
|
|
311
|
+
mask?: IBoolean | IMaskType
|
|
312
|
+
eraser?: IBoolean | IEraserType
|
|
313
|
+
|
|
185
314
|
// layout data
|
|
186
315
|
x?: INumber
|
|
187
316
|
y?: INumber
|
|
@@ -194,12 +323,44 @@ export interface ILeafInputData {
|
|
|
194
323
|
skewY?: INumber
|
|
195
324
|
|
|
196
325
|
scale?: INumber | IPointData // helper
|
|
197
|
-
around?: IAround
|
|
198
326
|
|
|
199
|
-
|
|
327
|
+
offsetX?: INumber
|
|
328
|
+
offsetY?: INumber
|
|
329
|
+
scrollX?: INumber
|
|
330
|
+
scrollY?: INumber
|
|
331
|
+
|
|
332
|
+
origin?: IAlign | IUnitPointData
|
|
333
|
+
around?: IAlign | IUnitPointData
|
|
334
|
+
|
|
335
|
+
lazy?: IBoolean
|
|
336
|
+
pixelRatio?: INumber
|
|
337
|
+
|
|
338
|
+
path?: IPathCommandData | IPathString
|
|
339
|
+
windingRule?: IWindingRule
|
|
340
|
+
closed?: IBoolean
|
|
341
|
+
|
|
342
|
+
// auto layout
|
|
343
|
+
flow?: IFlowType
|
|
344
|
+
padding?: IFourNumber
|
|
345
|
+
gap?: IGap | IPointGap
|
|
346
|
+
flowAlign?: IFlowAlign | IFlowAxisAlign
|
|
347
|
+
flowWrap?: IFlowWrap
|
|
348
|
+
itemBox?: IFlowBoxType
|
|
349
|
+
|
|
350
|
+
inFlow?: IBoolean
|
|
351
|
+
autoWidth?: IAutoSize
|
|
352
|
+
autoHeight?: IAutoSize
|
|
353
|
+
lockRatio?: IBoolean
|
|
354
|
+
autoBox?: IAutoBoxData | IConstraint
|
|
355
|
+
|
|
356
|
+
widthRange?: IRangeSize
|
|
357
|
+
heightRange?: IRangeSize
|
|
358
|
+
|
|
359
|
+
// interactive
|
|
360
|
+
draggable?: IBoolean | IAxis
|
|
361
|
+
dragBounds?: IBoundsData | 'parent'
|
|
200
362
|
|
|
201
363
|
editable?: IBoolean
|
|
202
|
-
editSize?: IEditSize
|
|
203
364
|
|
|
204
365
|
hittable?: IBoolean
|
|
205
366
|
hitFill?: IHitType
|
|
@@ -211,6 +372,18 @@ export interface ILeafInputData {
|
|
|
211
372
|
|
|
212
373
|
cursor?: ICursorType | ICursorType[]
|
|
213
374
|
|
|
375
|
+
event?: IEventMap
|
|
376
|
+
|
|
377
|
+
normalStyle?: ILeafInputData
|
|
378
|
+
hoverStyle?: ILeafInputData
|
|
379
|
+
pressStyle?: ILeafInputData
|
|
380
|
+
focusStyle?: ILeafInputData
|
|
381
|
+
selectedStyle?: ILeafInputData
|
|
382
|
+
disabledStyle?: ILeafInputData
|
|
383
|
+
|
|
384
|
+
// 预留给用户使用的数据对象
|
|
385
|
+
data?: IObject
|
|
386
|
+
|
|
214
387
|
children?: ILeafInputData[]
|
|
215
388
|
|
|
216
389
|
// other
|
|
@@ -224,12 +397,15 @@ export interface ILeafComputedData {
|
|
|
224
397
|
|
|
225
398
|
blendMode?: IBlendMode
|
|
226
399
|
opacity?: number
|
|
227
|
-
visible?: boolean
|
|
228
|
-
|
|
229
|
-
|
|
400
|
+
visible?: boolean | 0
|
|
401
|
+
selected?: boolean
|
|
402
|
+
disabled?: boolean
|
|
230
403
|
locked?: boolean
|
|
231
404
|
zIndex?: number
|
|
232
405
|
|
|
406
|
+
mask?: boolean | IMaskType
|
|
407
|
+
eraser?: boolean | IEraserType
|
|
408
|
+
|
|
233
409
|
// layout data
|
|
234
410
|
x?: number
|
|
235
411
|
y?: number
|
|
@@ -241,12 +417,43 @@ export interface ILeafComputedData {
|
|
|
241
417
|
skewX?: number
|
|
242
418
|
skewY?: number
|
|
243
419
|
|
|
244
|
-
|
|
420
|
+
offsetX?: number
|
|
421
|
+
offsetY?: number
|
|
422
|
+
scrollX?: number
|
|
423
|
+
scrollY?: number
|
|
424
|
+
|
|
425
|
+
origin?: IAlign | IUnitPointData
|
|
426
|
+
around?: IAlign | IUnitPointData
|
|
245
427
|
|
|
246
|
-
|
|
428
|
+
lazy?: boolean
|
|
429
|
+
pixelRatio?: number
|
|
430
|
+
|
|
431
|
+
path?: IPathCommandData
|
|
432
|
+
windingRule?: IWindingRule
|
|
433
|
+
closed?: boolean
|
|
434
|
+
|
|
435
|
+
// auto layout
|
|
436
|
+
flow?: IFlowType
|
|
437
|
+
padding?: IFourNumber
|
|
438
|
+
gap?: IGap | IPointGap
|
|
439
|
+
flowAlign?: IFlowAlign | IFlowAxisAlign
|
|
440
|
+
flowWrap?: IFlowWrap
|
|
441
|
+
itemBox?: IFlowBoxType
|
|
442
|
+
|
|
443
|
+
inFlow?: boolean
|
|
444
|
+
autoWidth?: IAutoSize
|
|
445
|
+
autoHeight?: IAutoSize
|
|
446
|
+
lockRatio?: boolean
|
|
447
|
+
autoBox?: IAutoBoxData | IConstraint
|
|
448
|
+
|
|
449
|
+
widthRange?: IRangeSize
|
|
450
|
+
heightRange?: IRangeSize
|
|
451
|
+
|
|
452
|
+
// interactive
|
|
453
|
+
draggable?: boolean | IAxis
|
|
454
|
+
dragBounds?: IBoundsData | 'parent'
|
|
247
455
|
|
|
248
456
|
editable?: boolean
|
|
249
|
-
editSize?: IEditSize
|
|
250
457
|
|
|
251
458
|
hittable?: boolean
|
|
252
459
|
hitFill?: IHitType
|
|
@@ -258,14 +465,42 @@ export interface ILeafComputedData {
|
|
|
258
465
|
|
|
259
466
|
cursor?: ICursorType | ICursorType[]
|
|
260
467
|
|
|
468
|
+
normalStyle?: ILeafInputData
|
|
469
|
+
hoverStyle?: ILeafInputData
|
|
470
|
+
pressStyle?: ILeafInputData
|
|
471
|
+
focusStyle?: ILeafInputData
|
|
472
|
+
selectedStyle?: ILeafInputData
|
|
473
|
+
disabledStyle?: ILeafInputData
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
// 预留给用户使用的数据对象
|
|
477
|
+
data?: IObject
|
|
478
|
+
|
|
261
479
|
// other
|
|
262
480
|
__childBranchNumber?: number // 存在子分支的个数
|
|
263
481
|
__complex?: boolean // 外观是否复杂
|
|
482
|
+
|
|
264
483
|
__naturalWidth?: number
|
|
265
484
|
__naturalHeight?: number
|
|
485
|
+
|
|
486
|
+
readonly __autoWidth?: boolean
|
|
487
|
+
readonly __autoHeight?: boolean
|
|
488
|
+
readonly __autoSide?: boolean
|
|
489
|
+
readonly __autoSize?: boolean
|
|
490
|
+
|
|
491
|
+
readonly __useNaturalRatio: boolean // 宽高存在一个值时,另一个自动值是否采用natural尺寸比例
|
|
492
|
+
readonly __isLinePath: boolean
|
|
493
|
+
readonly __blendMode: string
|
|
494
|
+
|
|
495
|
+
__useArrow?: boolean
|
|
496
|
+
__useEffect?: boolean
|
|
497
|
+
|
|
498
|
+
__pathInputed?: number // 是否为输入path, 0:否,1:是,2:永远是(不自动检测)
|
|
499
|
+
__pathForRender?: IPathCommandData
|
|
500
|
+
__path2DForRender?: IPath2D
|
|
266
501
|
}
|
|
267
502
|
|
|
268
|
-
export interface ILeaf extends
|
|
503
|
+
export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
269
504
|
tag: string
|
|
270
505
|
readonly __tag: string
|
|
271
506
|
readonly innerName: string
|
|
@@ -276,31 +511,39 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
276
511
|
readonly app?: ILeaferBase
|
|
277
512
|
leafer?: ILeaferBase
|
|
278
513
|
parent?: ILeaf
|
|
514
|
+
zoomLayer?: ILeaf
|
|
279
515
|
|
|
280
516
|
readonly isApp?: boolean
|
|
281
|
-
isLeafer?: boolean
|
|
282
|
-
isBranch?: boolean
|
|
283
|
-
isBranchLeaf?: boolean
|
|
517
|
+
readonly isLeafer?: boolean
|
|
518
|
+
readonly isBranch?: boolean
|
|
519
|
+
readonly isBranchLeaf?: boolean
|
|
520
|
+
readonly isOutside?: boolean // scrollBar ...
|
|
284
521
|
|
|
285
522
|
__: ILeafData
|
|
286
523
|
|
|
287
524
|
proxyData?: ILeafInputData
|
|
288
525
|
__proxyData?: ILeafInputData
|
|
289
526
|
|
|
527
|
+
syncEventer?: ILeaf // 同步触发一样事件的元素
|
|
528
|
+
|
|
290
529
|
__layout: ILeafLayout
|
|
291
530
|
|
|
292
|
-
__world:
|
|
531
|
+
__world: IMatrixWithBoundsScaleData
|
|
293
532
|
__local?: IMatrixWithBoundsData
|
|
294
533
|
|
|
534
|
+
__nowWorld?: IMatrixWithBoundsScaleData // use __world or __cameraWorld render
|
|
535
|
+
__cameraWorld?: IMatrixWithBoundsScaleData // use camera matrix render
|
|
536
|
+
|
|
295
537
|
readonly __localMatrix: IMatrixData
|
|
296
|
-
readonly
|
|
538
|
+
readonly __localBoxBounds: IBoundsData
|
|
297
539
|
|
|
298
540
|
__worldOpacity: number
|
|
299
541
|
|
|
300
|
-
readonly worldTransform:
|
|
301
|
-
readonly localTransform:
|
|
542
|
+
readonly worldTransform: IMatrixWithScaleData
|
|
543
|
+
readonly localTransform: IMatrixData
|
|
302
544
|
|
|
303
545
|
readonly boxBounds: IBoundsData
|
|
546
|
+
readonly renderBounds: IBoundsData
|
|
304
547
|
readonly worldBoxBounds: IBoundsData
|
|
305
548
|
readonly worldStrokeBounds: IBoundsData
|
|
306
549
|
readonly worldRenderBounds: IBoundsData
|
|
@@ -317,8 +560,16 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
317
560
|
__hasEraser?: boolean
|
|
318
561
|
__hitCanvas?: IHitCanvas
|
|
319
562
|
|
|
563
|
+
__flowBounds?: IBoundsData // localBoxBounds or localStrokeBounds
|
|
564
|
+
__widthGrow?: number
|
|
565
|
+
__heightGrow?: number
|
|
566
|
+
__hasGrow?: boolean
|
|
567
|
+
|
|
320
568
|
readonly __onlyHitMask: boolean
|
|
321
569
|
readonly __ignoreHitWorld: boolean
|
|
570
|
+
readonly __inLazyBounds: boolean
|
|
571
|
+
|
|
572
|
+
readonly pathInputed: boolean
|
|
322
573
|
|
|
323
574
|
__parentWait?: IFunction[]
|
|
324
575
|
__leaferWait?: IFunction[]
|
|
@@ -328,30 +579,42 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
328
579
|
reset(data?: ILeafInputData): void
|
|
329
580
|
resetCustom(): void
|
|
330
581
|
|
|
331
|
-
waitParent(item: IFunction): void
|
|
332
|
-
waitLeafer(item: IFunction): void
|
|
333
|
-
nextRender(item: IFunction): void
|
|
582
|
+
waitParent(item: IFunction, bind?: IObject): void
|
|
583
|
+
waitLeafer(item: IFunction, bind?: IObject): void
|
|
584
|
+
nextRender(item: IFunction, bind?: IObject, off?: 'off'): void
|
|
585
|
+
removeNextRender(item: IFunction): void
|
|
334
586
|
|
|
335
587
|
__bindLeafer(leafer: ILeaferBase | null): void
|
|
336
588
|
|
|
337
589
|
set(data: IObject): void
|
|
338
|
-
get(): ILeafInputData
|
|
339
|
-
|
|
340
|
-
|
|
590
|
+
get(name?: string | string[] | IObject): ILeafInputData | IValue
|
|
591
|
+
setAttr(name: string, value: any): void
|
|
592
|
+
getAttr(name: string): any
|
|
593
|
+
getComputedAttr(name: string): any
|
|
594
|
+
|
|
595
|
+
toJSON(options?: IJSONOptions): IObject
|
|
596
|
+
toString(options?: IJSONOptions): string
|
|
597
|
+
toSVG(): string
|
|
598
|
+
__SVG(data: IObject): void
|
|
599
|
+
toHTML(): string
|
|
341
600
|
|
|
342
601
|
// ILeafData ->
|
|
343
|
-
__setAttr(attrName: string, newValue: IValue):
|
|
602
|
+
__setAttr(attrName: string, newValue: IValue, checkFiniteNumber?: boolean): boolean
|
|
344
603
|
__getAttr(attrName: string): IValue
|
|
345
604
|
setProxyAttr(name: string, newValue: IValue): void
|
|
346
605
|
getProxyAttr(name: string): IValue
|
|
347
606
|
|
|
348
607
|
// find
|
|
349
608
|
find(condition: number | string | IFindMethod, options?: any): ILeaf[]
|
|
350
|
-
|
|
609
|
+
findTag(tag: string | string[]): ILeaf[]
|
|
610
|
+
findOne(condition: number | string | IFindMethod, options?: any): ILeaf | undefined
|
|
611
|
+
findId(id: number | string): ILeaf | undefined
|
|
351
612
|
|
|
352
|
-
|
|
613
|
+
focus(value?: boolean): void
|
|
353
614
|
|
|
354
615
|
updateLayout(): void
|
|
616
|
+
forceUpdate(attrName?: string): void
|
|
617
|
+
forceRender(_bounds?: IBoundsData): void
|
|
355
618
|
|
|
356
619
|
// ILeafMatrix ->
|
|
357
620
|
__updateWorldMatrix(): void
|
|
@@ -365,11 +628,13 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
365
628
|
__updateLocalStrokeBounds(): void
|
|
366
629
|
__updateLocalRenderBounds(): void
|
|
367
630
|
|
|
631
|
+
__updateContentBounds(): void
|
|
368
632
|
__updateBoxBounds(): void
|
|
369
633
|
__updateStrokeBounds(): void
|
|
370
634
|
__updateRenderBounds(): void
|
|
371
635
|
|
|
372
636
|
__updateAutoLayout(): void
|
|
637
|
+
__updateFlowLayout(): void
|
|
373
638
|
__updateNaturalSize(): void
|
|
374
639
|
|
|
375
640
|
__updateStrokeSpread(): number
|
|
@@ -380,13 +645,19 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
380
645
|
// IBranchMask ->
|
|
381
646
|
__updateEraser(value?: boolean): void
|
|
382
647
|
__updateMask(value?: boolean): void
|
|
383
|
-
__renderMask(canvas: ILeaferCanvas,
|
|
384
|
-
|
|
648
|
+
__renderMask(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
649
|
+
__renderEraser(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
385
650
|
|
|
386
651
|
// convert
|
|
387
|
-
|
|
652
|
+
__getNowWorld(options: IRenderOptions): IMatrixWithBoundsScaleData // when render use other matrix
|
|
653
|
+
|
|
654
|
+
getTransform(relative?: ILocationType | ILeaf): IMatrixData
|
|
655
|
+
|
|
388
656
|
getBounds(type?: IBoundsType, relative?: ILocationType | ILeaf): IBoundsData
|
|
389
657
|
getLayoutBounds(type?: IBoundsType, relative?: ILocationType | ILeaf, unscale?: boolean): ILayoutBoundsData
|
|
658
|
+
getLayoutPoints(type?: IBoundsType, relative?: ILocationType | ILeaf): IPointData[]
|
|
659
|
+
|
|
660
|
+
getWorldBounds(inner: IBoundsData, relative?: ILeaf, change?: boolean): IBoundsData
|
|
390
661
|
|
|
391
662
|
worldToLocal(world: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
392
663
|
localToWorld(local: IPointData, to?: IPointData, distance?: boolean, relative?: ILeaf): void
|
|
@@ -399,22 +670,39 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
399
670
|
getLocalPointByInner(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
400
671
|
getWorldPoint(inner: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
401
672
|
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
673
|
+
getPagePoint(world: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
674
|
+
getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData
|
|
675
|
+
|
|
402
676
|
|
|
403
677
|
// transform
|
|
404
678
|
setTransform(transform?: IMatrixData, resize?: boolean): void
|
|
405
679
|
transform(transform?: IMatrixData, resize?: boolean): void
|
|
406
680
|
|
|
407
|
-
move(x: number, y?: number): void
|
|
408
|
-
scaleOf(origin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
|
|
409
|
-
rotateOf(origin: IPointData, rotation: number): void
|
|
410
|
-
skewOf(origin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
|
|
681
|
+
move(x: number | IPointData, y?: number): void
|
|
682
|
+
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void
|
|
683
|
+
rotateOf(origin: IPointData | IAlign, rotation: number): void
|
|
684
|
+
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void
|
|
685
|
+
|
|
686
|
+
transformWorld(worldTransform?: IMatrixData, resize?: boolean): void
|
|
687
|
+
moveWorld(x: number | IPointData, y?: number): void
|
|
688
|
+
scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void
|
|
689
|
+
rotateOfWorld(worldOrigin: IPointData, rotation: number): void
|
|
690
|
+
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void
|
|
691
|
+
|
|
692
|
+
flip(axis: IAxis): void
|
|
411
693
|
|
|
412
694
|
scaleResize(scaleX: number, scaleY: number, noResize?: boolean): void
|
|
413
695
|
__scaleResize(scaleX: number, scaleY: number): void
|
|
414
696
|
|
|
697
|
+
resizeWidth(width: number): void
|
|
698
|
+
resizeHeight(height: number): void
|
|
699
|
+
|
|
415
700
|
// ILeafHit ->
|
|
416
701
|
__hitWorld(point: IRadiusPointData): boolean
|
|
417
702
|
__hit(local: IRadiusPointData): boolean
|
|
703
|
+
__hitFill(inner: IRadiusPointData): boolean
|
|
704
|
+
__hitStroke(inner: IRadiusPointData, strokeWidth: number): boolean
|
|
705
|
+
__hitPixel(inner: IRadiusPointData): boolean
|
|
418
706
|
__drawHitPath(canvas: ILeaferCanvas): void
|
|
419
707
|
__updateHitCanvas(): void
|
|
420
708
|
|
|
@@ -423,7 +711,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
423
711
|
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
424
712
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
425
713
|
|
|
426
|
-
|
|
714
|
+
__clip(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
715
|
+
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void
|
|
427
716
|
|
|
428
717
|
__updateWorldOpacity(): void
|
|
429
718
|
__updateChange(): void
|
|
@@ -434,6 +723,8 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
434
723
|
__updatePath(): void
|
|
435
724
|
__updateRenderPath(): void
|
|
436
725
|
|
|
726
|
+
//
|
|
727
|
+
|
|
437
728
|
// branch
|
|
438
729
|
children?: ILeaf[]
|
|
439
730
|
|
|
@@ -441,4 +732,10 @@ export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, IL
|
|
|
441
732
|
add(child: ILeaf, index?: number): void
|
|
442
733
|
remove(child?: ILeaf, destroy?: boolean): void
|
|
443
734
|
dropTo(parent: ILeaf, index?: number, resize?: boolean): void
|
|
444
|
-
}
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export type ILeafAttrDescriptor = IObject & ThisType<ILeaf>
|
|
738
|
+
|
|
739
|
+
export interface ILeafAttrDescriptorFn {
|
|
740
|
+
(key: string): ILeafAttrDescriptor
|
|
741
|
+
}
|