@leafer-ui/display 2.0.2 → 2.0.3

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": "2.0.2",
3
+ "version": "2.0.3",
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": "2.0.2",
26
- "@leafer-ui/data": "2.0.2",
27
- "@leafer-ui/display-module": "2.0.2",
28
- "@leafer-ui/decorator": "2.0.2",
29
- "@leafer-ui/external": "2.0.2"
25
+ "@leafer/core": "2.0.3",
26
+ "@leafer-ui/data": "2.0.3",
27
+ "@leafer-ui/display-module": "2.0.3",
28
+ "@leafer-ui/decorator": "2.0.3",
29
+ "@leafer-ui/external": "2.0.3"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "2.0.2",
33
- "@leafer-ui/interface": "2.0.2"
32
+ "@leafer/interface": "2.0.3",
33
+ "@leafer-ui/interface": "2.0.3"
34
34
  }
35
35
  }
package/src/Ellipse.ts CHANGED
@@ -29,10 +29,10 @@ export class Ellipse<TInputData = IEllipseInputData> extends UI<TInputData> impl
29
29
 
30
30
  public __updatePath(): void {
31
31
 
32
- const { width, height, innerRadius, startAngle, endAngle } = this.__
32
+ const data = this.__, { width, height, innerRadius, startAngle, endAngle } = data
33
33
  const rx = width / 2, ry = height / 2
34
34
 
35
- const path: number[] = this.__.path = []
35
+ const path: number[] = data.path = []
36
36
  let open: boolean
37
37
 
38
38
  if (innerRadius) {
@@ -63,7 +63,7 @@ export class Ellipse<TInputData = IEllipseInputData> extends UI<TInputData> impl
63
63
  if (!open) closePath(path)
64
64
 
65
65
  // fix node
66
- if (Platform.ellipseToCurve) this.__.path = this.getPath(true)
66
+ if (Platform.ellipseToCurve || data.__useArrow) data.path = this.getPath(true)
67
67
 
68
68
  }
69
69
 
package/src/Leafer.ts CHANGED
@@ -72,6 +72,10 @@ export class Leafer extends Group implements ILeafer {
72
72
  // pixelSnap: false // 是否对齐像素,避免图片存在浮点坐标导致模糊
73
73
  }
74
74
 
75
+ // @leafer-in/find will rewrite
76
+ public cacheId?: boolean
77
+ public cacheInnerId?: boolean
78
+
75
79
  public autoLayout?: IAutoBounds
76
80
  public lazyBounds: IBounds
77
81
 
package/src/UI.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ILeaferCanvas, IRenderOptions, IPathDrawer, IPathCommandData, IHitType, INumber, IBoolean, IString, IPathString, IExportFileType, IPointData, ICursorType, IMaskType, IEraserType, IWindingRule, IPathCreator, IFourNumber, IBoundsData, IFlowType, IGap, IFlowWrap, IAxis, IConstraint, IAutoBoxData, IFlowBoxType, IPointGap, IFlowAlign, IFlowAxisAlign, IFindCondition, IAutoSize, IRangeSize, IAlign, IUnitPointData, IObject, IScaleData, IUnitData, IPathCommandObject, ITransition, IFilter, IScaleFixed, IDragBoundsType, IPathCommandNode } from '@leafer/interface'
2
2
  import { Leaf, PathDrawer, surfaceType, dimType, dataType, positionType, scrollType, boundsType, pathType, scaleType, rotationType, opacityType, visibleType, sortType, maskType, dataProcessor, registerUI, useModule, rewrite, rewriteAble, UICreator, PathCorner, hitType, strokeType, PathConvert, eraserType, cursorType, autoLayoutType, pen, naturalBoundsType, pathInputType, MathHelper, Plugin, DataHelper, affectRenderBoundsType, isString, isNumber } 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, IArrowStyle, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle, IColorString, IAnimateList, ILeafPaint } 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, IArrowStyle, IFindUIMethod, ILeafer, IEditorConfig, IEditorConfigFunction, IEditToolFunction, IKeyframe, IAnimation, IAnimate, IStates, IStateName, IAnimateType, IStateStyle, IColorString, IAnimateList, ILeafPaint, ILinker } from '@leafer-ui/interface'
