@leafer-ui/display 1.0.0-bate → 1.0.0-beta.10

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-bate",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "@leafer-ui/display",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -19,13 +19,14 @@
19
19
  "leaferjs"
20
20
  ],
21
21
  "dependencies": {
22
- "@leafer/core": "1.0.0-bate",
23
- "@leafer-ui/data": "1.0.0-bate",
24
- "@leafer-ui/display-module": "1.0.0-bate",
25
- "@leafer-ui/decorator": "1.0.0-bate"
22
+ "@leafer/core": "1.0.0-beta.10",
23
+ "@leafer-ui/data": "1.0.0-beta.10",
24
+ "@leafer-ui/text": "1.0.0-beta.10",
25
+ "@leafer-ui/display-module": "1.0.0-beta.10",
26
+ "@leafer-ui/decorator": "1.0.0-beta.10"
26
27
  },
27
28
  "devDependencies": {
28
- "@leafer/interface": "1.0.0-bate",
29
- "@leafer-ui/interface": "1.0.0-bate"
29
+ "@leafer/interface": "1.0.0-beta.10",
30
+ "@leafer-ui/interface": "1.0.0-beta.10"
30
31
  }
31
32
  }
package/src/Group.ts CHANGED
@@ -50,6 +50,8 @@ export class Group extends UI implements IGroup {
50
50
 
51
51
  public add(_child: IUI, _index?: number): void { }
52
52
 
53
- public remove(_child?: IUI): void { }
53
+ public remove(_child?: IUI, _destroy?: boolean): void { }
54
+
55
+ public removeAll(_destroy?: boolean): void { }
54
56
 
55
57
  }
package/src/Image.ts CHANGED
@@ -41,7 +41,7 @@ export class Image extends Rect implements IImage {
41
41
 
42
42
  if (update) {
43
43
  if (this.image) this.image = null
44
- this.fill = { type: 'image', mode: 'strench', url }
44
+ this.fill = url ? { type: 'image', mode: 'strench', url } : undefined
45
45
  this.once(ImageEvent.LOADED, (e) => this.image = e.image)
46
46
  }
47
47
 
package/src/UI.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, __Number, __Boolean, __String } from '@leafer/interface'
2
- import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert } from '@leafer/core'
1
+ import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, __Number, __Boolean, __String, IPathString, IExportFileType } from '@leafer/interface'
2
+ import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType } from '@leafer/core'
3
3
 
4
- import { IUI, IShadowEffect, IBlurEffect, IPaint, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IPaintString, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUITagInputData, IUIInputData, IPathString } from '@leafer-ui/interface'
4
+ import { IUI, IShadowEffect, IBlurEffect, IPaint, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IPaintString, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUITagInputData, IUIInputData, IExportOptions, IExportResult } from '@leafer-ui/interface'
5
5
  import { effectType } from '@leafer-ui/decorator'
6
6
 
7
7
  import { UIData } from '@leafer-ui/data'
8
8
  import { UIBounds, UIHit, UIRender } from '@leafer-ui/display-module'
9
9
 
10
- import { Paint } from '@leafer-ui/external'
10
+ import { Export, Paint } from '@leafer-ui/external'
11
11
 
12
12
 
13
13
  @useModule(UIBounds)
@@ -47,6 +47,9 @@ export class UI extends Leaf implements IUI {
47
47
  @maskType(false)
48
48
  public isMask: __Boolean
49
49
 
50
+ @eraserType(false)
51
+ public isEraser?: __Boolean
52
+
50
53
  @sortType(0)
51
54
  public zIndex: __Number
52
55
 
@@ -68,7 +71,6 @@ export class UI extends Leaf implements IUI {
68
71
  @boundsType(100)
69
72
  public height: __Number
70
73
 
71
-
72
74
  // scale
73
75
  @scaleType(1)
74
76
  public scaleX: __Number
@@ -76,7 +78,6 @@ export class UI extends Leaf implements IUI {
76
78
  @scaleType(1)
77
79
  public scaleY: __Number
78
80
 
79
-
80
81
  // rotate
81
82
  @rotationType(0)
82
83
  public rotation: __Number
@@ -197,8 +198,8 @@ export class UI extends Leaf implements IUI {
197
198
  public __onUpdateSize(): void {
198
199
  if (this.__.__input) {
199
200
  const { fill, stroke } = this.__.__input
200
- if (fill) Paint.computeFill(this)
201
- if (stroke) Paint.computeStroke(this)
201
+ if (fill) Paint.compute(this, 'fill')
202
+ if (stroke) Paint.compute(this, 'stroke')
202
203
  }
203
204
  }
204
205
 
@@ -222,8 +223,17 @@ export class UI extends Leaf implements IUI {
222
223
  @rewrite(PathDrawer.drawPathByData)
223
224
  public __drawPathByData(_drawer: IPathDrawer, _data: IPathCommandData): void { }
224
225
 
226
+ public export(filename: IExportFileType | string, options?: IExportOptions | number | boolean): Promise<IExportResult> {
227
+ return Export.export(this, filename, options)
228
+ }
229
+
225
230
  static one(data: IUITagInputData, x?: number, y?: number, width?: number, height?: number): IUI {
226
231
  return UICreator.get(data.tag || this.prototype.__tag, data, x, y, width, height) as IUI
227
232
  }
228
233
 
234
+ public destroy(): void {
235
+ this.fill = this.stroke = null
236
+ super.destroy()
237
+ }
238
+
229
239
  }