@leafer-ui/display 1.12.1 → 1.12.2

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.12.1",
3
+ "version": "1.12.2",
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.12.1",
26
- "@leafer-ui/data": "1.12.1",
27
- "@leafer-ui/display-module": "1.12.1",
28
- "@leafer-ui/decorator": "1.12.1",
29
- "@leafer-ui/external": "1.12.1"
25
+ "@leafer/core": "1.12.2",
26
+ "@leafer-ui/data": "1.12.2",
27
+ "@leafer-ui/display-module": "1.12.2",
28
+ "@leafer-ui/decorator": "1.12.2",
29
+ "@leafer-ui/external": "1.12.2"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.12.1",
33
- "@leafer-ui/interface": "1.12.1"
32
+ "@leafer/interface": "1.12.2",
33
+ "@leafer-ui/interface": "1.12.2"
34
34
  }
35
35
  }
package/src/Ellipse.ts CHANGED
@@ -39,7 +39,6 @@ export class Ellipse<TInputData = IEllipseInputData> extends UI<TInputData> impl
39
39
  if (startAngle || endAngle) {
40
40
  if (innerRadius < 1) ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius, 0, startAngle, endAngle, false)
41
41
  ellipse(path, rx, ry, rx, ry, 0, endAngle, startAngle, true)
42
- if (innerRadius < 1) closePath(path)
43
42
  } else {
44
43
  if (innerRadius < 1) {
45
44
  ellipse(path, rx, ry, rx * innerRadius, ry * innerRadius)
@@ -48,21 +47,22 @@ export class Ellipse<TInputData = IEllipseInputData> extends UI<TInputData> impl
48
47
  ellipse(path, rx, ry, rx, ry, 0, 360, 0, true)
49
48
  }
50
49
 
51
- // fix node
52
- if (Platform.ellipseToCurve) this.__.path = this.getPath(true)
53
-
54
50
  } else {
55
51
 
56
52
  if (startAngle || endAngle) {
57
53
  moveTo(path, rx, ry)
58
54
  ellipse(path, rx, ry, rx, ry, 0, startAngle, endAngle, false)
59
- closePath(path)
60
55
  } else {
61
56
  ellipse(path, rx, ry, rx, ry)
62
57
  }
63
58
 
64
59
  }
65
60
 
61
+ closePath(path)
62
+
63
+ // fix node
64
+ if (Platform.ellipseToCurve) this.__.path = this.getPath(true)
65
+
66
66
  }
67
67
 
68
68
  }