5
5
  import { effectType, zoomLayerType } from '@leafer-ui/decorator'
6
6
 
7
7
  import { UIData } from '@leafer-ui/data'
@@ -33,6 +33,10 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
33
33
 
34
34
  declare public children?: IUI[]
35
35
 
36
+ // linker
37
+ public startLinker?: ILinker[]
38
+ public endLinker?: ILinker[]
39
+
36
40
  // ---
37
41
 
38
42
  // id
@@ -259,7 +263,11 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
259
263
  public strokeWidth?: IFourNumber | IStrokeWidthString
260
264
 
261
265
  @strokeType(false)
262
- public strokeWidthFixed?: IScaleFixed
266
+ public strokeScaleFixed?: IScaleFixed
267
+
268
+ // 未来将移除,请用 strokeScaleFixed 代替
269
+ public set strokeWidthFixed(value: IScaleFixed) { this.strokeScaleFixed = value }
270
+ public get strokeWidthFixed(): IScaleFixed { return this.strokeScaleFixed }
263
271
 
264
272
  @strokeType('none')
265
273
  public strokeCap?: IStrokeCap
@@ -454,6 +462,9 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
454
462
  return PathConvert.stringify(this.getPath(curve, pathForRender), floatLength)
455
463
  }
456
464
 
465
+ public asPath(curve?: boolean, pathForRender?: boolean): void {
466
+ this.path = this.getPath(curve, pathForRender)
467
+ }
457
468
 
458
469
  public load(): void {
459
470
  this.__.__computePaint() // 手动加载图片
@@ -466,17 +477,19 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
466
477
  }
467
478
  }
468
479
 
469
- public __updateRenderPath(): void {
480
+ public __updateRenderPath(updateCache?: boolean): void {
470
481
  const data = this.__
471
482
  if (data.path) {
472
483
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path
473
- if (data.__useArrow) PathArrow.addArrows(this)
484
+ if (data.__useArrow) PathArrow.addArrows(this, updateCache)
474
485
  } else data.__pathForRender && (data.__pathForRender = undefined)
475
486
  }
476
487
 
477
488
  public __drawRenderPath(canvas: ILeaferCanvas): void {
489
+ const data = this.__
478
490
  canvas.beginPath()
479
- this.__drawPathByData(canvas, this.__.__pathForRender)
491
+ if (data.__useArrow) PathArrow.updateArrow(this)
492
+ this.__drawPathByData(canvas, data.__pathForRender)
480
493
  }
481
494
 
482
495
  public __drawPath(canvas: ILeaferCanvas): void {
@@ -552,9 +565,10 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
552
565
 
553
566
 
554
567
  public destroy(): void {
568
+ this.__.__willDestroy = true
555
569
  this.fill = this.stroke = null
556
570
  if (this.__animate) this.killAnimate()
557
571
  super.destroy()
558
572
  }
559
573
 
560
- }
574
+ }
package/types/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IString, INumber, IBoolean, IMaskType, IEraserType, IScaleFixed, IAlign, IUnitPointData, IFourNumber, IPathCommandData, IPathCommandNode, IPathCommandObject, IPathString, IWindingRule, IFlowType, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IDragBoundsType, IHitType, ICursorType, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IFindCondition, ILeaferCanvas, IPathDrawer, IRenderOptions, IExportFileType, IJSONOptions, IPickOptions, IPickResult, ILeaferMode, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IValue, ICanvasSizeAttr, IZoomType, IZoomOptions, IClientPointData, ILeaferImage, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
2
2
  import { Leaf, LeafList } from '@leafer/core';
