@leafer-ui/display 1.0.0-rc.19 → 1.0.0-rc.20

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-ui/display",
3
- "version": "1.0.0-rc.19",
3
+ "version": "1.0.0-rc.20",
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.19",
26
- "@leafer-ui/data": "1.0.0-rc.19",
27
- "@leafer-ui/display-module": "1.0.0-rc.19",
28
- "@leafer-ui/decorator": "1.0.0-rc.19",
29
- "@leafer-ui/external": "1.0.0-rc.19"
25
+ "@leafer/core": "1.0.0-rc.20",
26
+ "@leafer-ui/data": "1.0.0-rc.20",
27
+ "@leafer-ui/display-module": "1.0.0-rc.20",
28
+ "@leafer-ui/decorator": "1.0.0-rc.20",
29
+ "@leafer-ui/external": "1.0.0-rc.20"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.0.0-rc.19",
33
- "@leafer-ui/interface": "1.0.0-rc.19"
32
+ "@leafer/interface": "1.0.0-rc.20",
33
+ "@leafer-ui/interface": "1.0.0-rc.20"
34
34
  }
35
35
  }
package/src/Box.ts CHANGED
@@ -38,10 +38,9 @@ export class Box extends Group implements IBox {
38
38
  public __updateRectRenderSpread(): number { return 0 }
39
39
 
40
40
  public __updateRenderSpread(): number {
41
- let width = this.__updateRectRenderSpread() || super.__updateRenderSpread()
42
- this.__.__drawAfterFill = this.__.overflow === 'hide'
43
- if (!width) width = this.__.__drawAfterFill ? 0 : 1
44
- return width
41
+ const width = this.__updateRectRenderSpread()
42
+ const hide = this.__.__drawAfterFill = this.__.overflow === 'hide'
43
+ return (width || hide) ? width : -1
45
44
  }
46
45
 
47
46
 
package/src/Canvas.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, IScreenSizeData, ISizeData, IHitType } from '@leafer/interface'
1
+ import { ILeaferCanvas, ILeaferCanvasConfig, INumber, IRenderOptions, IPointData, ICanvasContext2D, ICanvasContext2DSettings, IScreenSizeData, ISizeData, IHitType } from '@leafer/interface'
2
2
  import { Creator, Matrix, Platform, dataProcessor, registerUI, hitType } from '@leafer/core'
3
3
 
4
4
  import { ICanvas, ICanvasData, ICanvasInputData, IUI } from '@leafer-ui/interface'
@@ -28,6 +28,9 @@ export class Canvas extends Rect implements ICanvas {
28
28
  @resizeType(true)
29
29
  public smooth: boolean
30
30
 
31
+ @resizeType()
32
+ public contextSettings: ICanvasContext2DSettings
33
+
31
34
  @hitType('all')
32
35
  declare public hitFill: IHitType
33
36
 
package/src/Group.ts CHANGED
@@ -9,7 +9,7 @@ import { UI } from './UI'
9
9
 
10
10
  @useModule(Branch)
11
11
  @registerUI()
12
- export class Group extends UI implements IGroup {
12
+ export class Group extends UI implements IGroup { // tip: rewrited Box
13
13
 
14
14
  public get __tag() { return 'Group' }
15
15
 
package/src/Leafer.ts CHANGED
@@ -1,5 +1,5 @@
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
- import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds } from '@leafer/core'
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, IBounds } from '@leafer/interface'
2
+ import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds, LeafList } from '@leafer/core'
3
3
 
4
4
  import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer, IApp, IEditorBase } from '@leafer-ui/interface'
5
5
  import { LeaferData } from '@leafer-ui/data'
@@ -11,6 +11,12 @@ const debug = Debug.get('Leafer')
11
11
  @registerUI()
