@leafer-ui/display 1.0.0-rc.3 → 1.0.0-rc.5

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.3",
3
+ "version": "1.0.0-rc.5",
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.3",
26
- "@leafer-ui/data": "1.0.0-rc.3",
27
- "@leafer-ui/display-module": "1.0.0-rc.3",
28
- "@leafer-ui/decorator": "1.0.0-rc.3",
29
- "@leafer-ui/external": "1.0.0-rc.3"
25
+ "@leafer/core": "1.0.0-rc.5",
26
+ "@leafer-ui/data": "1.0.0-rc.5",
27
+ "@leafer-ui/display-module": "1.0.0-rc.5",
28
+ "@leafer-ui/decorator": "1.0.0-rc.5",
29
+ "@leafer-ui/external": "1.0.0-rc.5"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.0.0-rc.3",
33
- "@leafer-ui/interface": "1.0.0-rc.3"
32
+ "@leafer/interface": "1.0.0-rc.5",
33
+ "@leafer-ui/interface": "1.0.0-rc.5"
34
34
  }
35
35
  }
package/src/Ellipse.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __Number } from '@leafer/interface'
2
- import { PathCommandDataHelper, dataProcessor, pathType, registerUI } from '@leafer/core'
2
+ import { PathCommandDataHelper, PathConvert, Platform, dataProcessor, pathType, registerUI } from '@leafer/core'
3
3
 
4
4
  import { IEllipse, IEllipseInputData, IEllipseData } from '@leafer-ui/interface'
5
5
  import { EllipseData } from '@leafer-ui/data'
@@ -48,9 +48,12 @@ export class Ellipse extends UI implements IEllipse {
48
48
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius)
49
49
  moveTo(path, width, ry)
50
50
  }
51
- ellipse(path, rx, ry, rx, ry, 0, 0, 360, true)
51
+ ellipse(path, rx, ry, rx, ry, 0, 360, 0, true)
52
52
  }
53
53
 
54
+ // fix node
55
+ if (Platform.name === 'node') this.__.path = PathConvert.toCanvasData(path, true)
56
+
54
57
  } else {
55
58
 
56
59
  if (startAngle || endAngle) {
package/src/Group.ts CHANGED
@@ -47,7 +47,11 @@ export class Group extends UI implements IGroup {
47
47
  const { children } = data
48
48
  delete data.children
49
49
 
50
- if (!this.children) this.__setBranch()
50
+ if (!this.children) {
51
+ this.__setBranch()
52
+ } else {
53
+ this.removeAll(true)
54
+ }
51
55
 
52
56
  super.set(data)
53
57
 
package/src/UI.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ILeaferCanvas, IPathDrawer, IPathCommandData, IHitType, __Number, __Boolean, __String, IPathString, IExportFileType, IPointData, ICursorType, IAround } from '@leafer/interface'
2
2
  import { Leaf, PathDrawer, surfaceType, dataType, positionType, boundsType, pathType, scaleType, rotationType, opacityType, sortType, maskType, dataProcessor, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType } from '@leafer/core'
3
3
 
4
- import { IUI, IShadowEffect, IBlurEffect, IPaint, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IPaintString, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, IUIInputData, IUIBaseInputData, IExportOptions, IExportResult } from '@leafer-ui/interface'
4
+ import { IUI, IShadowEffect, IBlurEffect, IPaint, IStrokeAlign, IStrokeJoin, IStrokeCap, IBlendMode, IPaintString, IDashPatternString, IShadowString, IGrayscaleEffect, IUIData, IGroup, IStrokeWidthString, ICornerRadiusString, 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'
@@ -116,7 +116,7 @@ export class UI extends Leaf implements IUI {
116
116
  @hitType()
117
117
  public hitRadius: __Number
118
118
 
119
- @cursorType('default')
119
+ @cursorType('')
120
120
  public cursor: ICursorType | ICursorType[]
121
121
 
122
122
  // ---
@@ -195,9 +195,8 @@ export class UI extends Leaf implements IUI {
195
195
  }
196
196
 
197
197
 
198
- constructor(data?: IUIBaseInputData) {
199
- super(data)
200
- }
198
+ @rewrite(Leaf.prototype.reset)
199
+ public reset(_data?: IUIInputData): void { }
201
200
 
202
201
 
203
202
  public set(data: IUIInputData): void {
@@ -223,8 +222,8 @@ export class UI extends Leaf implements IUI {
223
222
  public __onUpdateSize(): void {
224
223
  if (this.__.__input) {
225
224
  const { fill, stroke } = this.__.__input
226
- if (fill) Paint.compute(this, 'fill')
227
- if (stroke) Paint.compute(this, 'stroke')
225
+ if (fill) Paint.compute('fill', this)
226
+ if (stroke) Paint.compute('stroke', this)
228
227
  }
229
228
  }
230
229
 
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { __String, __Number, __Boolean, IAround, IHitType, ICursorType, IPointData, IPathCommandData, IPathString, ILeaferCanvas, IPathDrawer, IExportFileType, IRenderOptions, ILeaferImage, ICanvasContext2D, IWindingRule } from '@leafer/interface';
2
2
  import { Leaf } from '@leafer/core';
3
- import { IUI, IUIData, IGroup, IBlendMode, IPaint, IPaintString, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IUIBaseInputData, IUIInputData, IExportOptions, IExportResult, IGroupData, IGroupInputData, 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, IFontWeight, ITextCase, ITextDecoration, IUnitData, ITextAlign, IVerticalAlign, ITextDrawData, ITextInputData, IPath, IPathData, IPathString as IPathString$1, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData } from '@leafer-ui/interface';
3
+ import { IUI, IUIData, IGroup, IBlendMode, IPaint, IPaintString, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IUIInputData, IExportOptions, IExportResult, IGroupData, IGroupInputData, 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, IFontWeight, ITextCase, ITextDecoration, IUnitData, ITextAlign, IVerticalAlign, ITextDrawData, ITextInputData, IPath, IPathData, IPathString as IPathString$1, 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;
@@ -51,7 +51,7 @@ declare class UI extends Leaf implements IUI {
51
51
  grayscale: __Number | IGrayscaleEffect;
52
52
  set scale(value: __Number | IPointData);
53
53
  get scale(): __Number | IPointData;
54
- constructor(data?: IUIBaseInputData);
54
+ reset(_data?: IUIInputData): void;
55
55
  set(data: IUIInputData): void;
56
56
  get(): IUIInputData;
57
57
  getPath(curve?: boolean): IPathCommandData;