3
- import { IUIInputData, IUI, IUIData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowStyle, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IColorString, IEditorConfig, IAnimate, IAnimateList, IFindUIMethod, ILeafPaint, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupInputData, IGroupData, IUIJSONData, IFindCondition as IFindCondition$1, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBoxInputData, IBox, IBoxData, IOverflow, IScrollConfig, IScroller, IFrameInputData, IFrame, IFrameData, IRectInputData, IRect, IRectData, IEllipseInputData, IEllipse, IEllipseData, IPolygonInputData, IPolygon, IPolygonData, IStarInputData, IStar, IStarData, ILineInputData, ILine, ILineData, IImageInputData, IImage, IImageData, ICanvasInputData, ICanvas, ICanvasData, ITextInputData, IText, ITextData, IBackgroundBoxStyle, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextOverflow, ITextDrawData, IPathInputData, IPath, IPathData, IPenInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPointData as IPointData$1 } from '@leafer-ui/interface';
3
+ import { IUIInputData, IUI, IUIData, ILeafer, IGroup, ILinker, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowStyle, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IColorString, IEditorConfig, IAnimate, IAnimateList, IFindUIMethod, ILeafPaint, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupInputData, IGroupData, IUIJSONData, IFindCondition as IFindCondition$1, ILeaferData, IApp, IEditorBase, IFunction, ILeaferInputData, IBoxInputData, IBox, IBoxData, IOverflow, IScrollConfig, IScroller, IFrameInputData, IFrame, IFrameData, IRectInputData, IRect, IRectData, IEllipseInputData, IEllipse, IEllipseData, IPolygonInputData, IPolygon, IPolygonData, IStarInputData, IStar, IStarData, ILineInputData, ILine, ILineData, IImageInputData, IImage, IImageData, ICanvasInputData, ICanvas, ICanvasData, ITextInputData, IText, ITextData, IBackgroundBoxStyle, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextOverflow, ITextDrawData, IPathInputData, IPath, IPathData, IPenInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPointData as IPointData$1 } from '@leafer-ui/interface';
4
4
 
5
5
  declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements IUI {
6
6
  __: IUIData;
@@ -12,6 +12,8 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
12
12
  zoomLayer: IGroup;
13
13
  get isFrame(): boolean;
14
14
  children?: IUI[];
15
+ startLinker?: ILinker[];
16
+ endLinker?: ILinker[];
15
17
  id?: IString;
16
18
  name?: IString;
17
19
  className?: IString;
@@ -76,7 +78,9 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
76
78
  stroke?: IStroke;
77
79
  strokeAlign?: IStrokeAlign;
78
80
  strokeWidth?: IFourNumber | IStrokeWidthString;
79
- strokeWidthFixed?: IScaleFixed;
81
+ strokeScaleFixed?: IScaleFixed;
82
+ set strokeWidthFixed(value: IScaleFixed);
83
+ get strokeWidthFixed(): IScaleFixed;
80
84
  strokeCap?: IStrokeCap;
81
85
  strokeJoin?: IStrokeJoin;
82
86
  dashPattern?: INumber[] | IDashPatternString;
@@ -137,9 +141,10 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
137
141
  findId(id: number | string): IUI | undefined;
138
142
  getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData;
139
143
  getPathString(curve?: boolean, pathForRender?: boolean, floatLength?: number): IPathString;
144
+ asPath(curve?: boolean, pathForRender?: boolean): void;
140
145
  load(): void;
141
146
  __onUpdateSize(): void;
142
- __updateRenderPath(): void;
147
+ __updateRenderPath(updateCache?: boolean): void;
143
148
  __drawRenderPath(canvas: ILeaferCanvas): void;
144
149
  __drawPath(canvas: ILeaferCanvas): void;
145
150
  __drawPathByData(drawer: IPathDrawer, data: IPathCommandData, ignoreCornerRadius?: boolean): void;
@@ -214,6 +219,8 @@ declare class Leafer extends Group implements ILeafer {
214
219
  editor: IEditorBase;
215
220
  userConfig: ILeaferConfig;
216
221
  config: ILeaferConfig;
222
+ cacheId?: boolean;
223
+ cacheInnerId?: boolean;
217
224
  autoLayout?: IAutoBounds;
218
225
  lazyBounds: IBounds;
219
226
  get FPS(): number;