12
12
  export class Leafer extends Group implements ILeafer {
13
13
 
14
+
15
+ static get version() { return '1.0.0-rc.20' }
16
+
17
+ static list = new LeafList() // 所有leafer实例
18
+
19
+
14
20
  public get __tag() { return 'Leafer' }
15
21
 
16
22
  @dataProcessor(LeaferData)
@@ -60,6 +66,7 @@ export class Leafer extends Group implements ILeafer {
60
66
  start: true,
61
67
  hittable: true,
62
68
  smooth: true,
69
+ lazySpeard: 100,
63
70
  zoom: {
64
71
  min: 0.01,
65
72
  max: 256
@@ -72,7 +79,9 @@ export class Leafer extends Group implements ILeafer {
72
79
  }
73
80
 
74
81
  public autoLayout?: IAutoBounds
82
+ public lazyBounds: IBounds
75
83
 
84
+ public get FPS(): number { return this.renderer ? this.renderer.FPS : 60 }
76
85
  public get cursorPoint(): IPointData { return (this.interaction && this.interaction.hoverData) || { x: this.width / 2, y: this.height / 2 } }
77
86
  public leafs = 0
78
87
 
@@ -80,6 +89,7 @@ export class Leafer extends Group implements ILeafer {
80
89
  protected __startTimer: ITimer
81
90
  protected __controllers: IControl[] = []
82
91
 
92
+ protected __initWait: IFunction[] // assign in waitInit()
83
93
  protected __readyWait: IFunction[] = []
84
94
  protected __viewReadyWait: IFunction[] = []
85
95
  protected __viewCompletedWait: IFunction[] = []
@@ -89,6 +99,7 @@ export class Leafer extends Group implements ILeafer {
89
99
  super(data)
90
100
  this.userConfig = userConfig
91
101
  if (userConfig && (userConfig.view || userConfig.width)) this.init(userConfig)
102
+ Leafer.list.add(this)
92
103
  }
93
104
 
94
105
  public init(userConfig?: ILeaferConfig, parentApp?: IApp): void {
@@ -103,16 +114,17 @@ export class Leafer extends Group implements ILeafer {
103
114
  this.initType(config.type) // LeaferType
104
115
 
105
116
  // render / layout
106
- this.canvas = Creator.canvas(config)
117
+ const canvas = this.canvas = Creator.canvas(config)
107
118
  this.__controllers.push(
108
- this.renderer = Creator.renderer(this, this.canvas, config),
119
+ this.renderer = Creator.renderer(this, canvas, config),
109
120
  this.watcher = Creator.watcher(this, config),
110
121
  this.layouter = Creator.layouter(this, config)
111
122
  )
112
123
 
113
124
  if (this.isApp) this.__setApp()
114
125
  this.__checkAutoLayout(config)
115
- this.view = this.canvas.view
126
+ this.updateLazyBounds()
127
+ this.view = canvas.view
116
128
 
117
129
  // interaction / manager
118
130
  if (parentApp) {
@@ -120,7 +132,7 @@ export class Leafer extends Group implements ILeafer {
120
132
  start = parentApp.running
121
133
  } else {
122
134
  this.selector = Creator.selector(this)
123
- this.interaction = Creator.interaction(this, this.canvas, this.selector, config)
135
+ this.interaction = Creator.interaction(this, canvas, this.selector, config)
124
136
 
125
137
  if (this.interaction) {
126
138
  this.__controllers.unshift(this.interaction)
@@ -134,12 +146,14 @@ export class Leafer extends Group implements ILeafer {
134
146
 
135
147
  this.hittable = config.hittable
136
148
  this.fill = config.fill
137
- this.canvasManager.add(this.canvas)
149
+ this.canvasManager.add(canvas)
150
+
138
151
 
139
152
  this.__listenEvents()
140
153
 
141
154
  if (start) this.__startTimer = setTimeout(this.start.bind(this))
142
155
 
156
+ WaitHelper.run(this.__initWait)
143
157
  this.onInit() // can rewrite init event
144
158
  }
145
159
 
@@ -148,13 +162,7 @@ export class Leafer extends Group implements ILeafer {
148
162
  public initType(_type: ILeaferType): void { } // rewrite in @leafer-ui/type
149
163
 
150
164
  public set(data: IUIInputData): void {
151
- if (!this.children) {
152
- setTimeout(() => {
153
- super.set(data)
154
- })
155
- } else {
156
- super.set(data)
157
- }
165
+ this.waitInit(() => { super.set(data) })
158
166
  }
159
167
 
160
168
  public start(): void {
@@ -205,10 +213,16 @@ export class Leafer extends Group implements ILeafer {
205
213
  if (i) cursor ? i.setCursor(cursor) : i.updateCursor()
206
214
  }
207
215
 
216
+ public updateLazyBounds(): void {
217
+ this.lazyBounds = this.canvas.bounds.clone().spread(this.config.lazySpeard)
218
+ }
219
+
208
220
  protected __doResize(size: IScreenSizeData): void {
209
- if (!this.canvas || this.canvas.isSameSize(size)) return
221
+ const { canvas } = this
222
+ if (!canvas || canvas.isSameSize(size)) return
210
223
  const old = DataHelper.copyAttrs({}, this.canvas, canvasSizeAttrs) as IScreenSizeData
211
- this.canvas.resize(size)
224
+ canvas.resize(size)
225
+ this.updateLazyBounds()
212
226
  this.__onResize(new ResizeEvent(size, old))
213
227
  }
214
228
 
@@ -240,7 +254,7 @@ export class Leafer extends Group implements ILeafer {
240
254
  }
241
255
  }
242
256
 
243
- public __setAttr(attrName: string, newValue: IValue): void {
257
+ public __setAttr(attrName: string, newValue: IValue): boolean {
244
258
  if (this.canvas) {
245
259
  if (canvasSizeAttrs.includes(attrName)) {
246
260
  this.__changeCanvasSize(attrName, newValue as number)
@@ -250,7 +264,7 @@ export class Leafer extends Group implements ILeafer {
250
264
  this.canvas.hittable = newValue as boolean
251
265
  }
252
266
  }
253
- super.__setAttr(attrName, newValue)
267
+ return super.__setAttr(attrName, newValue)
254
268
  }
255
269
 
256
270
  public __getAttr(attrName: string): IValue {
@@ -320,6 +334,12 @@ export class Leafer extends Group implements ILeafer {
320
334
  }
321
335
  }
322
336
 
337
+ public waitInit(item: IFunction, bind?: IObject): void {
338
+ if (bind) item = item.bind(bind)
339
+ if (!this.__initWait) this.__initWait = [] // set() use
340
+ this.canvas ? item() : this.__initWait.push(item)
341
+ }
342
+
323
343
  public waitReady(item: IFunction, bind?: IObject): void {
324
344
  if (bind) item = item.bind(bind)
325
345
  this.ready ? item() : this.__readyWait.push(item)
@@ -355,12 +375,9 @@ export class Leafer extends Group implements ILeafer {
355
375
  // need view plugin
356
376
  public zoom(_zoomType: IZoomType, _padding?: IFourNumber, _fixedScale?: boolean): IBoundsData { return undefined }
357
377
 
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
- }
378
+ // interaction window rewrite
379
+ public getValidMove(moveX: number, moveY: number): IPointData { return { x: moveX, y: moveY } }
380
+ public getValidScale(changeScale: number): number { return changeScale }
364
381
 
365
382
  protected __checkUpdateLayout(): void {
366
383
  this.__layout.update()
@@ -388,9 +405,10 @@ export class Leafer extends Group implements ILeafer {
388
405
  this.__eventIds.length = 0
389
406
  }
390
407
 
391
- public destroy(): void {
392
- setTimeout(() => {
408
+ public destroy(sync?: boolean): void {
409
+ const doDestory = () => {
393
410
  if (!this.destroyed) {
411
+ Leafer.list.remove(this)
394
412
  try {
395
413
  this.stop()
396
414
  this.emitEvent(new LeaferEvent(LeaferEvent.END, this))
@@ -419,7 +437,7 @@ export class Leafer extends Group implements ILeafer {
419
437
  debug.error(e)
420
438
  }
421
439
  }
422
- })
423
-
440
+ }
441
+ sync ? doDestory() : setTimeout(doDestory)
424
442
  }
425
443
  }
package/src/Line.ts CHANGED
@@ -14,7 +14,7 @@ const { toBounds } = PathBounds
14
14
 
15
15
 
16
16
  @registerUI()
17
- export class Line extends UI implements ILine {
17
+ export class Line extends UI implements ILine { // tip: rewrited Polygon
18
18
 
19
19
  public get __tag() { return 'Line' }
20
20
 
@@ -33,6 +33,9 @@ export class Line extends UI implements ILine {
33
33
  @pathType(0)
34
34
  public curve: boolean | number
35
35
 
36
+ @pathType(false)
37
+ declare public closed: boolean
38
+
36
39
  public get toPoint(): IPointData {
37
40
  const { width, rotation } = this.__
38
41
  const to: IPointData = getPointData()
@@ -60,7 +63,7 @@ export class Line extends UI implements ILine {
60
63
 
61
64
  if (this.__.points) {
62
65
 
63
- drawPoints(path, this.__.points, false)
66
+ drawPoints(path, this.__.points, this.__.closed)
64
67
 
65
68
  } else {
66
69
 
@@ -73,7 +76,7 @@ export class Line extends UI implements ILine {
73
76
  public __updateRenderPath(): void {
74
77
  const data = this.__
75
78
  if (!this.pathInputed && data.points && data.curve) {
76
- drawPoints(data.__pathForRender = [], data.points, data.curve, this.pathClosed)
79
+ drawPoints(data.__pathForRender = [], data.points, data.curve, data.closed)
77
80
  if (data.__useArrow) PathArrow.addArrows(this, false)
78
81
  } else {
79
82
  super.__updateRenderPath()
package/src/Pen.ts CHANGED
@@ -7,7 +7,7 @@ import { Group } from './Group'
7
7
  import { Path } from './Path'
8
8
 
9
9
 
10
- @useModule(PathCreator, ['beginPath', 'path'])
10
+ @useModule(PathCreator, ['set', 'beginPath', 'path'])
11
11
  @registerUI()
12
12
  export class Pen extends Group implements IPen {
13
13
 
@@ -76,11 +76,13 @@ export class Pen extends Group implements IPen {
76
76
 
77
77
  public drawPoints(_points: number[], _curve?: boolean | number, _close?: boolean): Pen { return this }
78
78
 
79
+ public clearPath(): Pen { return this }
79
80
 
80
81
  public paint(): void {
81
82
  this.pathElement.forceUpdate('path')
82
83
  }
83
84
 
85
+
84
86
  }
85
87
 
86
88
  function penPathType() {
package/src/Polygon.ts CHANGED
@@ -32,7 +32,6 @@ export class Polygon extends UI implements IPolygon {
32
32
 
33
33
  constructor(data?: IPolygonInputData) {
34
34
  super(data)
35
- this.pathClosed = true
36
35
  }
37
36
 
38
37
  public __updatePath(): void {
package/src/Rect.ts CHANGED
@@ -10,7 +10,7 @@ import { UI } from './UI'
10
10
  @useModule(RectRender)
11
11
  @rewriteAble()
12
12
  @registerUI()
13
- export class Rect extends UI implements IRect {
13
+ export class Rect extends UI implements IRect { // tip: rewrited Box
14
14
 
15
15
  public get __tag() { return 'Rect' }
16
16
 
package/src/Text.ts CHANGED
@@ -166,6 +166,8 @@ export class Text extends UI implements IText {
166
166
  super.__updateBoxBounds()
167
167
  }
168
168
 
169
+ if (italic) b.width += fontSize * 0.16
170
+
169
171
  const contentBounds = includes(b, bounds) ? b : bounds
170
172
  if (contentBounds !== layout.contentBounds) {
171
173
  layout.contentBounds = contentBounds
package/src/UI.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IAround, IValue, IWindingRule, IPathCreator } from '@leafer/interface'
2
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
- 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'
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, IEditorConfig } from '@leafer-ui/interface'
5
5
  import { arrowType, effectType, stateType, zoomLayerType } from '@leafer-ui/decorator'
6
6
 
7
7
  import { UIData } from '@leafer-ui/data'
@@ -10,12 +10,10 @@ import { UIBounds, UIRender } from '@leafer-ui/display-module'
10
10
  import { Export, PathArrow } from '@leafer-ui/external'
11
11
 
12
12
 
13
-
14
-
15
13
  @useModule(UIBounds)
16
14
  @useModule(UIRender)
17
15
  @rewriteAble()
18
- export class UI extends Leaf implements IUI {
16
+ export class UI extends Leaf implements IUI { // tip: rewrited Box
19
17
 
20
18
  @dataProcessor(UIData)
21
19
  declare public __: IUIData
@@ -84,35 +82,35 @@ export class UI extends Leaf implements IUI {
84
82
 
85
83
 
86
84
  // position
87
- @positionType(0)
85
+ @positionType(0, true)
88
86
  public x: INumber
89
87
 
90
- @positionType(0)
88
+ @positionType(0, true)
91
89
  public y: INumber
92
90
 
93
91
  // size
94
- @boundsType(100)
92
+ @boundsType(100, true)
95
93
  public width: INumber
96
94
 
97
- @boundsType(100)
95
+ @boundsType(100, true)
98
96
  public height: INumber
99
97
 
100
98
  // scale
101
- @scaleType(1)
99
+ @scaleType(1, true)
102
100
  public scaleX: INumber
103
101
 
104
- @scaleType(1)
102
+ @scaleType(1, true)
105
103
  public scaleY: INumber
106
104
 
107
105
  // rotate
108
- @rotationType(0)
106
+ @rotationType(0, true)
109
107
  public rotation: INumber
110
108
 
111
109
  // skew
112
- @rotationType(0)
110
+ @rotationType(0, true)
113
111
  public skewX: INumber
114
112
 
115
- @rotationType(0)
113
+ @rotationType(0, true)
116
114
  public skewY: INumber
117
115
 
118
116
 
@@ -130,6 +128,9 @@ export class UI extends Leaf implements IUI {
130
128
  @dataType('size')
131
129
  public editSize?: IEditSize
132
130
 
131
+ @dataType()
132
+ public editorStyle: IEditorConfig
133
+
133
134
 
134
135
  // hit
135
136
  @hitType(true)
@@ -209,6 +210,9 @@ export class UI extends Leaf implements IUI {
209
210
  @pathType()
210
211
  public windingRule: IWindingRule
211
212
 
213
+ @pathType(true)
214
+ public closed: boolean
215
+
212
216
 
213
217
  // arrow
214
218
 
@@ -337,10 +341,8 @@ export class UI extends Leaf implements IUI {
337
341
 
338
342
  public __onUpdateSize(): void {
339
343
  if (this.__.__input) {
340
- const data = this.__
341
- data.__needComputePaint = true
342
- if (data.lazy && this.leafer && !this.leafer.canvas.bounds.hit(this.__world)) return
343
- data.__computePaint()
344
+ const data = this.__;
345
+ (data.lazy && this.leafer && this.leafer.created && !this.leafer.lazyBounds.hit(this.__world)) ? data.__needComputePaint = true : data.__computePaint()
344
346
  }
345
347
  }
346
348
 
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
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';
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, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IBoundsData, IResizeEvent, IObject, IZoomType, IFourNumber, IRenderOptions, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
2
+ import { Leaf, LeafList } from '@leafer/core';
3
+ import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IEditSize, IEditorConfig, 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
4
 
5
5
  declare class UI extends Leaf implements IUI {
6
6
  __: IUIData;
@@ -38,6 +38,7 @@ declare class UI extends Leaf implements IUI {
38
38
  draggable: IBoolean;
39
39
  editable: IBoolean;
40
40
  editSize?: IEditSize;
41
+ editorStyle: IEditorConfig;
41
42
  hittable: IBoolean;
42
43
  hitFill: IHitType;
43
44
  hitStroke: IHitType;
@@ -60,6 +61,7 @@ declare class UI extends Leaf implements IUI {
60
61
  pixelRatio: INumber;
61
62
  path: IPathCommandData | IPathString;
62
63
  windingRule: IWindingRule;
64
+ closed: boolean;
63
65
  startArrow: IArrowType;
64
66
  endArrow: IArrowType;
65
67
  cornerRadius: number | number[] | ICornerRadiusString;
@@ -123,6 +125,8 @@ declare class Group extends UI implements IGroup {
123
125
  }
124
126
 
125
127
  declare class Leafer extends Group implements ILeafer {
128
+ static get version(): string;
129
+ static list: LeafList;
126
130
  get __tag(): string;
127
131
  __: ILeaferData;
128
132
  pixelRatio: INumber;
@@ -151,11 +155,14 @@ declare class Leafer extends Group implements ILeafer {
151
155
  userConfig: ILeaferConfig;
152
156
  config: ILeaferConfig;
153
157
  autoLayout?: IAutoBounds;
158
+ lazyBounds: IBounds;
159
+ get FPS(): number;
154
160
  get cursorPoint(): IPointData;
155
161
  leafs: number;
156
162
  __eventIds: IEventListenerId[];
157
163
  protected __startTimer: ITimer;
158
164
  protected __controllers: IControl[];
165
+ protected __initWait: IFunction[];
159
166
  protected __readyWait: IFunction[];
160
167
  protected __viewReadyWait: IFunction[];
161
168
  protected __viewCompletedWait: IFunction[];
@@ -173,13 +180,14 @@ declare class Leafer extends Group implements ILeafer {
173
180
  forceFullRender(): void;
174
181
  forceRender(bounds?: IBoundsData): void;
175
182
  updateCursor(cursor?: ICursorType): void;
183
+ updateLazyBounds(): void;
176
184
  protected __doResize(size: IScreenSizeData): void;
177
185
  protected __onResize(event: IResizeEvent): void;
178
186
  protected __setApp(): void;
179
187
  protected __bindApp(app: IApp): void;
180
188
  __setLeafer(leafer: ILeafer): void;
181
189
  protected __checkAutoLayout(config: ILeaferConfig): void;
182
- __setAttr(attrName: string, newValue: IValue): void;
190
+ __setAttr(attrName: string, newValue: IValue): boolean;
183
191
  __getAttr(attrName: string): IValue;
184
192
  protected __changeCanvasSize(attrName: string, newValue: number): void;
185
193
  protected __changeFill(newValue: string): void;
@@ -189,17 +197,19 @@ declare class Leafer extends Group implements ILeafer {
189
197
  protected __onNextRender(): void;
190
198
  protected __checkViewCompleted(emit?: boolean): void;
191
199
  protected __onWatchData(): void;
200
+ waitInit(item: IFunction, bind?: IObject): void;
192
201
  waitReady(item: IFunction, bind?: IObject): void;
193
202
  waitViewReady(item: IFunction, bind?: IObject): void;
194
203
  waitViewCompleted(item: IFunction, bind?: IObject): void;
195
204
  nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
196
205
  zoom(_zoomType: IZoomType, _padding?: IFourNumber, _fixedScale?: boolean): IBoundsData;
197
- validScale(changeScale: number): number;
206
+ getValidMove(moveX: number, moveY: number): IPointData;
207
+ getValidScale(changeScale: number): number;
198
208
  protected __checkUpdateLayout(): void;
199
209
  protected emitLeafer(type: string): void;
200
210
  protected __listenEvents(): void;
201
211
  protected __removeListenEvents(): void;
202
- destroy(): void;
212
+ destroy(sync?: boolean): void;
203
213
  }
204
214
 
205
215
  declare class Box extends Group implements IBox {
@@ -277,6 +287,7 @@ declare class Line extends UI implements ILine {
277
287
  height: INumber;
278
288
  points: number[];
279
289
  curve: boolean | number;
290
+ closed: boolean;
280
291
  get toPoint(): IPointData;
281
292
  set toPoint(value: IPointData);
282
293
  constructor(data?: ILineInputData);
@@ -302,6 +313,7 @@ declare class Canvas extends Rect implements ICanvas {
302
313
  height: INumber;
303
314
  pixelRatio: INumber;
304
315
  smooth: boolean;
316
+ contextSettings: ICanvasContext2DSettings;
305
317
  hitFill: IHitType;
306
318
  canvas: ILeaferCanvas;
307
319
  context: ICanvasContext2D;
@@ -378,6 +390,7 @@ declare class Pen extends Group implements IPen {
378
390
  drawEllipse(_x: number, _y: number, _radiusX: number, _radiusY: number, _rotation?: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
379
391
  drawArc(_x: number, _y: number, _radius: number, _startAngle?: number, _endAngle?: number, _anticlockwise?: boolean): Pen;
380
392
  drawPoints(_points: number[], _curve?: boolean | number, _close?: boolean): Pen;
393
+ clearPath(): Pen;
381
394
  paint(): void;
382
395
  }
383
396