package/src/Leafer.ts CHANGED
@@ -44,7 +44,7 @@ export class Leafer extends Group implements ILeafer {
44
44
 
45
45
  public transforming: boolean
46
46
 
47
- public view: unknown
47
+ public get view(): unknown { return this.canvas && this.canvas.view }
48
48
 
49
49
  // manager
50
50
  public canvas: ILeaferCanvas
@@ -128,7 +128,6 @@ export class Leafer extends Group implements ILeafer {
128
128
 
129
129
  if (this.isApp) this.__setApp()
130
130
  this.__checkAutoLayout()
131
- this.view = canvas.view
132
131
 
133
132
  // interaction / manager
134
133
  if (!parentApp) {
@@ -466,7 +465,7 @@ export class Leafer extends Group implements ILeafer {
466
465
 
467
466
  if (this.canvas) this.canvas.destroy()
468
467
 
469
- this.config.view = this.view = this.parentApp = null
468
+ this.config.view = this.parentApp = null
470
469
  if (this.userConfig) this.userConfig.view = null
471
470
 
472
471
  super.destroy()
package/src/UI.ts CHANGED
@@ -104,6 +104,9 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
104
104
  @scaleType(1, true)
105
105
  public scaleY?: INumber
106
106
 
107
+ // @leafer-in/scale-fixed will rewrite
108
+ public scaleFixed?: IScaleFixed
109
+
107
110
  // rotate
108
111
  @rotationType(0, true)
109
112
  public rotation?: INumber
@@ -438,7 +441,7 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
438
441
  public getPath(curve?: boolean, pathForRender?: boolean): IPathCommandData {
439
442
  this.__layout.update()
440
443
  let path = pathForRender ? this.__.__pathForRender : this.__.path
441
- if (!path) pen.set(path = []), this.__drawPathByBox(pen)
444
+ if (!path) pen.set(path = []), this.__drawPathByBox(pen, !pathForRender)
442
445
  return curve ? PathConvert.toCanvasData(path, true) : path
443
446
  }
444
447
 
@@ -473,19 +476,20 @@ export class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements I
473
476
 
474
477
  public __drawPath(canvas: ILeaferCanvas): void {
475
478
  canvas.beginPath()
476
- this.__drawPathByData(canvas, this.__.path)
479
+ this.__drawPathByData(canvas, this.__.path, true)
477
480
  }
478
481
 
479
- public __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void {
480
- data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer)
482
+ public __drawPathByData(drawer: IPathDrawer, data: IPathCommandData, ignoreCornerRadius?: boolean): void {
483
+ data ? PathDrawer.drawPathByData(drawer, data) : this.__drawPathByBox(drawer, ignoreCornerRadius)
481
484
  }
482
485
 
483
- public __drawPathByBox(drawer: IPathDrawer): void {
486
+ public __drawPathByBox(drawer: IPathDrawer, ignoreCornerRadius?: boolean): void {
484
487
  const { x, y, width, height } = this.__layout.boxBounds
485
- if (this.__.cornerRadius) {
488
+ if (this.__.cornerRadius && !ignoreCornerRadius) {
486
489
  const { cornerRadius } = this.__
487
490
  drawer.roundRect(x, y, width, height, isNumber(cornerRadius) ? [cornerRadius] : cornerRadius) // 修复微信浏览器bug, 后续需进一步优化
488
491
  } else drawer.rect(x, y, width, height)
492
+ drawer.closePath()
489
493
  }
490
494
 
491
495
  public drawImagePlaceholder(_paint: ILeafPaint, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void {
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IFourNumber, IPathCommandData, IPathCommandNode, IPathCommandObject, IPathString, IWindingRule, IFlowType, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IDragBoundsType, IHitType, ICursorType, IScaleFixed, 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';
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
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';
4
4
 
@@ -31,6 +31,7 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
31
31
  height?: INumber;
32
32
  scaleX?: INumber;
33
33
  scaleY?: INumber;
34
+ scaleFixed?: IScaleFixed;
34
35
  rotation?: INumber;
35
36
  skewX?: INumber;
36
37
  skewY?: INumber;
@@ -140,8 +141,8 @@ declare class UI<TInputData = IUIInputData> extends Leaf<TInputData> implements
140
141
  __updateRenderPath(): void;
141
142
  __drawRenderPath(canvas: ILeaferCanvas): void;
142
143
  __drawPath(canvas: ILeaferCanvas): void;
143
- __drawPathByData(drawer: IPathDrawer, data: IPathCommandData): void;
144
- __drawPathByBox(drawer: IPathDrawer): void;
144
+ __drawPathByData(drawer: IPathDrawer, data: IPathCommandData, ignoreCornerRadius?: boolean): void;
145
+ __drawPathByBox(drawer: IPathDrawer, ignoreCornerRadius?: boolean): void;
145
146
  drawImagePlaceholder(_paint: ILeafPaint, canvas: ILeaferCanvas, renderOptions: IRenderOptions): void;
146
147
  animate(keyframe?: IUIInputData | IKeyframe[] | IAnimation | IAnimation[], _options?: ITransition, _type?: IAnimateType, _isTemp?: boolean): IAnimate;
147
148
  killAnimate(_type?: IAnimateType, _nextStyle?: IUIInputData): void;
@@ -200,7 +201,7 @@ declare class Leafer extends Group implements ILeafer {
200
201
  get imageReady(): boolean;
201
202
  get layoutLocked(): boolean;
202
203
  transforming: boolean;
203
- view: unknown;
204
+ get view(): unknown;
204
205
  canvas: ILeaferCanvas;
205
206
  renderer: IRenderer;
206
207
  watcher: IWatcher;