@leafer-ui/display 1.0.0-rc.16 → 1.0.0-rc.18
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 +8 -8
- package/src/Canvas.ts +1 -1
- package/src/Group.ts +1 -1
- package/src/Leafer.ts +20 -13
- package/src/Pen.ts +1 -1
- package/src/UI.ts +49 -7
- package/types/index.d.ts +384 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/display",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.18",
|
|
4
4
|
"description": "@leafer-ui/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.0.0-rc.
|
|
26
|
-
"@leafer-ui/data": "1.0.0-rc.
|
|
27
|
-
"@leafer-ui/display-module": "1.0.0-rc.
|
|
28
|
-
"@leafer-ui/decorator": "1.0.0-rc.
|
|
29
|
-
"@leafer-ui/external": "1.0.0-rc.
|
|
25
|
+
"@leafer/core": "1.0.0-rc.18",
|
|
26
|
+
"@leafer-ui/data": "1.0.0-rc.18",
|
|
27
|
+
"@leafer-ui/display-module": "1.0.0-rc.18",
|
|
28
|
+
"@leafer-ui/decorator": "1.0.0-rc.18",
|
|
29
|
+
"@leafer-ui/external": "1.0.0-rc.18"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@leafer/interface": "1.0.0-rc.
|
|
33
|
-
"@leafer-ui/interface": "1.0.0-rc.
|
|
32
|
+
"@leafer/interface": "1.0.0-rc.18",
|
|
33
|
+
"@leafer-ui/interface": "1.0.0-rc.18"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Canvas.ts
CHANGED
|
@@ -3,9 +3,9 @@ import { Creator, Matrix, Platform, dataProcessor, registerUI, hitType } from '@
|
|
|
3
3
|
|
|
4
4
|
import { ICanvas, ICanvasData, ICanvasInputData, IUI } from '@leafer-ui/interface'
|
|
5
5
|
import { CanvasData } from '@leafer-ui/data'
|
|
6
|
+
import { resizeType } from '@leafer-ui/decorator'
|
|
6
7
|
|
|
7
8
|
import { Rect } from './Rect'
|
|
8
|
-
import { resizeType } from '@leafer-ui/decorator'
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
@registerUI()
|
package/src/Group.ts
CHANGED
|
@@ -51,7 +51,7 @@ export class Group extends UI implements IGroup {
|
|
|
51
51
|
|
|
52
52
|
let child: IUI
|
|
53
53
|
children.forEach(childData => {
|
|
54
|
-
child = UICreator.get(childData.tag, childData) as IUI
|
|
54
|
+
child = (childData as IUI).__ ? childData as IUI : UICreator.get(childData.tag, childData) as IUI
|
|
55
55
|
this.add(child)
|
|
56
56
|
})
|
|
57
57
|
|
package/src/Leafer.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ILeaferCanvas, IRenderer, ILayouter, ISelector, IWatcher, IInteraction, ILeaferConfig, ICanvasManager, IHitCanvasManager, IAutoBounds, IScreenSizeData, IResizeEvent,
|
|
1
|
+
import { ILeaferCanvas, IRenderer, ILayouter, ISelector, IWatcher, IInteraction, ILeaferConfig, ICanvasManager, IHitCanvasManager, IAutoBounds, IScreenSizeData, IResizeEvent, IEventListenerId, ITimer, IValue, IObject, IControl, IPointData, ILeaferType, ICursorType, IBoundsData, INumber, IZoomType, IFourNumber } from '@leafer/interface'
|
|
2
2
|
import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds } from '@leafer/core'
|
|
3
3
|
|
|
4
|
-
import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer,
|
|
4
|
+
import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer, IApp, IEditorBase } from '@leafer-ui/interface'
|
|
5
5
|
import { LeaferData } from '@leafer-ui/data'
|
|
6
6
|
import { Group } from './Group'
|
|
7
7
|
|
|
@@ -54,8 +54,6 @@ export class Leafer extends Group implements ILeafer {
|
|
|
54
54
|
// plugin
|
|
55
55
|
public editor: IEditorBase
|
|
56
56
|
|
|
57
|
-
public zoomLayer: IGroup = this
|
|
58
|
-
|
|
59
57
|
public userConfig: ILeaferConfig
|
|
60
58
|
public config: ILeaferConfig = {
|
|
61
59
|
type: 'design',
|
|
@@ -69,7 +67,6 @@ export class Leafer extends Group implements ILeafer {
|
|
|
69
67
|
move: {
|
|
70
68
|
holdSpaceKey: true,
|
|
71
69
|
holdMiddleKey: true,
|
|
72
|
-
dragOut: true,
|
|
73
70
|
autoDistance: 2
|
|
74
71
|
}
|
|
75
72
|
}
|
|
@@ -236,10 +233,6 @@ export class Leafer extends Group implements ILeafer {
|
|
|
236
233
|
this.__level = 1
|
|
237
234
|
}
|
|
238
235
|
|
|
239
|
-
public setZoomLayer(zoomLayer: ILeaf): void {
|
|
240
|
-
this.zoomLayer = zoomLayer as IGroup
|
|
241
|
-
}
|
|
242
|
-
|
|
243
236
|
protected __checkAutoLayout(config: ILeaferConfig): void {
|
|
244
237
|
if (!config.width || !config.height) {
|
|
245
238
|
this.autoLayout = new AutoBounds(config)
|
|
@@ -327,15 +320,18 @@ export class Leafer extends Group implements ILeafer {
|
|
|
327
320
|
}
|
|
328
321
|
}
|
|
329
322
|
|
|
330
|
-
public waitReady(item: IFunction): void {
|
|
323
|
+
public waitReady(item: IFunction, bind?: IObject): void {
|
|
324
|
+
if (bind) item = item.bind(bind)
|
|
331
325
|
this.ready ? item() : this.__readyWait.push(item)
|
|
332
326
|
}
|
|
333
327
|
|
|
334
|
-
public waitViewReady(item: IFunction): void {
|
|
328
|
+
public waitViewReady(item: IFunction, bind?: IObject): void {
|
|
329
|
+
if (bind) item = item.bind(bind)
|
|
335
330
|
this.viewReady ? item() : this.__viewReadyWait.push(item)
|
|
336
331
|
}
|
|
337
332
|
|
|
338
|
-
public waitViewCompleted(item: IFunction): void {
|
|
333
|
+
public waitViewCompleted(item: IFunction, bind?: IObject): void {
|
|
334
|
+
if (bind) item = item.bind(bind)
|
|
339
335
|
this.__viewCompletedWait.push(item)
|
|
340
336
|
if (this.viewCompleted) {
|
|
341
337
|
this.__checkViewCompleted(false)
|
|
@@ -344,7 +340,8 @@ export class Leafer extends Group implements ILeafer {
|
|
|
344
340
|
}
|
|
345
341
|
}
|
|
346
342
|
|
|
347
|
-
public nextRender(item: IFunction, off?: 'off'): void {
|
|
343
|
+
public nextRender(item: IFunction, bind?: IObject, off?: 'off'): void {
|
|
344
|
+
if (bind) item = item.bind(bind)
|
|
348
345
|
const list = this.__nextRenderWait
|
|
349
346
|
if (off) {
|
|
350
347
|
for (let i = 0; i < list.length; i++) {
|
|
@@ -355,6 +352,16 @@ export class Leafer extends Group implements ILeafer {
|
|
|
355
352
|
}
|
|
356
353
|
}
|
|
357
354
|
|
|
355
|
+
// need view plugin
|
|
356
|
+
public zoom(_zoomType: IZoomType, _padding?: IFourNumber, _fixedScale?: boolean): IBoundsData { return undefined }
|
|
357
|
+
|
|
358
|
+
public validScale(changeScale: number): number {
|
|
359
|
+
const { scaleX } = this.zoomLayer.__, { min, max } = this.app.config.zoom, absScale = Math.abs(scaleX * changeScale)
|
|
360
|
+
if (absScale < min) changeScale = min / scaleX
|
|
361
|
+
else if (absScale > max) changeScale = max / scaleX
|
|
362
|
+
return changeScale
|
|
363
|
+
}
|
|
364
|
+
|
|
358
365
|
protected __checkUpdateLayout(): void {
|
|
359
366
|
this.__layout.update()
|
|
360
367
|
}
|
package/src/Pen.ts
CHANGED
|
@@ -20,7 +20,7 @@ export class Pen extends Group implements IPen {
|
|
|
20
20
|
public pathStyle: IPathInputData
|
|
21
21
|
|
|
22
22
|
@penPathType()
|
|
23
|
-
public path: IPathCommandData // use __path, readonly
|
|
23
|
+
declare public path: IPathCommandData // use __path, readonly
|
|
24
24
|
|
|
25
25
|
public __path: IPathCommandData
|
|
26
26
|
|
package/src/UI.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IAround, IValue, IWindingRule } from '@leafer/interface'
|
|
2
|
-
import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType,
|
|
1
|
+
import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IAround, IValue, IWindingRule, IPathCreator } from '@leafer/interface'
|
|
2
|
+
import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType } from '@leafer/core'
|
|
3
3
|
|
|
4
4
|
import { IUI, IShadowEffect, IBlurEffect, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IExportOptions, IExportResult, IFill, IStroke, IArrowType, IFindUIMethod, IEditSize, ILeafer } from '@leafer-ui/interface'
|
|
5
|
-
import { arrowType, effectType } from '@leafer-ui/decorator'
|
|
5
|
+
import { arrowType, effectType, stateType, zoomLayerType } from '@leafer-ui/decorator'
|
|
6
6
|
|
|
7
7
|
import { UIData } from '@leafer-ui/data'
|
|
8
8
|
import { UIBounds, UIRender } from '@leafer-ui/display-module'
|
|
@@ -10,6 +10,8 @@ import { UIBounds, UIRender } from '@leafer-ui/display-module'
|
|
|
10
10
|
import { Export, PathArrow } from '@leafer-ui/external'
|
|
11
11
|
|
|
12
12
|
|
|
13
|
+
|
|
14
|
+
|
|
13
15
|
@useModule(UIBounds)
|
|
14
16
|
@useModule(UIRender)
|
|
15
17
|
@rewriteAble()
|
|
@@ -26,6 +28,9 @@ export class UI extends Leaf implements IUI {
|
|
|
26
28
|
declare public leafer?: ILeafer
|
|
27
29
|
declare public parent?: IGroup
|
|
28
30
|
|
|
31
|
+
@zoomLayerType()
|
|
32
|
+
public zoomLayer: IGroup
|
|
33
|
+
|
|
29
34
|
public get isFrame(): boolean { return false }
|
|
30
35
|
|
|
31
36
|
declare public children?: IUI[]
|
|
@@ -53,9 +58,17 @@ export class UI extends Leaf implements IUI {
|
|
|
53
58
|
@opacityType(true)
|
|
54
59
|
public visible: IBoolean
|
|
55
60
|
|
|
61
|
+
|
|
62
|
+
@stateType(false)
|
|
63
|
+
public selected: IBoolean
|
|
64
|
+
|
|
65
|
+
@stateType(false)
|
|
66
|
+
public disabled: IBoolean
|
|
67
|
+
|
|
56
68
|
@dataType(false)
|
|
57
69
|
public locked: IBoolean
|
|
58
70
|
|
|
71
|
+
|
|
59
72
|
@sortType(0)
|
|
60
73
|
public zIndex: INumber
|
|
61
74
|
|
|
@@ -231,6 +244,27 @@ export class UI extends Leaf implements IUI {
|
|
|
231
244
|
public grayscale: INumber | IGrayscaleEffect
|
|
232
245
|
|
|
233
246
|
|
|
247
|
+
// states
|
|
248
|
+
|
|
249
|
+
@dataType()
|
|
250
|
+
public normalStyle: IUIInputData // auto restore hover / press / focus / selected / disabled style
|
|
251
|
+
|
|
252
|
+
@dataType()
|
|
253
|
+
public hoverStyle: IUIInputData
|
|
254
|
+
|
|
255
|
+
@dataType()
|
|
256
|
+
public pressStyle: IUIInputData
|
|
257
|
+
|
|
258
|
+
@dataType()
|
|
259
|
+
public focusStyle: IUIInputData
|
|
260
|
+
|
|
261
|
+
@dataType()
|
|
262
|
+
public selectedStyle: IUIInputData
|
|
263
|
+
|
|
264
|
+
@dataType()
|
|
265
|
+
public disabledStyle: IUIInputData
|
|
266
|
+
|
|
267
|
+
|
|
234
268
|
public set scale(value: INumber | IPointData) {
|
|
235
269
|
if (typeof value === 'number') {
|
|
236
270
|
this.scaleX = this.scaleY = value
|
|
@@ -246,6 +280,12 @@ export class UI extends Leaf implements IUI {
|
|
|
246
280
|
}
|
|
247
281
|
|
|
248
282
|
|
|
283
|
+
public get pen(): IPathCreator {
|
|
284
|
+
pen.set(this.path = this.__.path || [])
|
|
285
|
+
return pen
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
|
|
249
289
|
constructor(data?: IUIInputData) {
|
|
250
290
|
super(data)
|
|
251
291
|
}
|
|
@@ -261,8 +301,8 @@ export class UI extends Leaf implements IUI {
|
|
|
261
301
|
Object.assign(this, data)
|
|
262
302
|
}
|
|
263
303
|
|
|
264
|
-
public get(name?: string): IUIInputData | IValue {
|
|
265
|
-
return name ? this.__.__getInput(name) : this.__.__getInputData()
|
|
304
|
+
public get(name?: string | string[] | IUIInputData): IUIInputData | IValue {
|
|
305
|
+
return typeof name === 'string' ? this.__.__getInput(name) : this.__.__getInputData(name)
|
|
266
306
|
}
|
|
267
307
|
|
|
268
308
|
public createProxyData(): IUIInputData { return undefined }
|
|
@@ -281,9 +321,11 @@ export class UI extends Leaf implements IUI {
|
|
|
281
321
|
this.__layout.update()
|
|
282
322
|
let path = pathForRender ? this.__.__pathForRender : this.__.path
|
|
283
323
|
if (!path) {
|
|
284
|
-
path = []
|
|
285
324
|
const { width, height } = this.boxBounds
|
|
286
|
-
if (width || height)
|
|
325
|
+
if (width || height) {
|
|
326
|
+
pen.set(path = [])
|
|
327
|
+
this.__drawPathByBox(pen)
|
|
328
|
+
}
|
|
287
329
|
}
|
|
288
330
|
return curve ? PathConvert.toCanvasData(path, true) : path
|
|
289
331
|
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
import { IString, INumber, IBoolean, IMaskType, IAround, IHitType, ICursorType, IPathCommandData, IPathString, IWindingRule, IPointData, IPathCreator, IValue, ILeaferCanvas, IPathDrawer, IExportFileType, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IBoundsData, IResizeEvent, IObject, IZoomType, IFourNumber, IRenderOptions, ILeaferImage, ICanvasContext2D } from '@leafer/interface';
|
|
2
|
+
import { Leaf } from '@leafer/core';
|
|
3
|
+
import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IEditSize, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IFindUIMethod, IExportOptions, IExportResult, IGroupData, IGroupInputData, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBox, IBoxData, IOverflow, IBoxInputData, IFrame, IFrameData, IFrameInputData, IRect, IRectData, IRectInputData, IEllipse, IEllipseData, IEllipseInputData, IPolygon, IPolygonData, IPolygonInputData, IStar, IStarData, IStarInputData, ILine, ILineData, ILineInputData, IImage, IImageData, IImageInputData, ICanvas, ICanvasData, ICanvasInputData, IText, ITextData, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IUnitData, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
|
|
4
|
+
|
|
5
|
+
declare class UI extends Leaf implements IUI {
|
|
6
|
+
__: IUIData;
|
|
7
|
+
proxyData: IUIInputData;
|
|
8
|
+
__proxyData?: IUIInputData;
|
|
9
|
+
get app(): ILeafer;
|
|
10
|
+
leafer?: ILeafer;
|
|
11
|
+
parent?: IGroup;
|
|
12
|
+
zoomLayer: IGroup;
|
|
13
|
+
get isFrame(): boolean;
|
|
14
|
+
children?: IUI[];
|
|
15
|
+
id: IString;
|
|
16
|
+
name: IString;
|
|
17
|
+
className: IString;
|
|
18
|
+
blendMode: IBlendMode;
|
|
19
|
+
opacity: INumber;
|
|
20
|
+
visible: IBoolean;
|
|
21
|
+
selected: IBoolean;
|
|
22
|
+
disabled: IBoolean;
|
|
23
|
+
locked: IBoolean;
|
|
24
|
+
zIndex: INumber;
|
|
25
|
+
mask: IBoolean;
|
|
26
|
+
maskType: IMaskType;
|
|
27
|
+
eraser: IBoolean;
|
|
28
|
+
x: INumber;
|
|
29
|
+
y: INumber;
|
|
30
|
+
width: INumber;
|
|
31
|
+
height: INumber;
|
|
32
|
+
scaleX: INumber;
|
|
33
|
+
scaleY: INumber;
|
|
34
|
+
rotation: INumber;
|
|
35
|
+
skewX: INumber;
|
|
36
|
+
skewY: INumber;
|
|
37
|
+
around: IAround;
|
|
38
|
+
draggable: IBoolean;
|
|
39
|
+
editable: IBoolean;
|
|
40
|
+
editSize?: IEditSize;
|
|
41
|
+
hittable: IBoolean;
|
|
42
|
+
hitFill: IHitType;
|
|
43
|
+
hitStroke: IHitType;
|
|
44
|
+
hitBox: IBoolean;
|
|
45
|
+
hitChildren: IBoolean;
|
|
46
|
+
hitSelf: IBoolean;
|
|
47
|
+
hitRadius: INumber;
|
|
48
|
+
cursor: ICursorType | ICursorType[];
|
|
49
|
+
fill: IFill;
|
|
50
|
+
stroke: IStroke;
|
|
51
|
+
strokeAlign: IStrokeAlign;
|
|
52
|
+
strokeWidth: INumber | INumber[] | IStrokeWidthString;
|
|
53
|
+
strokeWidthFixed: IBoolean;
|
|
54
|
+
strokeCap: IStrokeCap;
|
|
55
|
+
strokeJoin: IStrokeJoin;
|
|
56
|
+
dashPattern: INumber[] | IDashPatternString;
|
|
57
|
+
dashOffset: INumber;
|
|
58
|
+
miterLimit: INumber;
|
|
59
|
+
lazy: IBoolean;
|
|
60
|
+
pixelRatio: INumber;
|
|
61
|
+
path: IPathCommandData | IPathString;
|
|
62
|
+
windingRule: IWindingRule;
|
|
63
|
+
startArrow: IArrowType;
|
|
64
|
+
endArrow: IArrowType;
|
|
65
|
+
cornerRadius: number | number[] | ICornerRadiusString;
|
|
66
|
+
cornerSmoothing: INumber;
|
|
67
|
+
shadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
68
|
+
innerShadow: IShadowEffect | IShadowEffect[] | IShadowString;
|
|
69
|
+
blur: INumber | IBlurEffect;
|
|
70
|
+
backgroundBlur: INumber | IBlurEffect;
|
|
71
|
+
grayscale: INumber | IGrayscaleEffect;
|
|
72
|
+
normalStyle: IUIInputData;
|
|
73
|
+
hoverStyle: IUIInputData;
|
|
74
|
+
pressStyle: IUIInputData;
|
|
75
|
+
focusStyle: IUIInputData;
|
|
76
|
+
selectedStyle: IUIInputData;
|
|
77
|
+
disabledStyle: IUIInputData;
|
|
78
|
+
set scale(value: INumber | IPointData);
|
|
79
|
+
get scale(): INumber | IPointData;
|
|
80
|
+
get pen(): IPathCreator;
|
|
81
|
+
constructor(data?: IUIInputData);
|
|
82
|
+
reset(_data?: IUIInputData): void;
|
|
83
|
+
set(data: IUIInputData): void;
|
|
84
|
+
get(name?: string | string[] | IUIInputData): IUIInputData | IValue;
|
|
85
|
+
createProxyData(): IUIInputData;
|
|
86
|
+
find(_condition: number | string | IFindUIMethod, _options?: any): IUI[];
|
|
87
|
+
findOne(_condition: number | string | IFindUIMethod, _options?: any): IUI;
|
|
88
|
+
getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
|
|
89
|
+
getPathString(curve?: boolean, pathForRender?: boolean): IPathString;
|
|
90
|
+
__onUpdateSize(): void;
|
|
91
|
+
__updateRenderPath(): void;
|
|
92
|
+
__drawRenderPath(canvas: ILeaferCanvas): void;
|
|
93
|
+
__drawPath(canvas: ILeaferCanvas): void;
|
|
94
|
+
__drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
|
|
95
|
+
__drawPathByBox(drawer: IPathDrawer): void;
|
|
96
|
+
export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult>;
|
|
97
|
+
clone(): IUI;
|
|
98
|
+
static one(data: IUIInputData, x?: number, y?: number, width?: number, height?: number): IUI;
|
|
99
|
+
static registerUI(): void;
|
|
100
|
+
static registerData(data: IUIData): void;
|
|
101
|
+
destroy(): void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
declare class Group extends UI implements IGroup {
|
|
105
|
+
get __tag(): string;
|
|
106
|
+
get isBranch(): boolean;
|
|
107
|
+
__: IGroupData;
|
|
108
|
+
children: IUI[];
|
|
109
|
+
constructor(data?: IGroupInputData);
|
|
110
|
+
reset(data?: IGroupInputData): void;
|
|
111
|
+
__setBranch(): void;
|
|
112
|
+
set(data: IUIInputData): void;
|
|
113
|
+
toJSON(): IUIInputData;
|
|
114
|
+
pick(_hitPoint: IPointData, _options?: IPickOptions): IPickResult;
|
|
115
|
+
addAt(child: IUI, index: number): void;
|
|
116
|
+
addAfter(child: IUI, after: IUI): void;
|
|
117
|
+
addBefore(child: UI, before: IUI): void;
|
|
118
|
+
add(_child: IUI, _index?: number): void;
|
|
119
|
+
addMany(..._children: IUI[]): void;
|
|
120
|
+
remove(_child?: IUI, _destroy?: boolean): void;
|
|
121
|
+
removeAll(_destroy?: boolean): void;
|
|
122
|
+
clear(): void;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
declare class Leafer extends Group implements ILeafer {
|
|
126
|
+
get __tag(): string;
|
|
127
|
+
__: ILeaferData;
|
|
128
|
+
pixelRatio: INumber;
|
|
129
|
+
get isApp(): boolean;
|
|
130
|
+
get app(): ILeafer;
|
|
131
|
+
get isLeafer(): boolean;
|
|
132
|
+
parent?: IApp;
|
|
133
|
+
running: boolean;
|
|
134
|
+
created: boolean;
|
|
135
|
+
ready: boolean;
|
|
136
|
+
viewReady: boolean;
|
|
137
|
+
viewCompleted: boolean;
|
|
138
|
+
get imageReady(): boolean;
|
|
139
|
+
get layoutLocked(): boolean;
|
|
140
|
+
transforming: boolean;
|
|
141
|
+
view: unknown;
|
|
142
|
+
canvas: ILeaferCanvas;
|
|
143
|
+
renderer: IRenderer;
|
|
144
|
+
watcher: IWatcher;
|
|
145
|
+
layouter: ILayouter;
|
|
146
|
+
selector?: ISelector;
|
|
147
|
+
interaction?: IInteraction;
|
|
148
|
+
canvasManager: ICanvasManager;
|
|
149
|
+
hitCanvasManager?: IHitCanvasManager;
|
|
150
|
+
editor: IEditorBase;
|
|
151
|
+
userConfig: ILeaferConfig;
|
|
152
|
+
config: ILeaferConfig;
|
|
153
|
+
autoLayout?: IAutoBounds;
|
|
154
|
+
get cursorPoint(): IPointData;
|
|
155
|
+
leafs: number;
|
|
156
|
+
__eventIds: IEventListenerId[];
|
|
157
|
+
protected __startTimer: ITimer;
|
|
158
|
+
protected __controllers: IControl[];
|
|
159
|
+
protected __readyWait: IFunction[];
|
|
160
|
+
protected __viewReadyWait: IFunction[];
|
|
161
|
+
protected __viewCompletedWait: IFunction[];
|
|
162
|
+
__nextRenderWait: IFunction[];
|
|
163
|
+
constructor(userConfig?: ILeaferConfig, data?: ILeaferInputData);
|
|
164
|
+
init(userConfig?: ILeaferConfig, parentApp?: IApp): void;
|
|
165
|
+
onInit(): void;
|
|
166
|
+
initType(_type: ILeaferType): void;
|
|
167
|
+
set(data: IUIInputData): void;
|
|
168
|
+
start(): void;
|
|
169
|
+
stop(): void;
|
|
170
|
+
unlockLayout(): void;
|
|
171
|
+
lockLayout(): void;
|
|
172
|
+
resize(size: IScreenSizeData): void;
|
|
173
|
+
forceFullRender(): void;
|
|
174
|
+
forceRender(bounds?: IBoundsData): void;
|
|
175
|
+
updateCursor(cursor?: ICursorType): void;
|
|
176
|
+
protected __doResize(size: IScreenSizeData): void;
|
|
177
|
+
protected __onResize(event: IResizeEvent): void;
|
|
178
|
+
protected __setApp(): void;
|
|
179
|
+
protected __bindApp(app: IApp): void;
|
|
180
|
+
__setLeafer(leafer: ILeafer): void;
|
|
181
|
+
protected __checkAutoLayout(config: ILeaferConfig): void;
|
|
182
|
+
__setAttr(attrName: string, newValue: IValue): void;
|
|
183
|
+
__getAttr(attrName: string): IValue;
|
|
184
|
+
protected __changeCanvasSize(attrName: string, newValue: number): void;
|
|
185
|
+
protected __changeFill(newValue: string): void;
|
|
186
|
+
protected __onCreated(): void;
|
|
187
|
+
protected __onReady(): void;
|
|
188
|
+
protected __onViewReady(): void;
|
|
189
|
+
protected __onNextRender(): void;
|
|
190
|
+
protected __checkViewCompleted(emit?: boolean): void;
|
|
191
|
+
protected __onWatchData(): void;
|
|
192
|
+
waitReady(item: IFunction, bind?: IObject): void;
|
|
193
|
+
waitViewReady(item: IFunction, bind?: IObject): void;
|
|
194
|
+
waitViewCompleted(item: IFunction, bind?: IObject): void;
|
|
195
|
+
nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
|
|
196
|
+
zoom(_zoomType: IZoomType, _padding?: IFourNumber, _fixedScale?: boolean): IBoundsData;
|
|
197
|
+
validScale(changeScale: number): number;
|
|
198
|
+
protected __checkUpdateLayout(): void;
|
|
199
|
+
protected emitLeafer(type: string): void;
|
|
200
|
+
protected __listenEvents(): void;
|
|
201
|
+
protected __removeListenEvents(): void;
|
|
202
|
+
destroy(): void;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
declare class Box extends Group implements IBox {
|
|
206
|
+
get __tag(): string;
|
|
207
|
+
get isBranchLeaf(): boolean;
|
|
208
|
+
__: IBoxData;
|
|
209
|
+
overflow: IOverflow;
|
|
210
|
+
constructor(data?: IBoxInputData);
|
|
211
|
+
__updateStrokeSpread(): number;
|
|
212
|
+
__updateRectRenderSpread(): number;
|
|
213
|
+
__updateRenderSpread(): number;
|
|
214
|
+
__updateRectBoxBounds(): void;
|
|
215
|
+
__updateBoxBounds(): void;
|
|
216
|
+
__updateStrokeBounds(): void;
|
|
217
|
+
__updateRenderBounds(): void;
|
|
218
|
+
__updateRectRenderBounds(): void;
|
|
219
|
+
__updateRectChange(): void;
|
|
220
|
+
__updateChange(): void;
|
|
221
|
+
__renderRect(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
222
|
+
__renderGroup(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
223
|
+
__render(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
224
|
+
__drawAfterFill(canvas: ILeaferCanvas, options: IRenderOptions): void;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare class Frame extends Box implements IFrame {
|
|
228
|
+
get __tag(): string;
|
|
229
|
+
get isFrame(): boolean;
|
|
230
|
+
__: IFrameData;
|
|
231
|
+
fill: IFill;
|
|
232
|
+
overflow: IOverflow;
|
|
233
|
+
constructor(data?: IFrameInputData);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
declare class Rect extends UI implements IRect {
|
|
237
|
+
get __tag(): string;
|
|
238
|
+
__: IRectData;
|
|
239
|
+
constructor(data?: IRectInputData);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
declare class Ellipse extends UI implements IEllipse {
|
|
243
|
+
get __tag(): string;
|
|
244
|
+
__: IEllipseData;
|
|
245
|
+
innerRadius: INumber;
|
|
246
|
+
startAngle: INumber;
|
|
247
|
+
endAngle: INumber;
|
|
248
|
+
constructor(data?: IEllipseInputData);
|
|
249
|
+
__updatePath(): void;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
declare class Polygon extends UI implements IPolygon {
|
|
253
|
+
get __tag(): string;
|
|
254
|
+
__: IPolygonData;
|
|
255
|
+
sides: INumber;
|
|
256
|
+
points: number[];
|
|
257
|
+
curve: boolean | number;
|
|
258
|
+
constructor(data?: IPolygonInputData);
|
|
259
|
+
__updatePath(): void;
|
|
260
|
+
__updateRenderPath(): void;
|
|
261
|
+
__updateBoxBounds(): void;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
declare class Star extends UI implements IStar {
|
|
265
|
+
get __tag(): string;
|
|
266
|
+
__: IStarData;
|
|
267
|
+
corners: INumber;
|
|
268
|
+
innerRadius: INumber;
|
|
269
|
+
constructor(data?: IStarInputData);
|
|
270
|
+
__updatePath(): void;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
declare class Line extends UI implements ILine {
|
|
274
|
+
get __tag(): string;
|
|
275
|
+
__: ILineData;
|
|
276
|
+
strokeAlign: IStrokeAlign;
|
|
277
|
+
height: INumber;
|
|
278
|
+
points: number[];
|
|
279
|
+
curve: boolean | number;
|
|
280
|
+
get toPoint(): IPointData;
|
|
281
|
+
set toPoint(value: IPointData);
|
|
282
|
+
constructor(data?: ILineInputData);
|
|
283
|
+
__updatePath(): void;
|
|
284
|
+
__updateRenderPath(): void;
|
|
285
|
+
__updateBoxBounds(): void;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare class Image extends Rect implements IImage {
|
|
289
|
+
get __tag(): string;
|
|
290
|
+
__: IImageData;
|
|
291
|
+
url: IString;
|
|
292
|
+
get ready(): boolean;
|
|
293
|
+
image: ILeaferImage;
|
|
294
|
+
constructor(data?: IImageInputData);
|
|
295
|
+
destroy(): void;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
declare class Canvas extends Rect implements ICanvas {
|
|
299
|
+
get __tag(): string;
|
|
300
|
+
__: ICanvasData;
|
|
301
|
+
width: INumber;
|
|
302
|
+
height: INumber;
|
|
303
|
+
pixelRatio: INumber;
|
|
304
|
+
smooth: boolean;
|
|
305
|
+
hitFill: IHitType;
|
|
306
|
+
canvas: ILeaferCanvas;
|
|
307
|
+
context: ICanvasContext2D;
|
|
308
|
+
constructor(data?: ICanvasInputData);
|
|
309
|
+
draw(ui: IUI, offset?: IPointData, scale?: number | IPointData, rotation?: number): void;
|
|
310
|
+
paint(): void;
|
|
311
|
+
__drawAfterFill(canvas: ILeaferCanvas, _options: IRenderOptions): void;
|
|
312
|
+
__updateSize(): void;
|
|
313
|
+
destroy(): void;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
declare class Text extends UI implements IText {
|
|
317
|
+
get __tag(): string;
|
|
318
|
+
__: ITextData;
|
|
319
|
+
width: INumber;
|
|
320
|
+
height: INumber;
|
|
321
|
+
padding: number | number[];
|
|
322
|
+
fill: IFill;
|
|
323
|
+
strokeAlign: IStrokeAlign;
|
|
324
|
+
hitFill: IHitType$1;
|
|
325
|
+
text: IString;
|
|
326
|
+
fontFamily: IString;
|
|
327
|
+
fontSize: INumber;
|
|
328
|
+
fontWeight: IFontWeight;
|
|
329
|
+
italic: IBoolean;
|
|
330
|
+
textCase: ITextCase;
|
|
331
|
+
textDecoration: ITextDecoration;
|
|
332
|
+
letterSpacing: INumber | IUnitData;
|
|
333
|
+
lineHeight: INumber | IUnitData;
|
|
334
|
+
paraIndent: INumber;
|
|
335
|
+
paraSpacing: INumber;
|
|
336
|
+
textAlign: ITextAlign;
|
|
337
|
+
verticalAlign: IVerticalAlign;
|
|
338
|
+
textWrap: ITextWrap;
|
|
339
|
+
textOverflow: IOverflow | string;
|
|
340
|
+
get textDrawData(): ITextDrawData;
|
|
341
|
+
constructor(data?: ITextInputData);
|
|
342
|
+
__drawHitPath(canvas: ILeaferCanvas): void;
|
|
343
|
+
__drawPathByData(drawer: IPathDrawer, _data?: IPathCommandData): void;
|
|
344
|
+
__drawRenderPath(canvas: ILeaferCanvas): void;
|
|
345
|
+
__updateTextDrawData(): void;
|
|
346
|
+
__updateBoxBounds(): void;
|
|
347
|
+
__updateRenderSpread(): number;
|
|
348
|
+
__updateRenderBounds(): void;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
declare class Path extends UI implements IPath {
|
|
352
|
+
get __tag(): string;
|
|
353
|
+
__: IPathData;
|
|
354
|
+
strokeAlign: IStrokeAlign;
|
|
355
|
+
constructor(data?: IPathInputData);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
declare class Pen extends Group implements IPen {
|
|
359
|
+
get __tag(): string;
|
|
360
|
+
__: IPenData;
|
|
361
|
+
pathElement: IPath;
|
|
362
|
+
pathStyle: IPathInputData;
|
|
363
|
+
path: IPathCommandData$1;
|
|
364
|
+
__path: IPathCommandData$1;
|
|
365
|
+
constructor(data?: IPenInputData);
|
|
366
|
+
setStyle(data: IPathInputData): Pen;
|
|
367
|
+
beginPath(): Pen;
|
|
368
|
+
moveTo(_x: number, _y: number): Pen;
|
|
369
|
+
lineTo(_x: number, _y: number): Pen;
|
|
370
|
+
bezierCurveTo(_x1: number, _y1: number, _x2: number, _y2: number, _x: number, _y: number): Pen;
|
|
371
|
+
quadraticCurveTo(_x1: number, _y1: number, _x: number, _y: number): Pen;
|
|
372
|
+
closePath(): Pen;
|
|
373
|
+
rect(_x: number, _y: number, _width: number, _height: number): Pen;
|
|
374
|
+
roundRect(_x: number, _y: number, _width: number, _height: number, _cornerRadius: number | number[]): Pen;
|
|
375
|
+
ellipse(_x: number, _y: number, _radiusX: number, _radiusY: number, _rotation?: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
|
|
376
|
+
arc(_x: number, _y: number, _radius: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
|
|
377
|
+
arcTo(_x1: number, _y1: number, _x2: number, _y2: number, _radius: number): Pen;
|
|
378
|
+
drawEllipse(_x: number, _y: number, _radiusX: number, _radiusY: number, _rotation?: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
|
|
379
|
+
drawArc(_x: number, _y: number, _radius: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
|
|
380
|
+
drawPoints(_points: number[], _curve?: boolean | number, _close?: boolean): Pen;
|
|
381
|
+
paint(): void;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export { Box, Canvas, Ellipse, Frame, Group, Image, Leafer, Line, Path, Pen, Polygon, Rect, Star, Text, UI };
|