@leafer-ui/display 1.6.6 → 1.7.0

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.6.6",
3
+ "version": "1.7.0",
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.6.6",
26
- "@leafer-ui/data": "1.6.6",
27
- "@leafer-ui/display-module": "1.6.6",
28
- "@leafer-ui/decorator": "1.6.6",
29
- "@leafer-ui/external": "1.6.6"
25
+ "@leafer/core": "1.7.0",
26
+ "@leafer-ui/data": "1.7.0",
27
+ "@leafer-ui/display-module": "1.7.0",
28
+ "@leafer-ui/decorator": "1.7.0",
29
+ "@leafer-ui/external": "1.7.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.6.6",
33
- "@leafer-ui/interface": "1.6.6"
32
+ "@leafer/interface": "1.7.0",
33
+ "@leafer-ui/interface": "1.7.0"
34
34
  }
35
35
  }
package/src/Box.ts CHANGED
@@ -141,7 +141,7 @@ export class Box extends Group implements IBox {
141
141
  public __drawContent(canvas: ILeaferCanvas, options: IRenderOptions): void {
142
142
  this.__renderGroup(canvas, options)
143
143
 
144
- if (this.__.__hasStroke) { // 还原绘制路径
144
+ if (this.__.__useStroke) { // 还原绘制路径
145
145
  canvas.setWorld(this.__nowWorld)
146
146
  this.__drawRenderPath(canvas)
147
147
  }
package/src/Leafer.ts CHANGED
@@ -1,4 +1,4 @@
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, IClientPointData, ITransition } from '@leafer/interface'
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, IZoomOptions, IFourNumber, IBounds, IClientPointData, ITransition } from '@leafer/interface'
2
2
  import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, Resource, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds, LeafList, Plugin, getBoundsData } from '@leafer/core'
3
3
 
4
4
  import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer, IApp, IEditorBase } from '@leafer-ui/interface'
@@ -385,7 +385,7 @@ export class Leafer extends Group implements ILeafer {
385
385
  }
386
386
 
387
387
  // need view plugin
388
- public zoom(_zoomType: IZoomType, _padding?: IFourNumber, _fixedScale?: boolean, _transition?: ITransition): IBoundsData {
388
+ public zoom(_zoomType: IZoomType, _optionsOrPadding?: IZoomOptions | IFourNumber, _scroll?: 'x' | 'y' | boolean, _transition?: ITransition): IBoundsData {
389
389
  return Plugin.need('view')
390
390
  }
391
391
 
@@ -446,7 +446,7 @@ export class Leafer extends Group implements ILeafer {
446
446
  Leafer.list.remove(this)
447
447
  try {
448
448
  this.stop()
449
- this.emitEvent(new LeaferEvent(LeaferEvent.END, this))
449
+ this.emitLeafer(LeaferEvent.END)
450
450
  this.__removeListenEvents()
451
451
 
452
452
  this.__controllers.forEach(item => !(this.parent && item === this.interaction) && item.destroy())
package/src/Polygon.ts CHANGED
@@ -53,9 +53,10 @@ export class Polygon extends UI implements IPolygon {
53
53
  lineTo(path, rx + rx * sin((i * 2 * PI) / sides), ry - ry * cos((i * 2 * PI) / sides))
54
54
  }
55
55
 
56
+ closePath(path)
57
+
56
58
  }
57
59
 
58
- closePath(path)
59
60
  }
60
61
 
61
62
  @rewrite(line.__updateRenderPath)
package/src/Text.ts CHANGED
@@ -4,7 +4,7 @@ import { BoundsHelper, boundsType, surfaceType, dataProcessor, registerUI, affec
4
4
  import { IFill, IText, IFontWeight, ITextCase, ITextDecoration, ITextData, ITextInputData, ITextAlign, IVerticalAlign, ITextDrawData, IOverflow, IStrokeAlign, IHitType, ITextWrap, IWritingMode, IBackgroundBoxStyle } from '@leafer-ui/interface'
5
5
  import { TextData } from '@leafer-ui/data'
6
6
 
7
- import { TextConvert, UnitConvert, Export } from '@leafer-ui/external'
7
+ import { TextConvert, UnitConvert } from '@leafer-ui/external'
8
8
 
9
9
  import { UI } from './UI'
10
10
 
@@ -182,10 +182,15 @@ export class Text extends UI implements IText {
182
182
  override __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void {
183
183
  const box = this.__box
184
184
  if (box) box.__nowWorld = this.__nowWorld, box.__draw(canvas, options, originCanvas)
185
- if (this.textEditing && !Export.running) return
185
+ if (this.textEditing && !options.exporting) return
186
186
  super.__draw(canvas, options, originCanvas)
187
187
  }
188
188
 
189
+ override __drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void {
190
+ if (options.shape) this.__box && this.__box.__drawShape(canvas, options)
191
+ super.__drawShape(canvas, options)
192
+ }
193
+
189
194
  override destroy(): void {
190
195
  if (this.boxStyle) this.boxStyle = null
191
196
  super.destroy()
package/src/UI.ts CHANGED
@@ -235,13 +235,13 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
235
235
 
236
236
  // stroke
237
237
 
238
- @strokeType()
238
+ @strokeType(undefined, true)
239
239
  public stroke?: IStroke
240
240
 
241
241
  @strokeType('inside')
242
242
  public strokeAlign?: IStrokeAlign
243
243
 
244
- @strokeType(1)
244
+ @strokeType(1, true)
245
245
  public strokeWidth?: IFourNumber | IStrokeWidthString
246
246
 
247
247
  @strokeType(false)
@@ -456,11 +456,11 @@ export class UI extends Leaf implements IUI { // tip: rewrited Box
456
456
  }
457
457
 
458
458
  public __updateRenderPath(): void {
459
- if (this.__.path) {
460
- const data = this.__
459
+ const data = this.__
460
+ if (data.path) {
461
461
  data.__pathForRender = data.cornerRadius ? PathCorner.smooth(data.path, data.cornerRadius, data.cornerSmoothing) : data.path
462
462
  if (data.__useArrow) PathArrow.addArrows(this, !data.cornerRadius)
463
- }
463
+ } else data.__pathForRender && (data.__pathForRender = undefined)
464
464
  }
465
465
 
466
466
  public __drawRenderPath(canvas: ILeaferCanvas): void {
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IClientPointData, IRenderOptions, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
1
+ import { IString, INumber, IBoolean, IMaskType, IEraserType, IAlign, IUnitPointData, IPathCommandData, IPathCommandObject, IPathString, IWindingRule, IFlowType, IFourNumber, IGap, IPointGap, IFlowAlign, IFlowAxisAlign, IFlowWrap, IFlowBoxType, IAutoSize, IAutoBoxData, IConstraint, IRangeSize, IAxis, IBoundsData, IHitType, ICursorType, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, IExportFileType, IJSONOptions, IPickOptions, IPickResult, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, IZoomType, IZoomOptions, IClientPointData, IRenderOptions, ICanvasContext2DSettings, ICanvasContext2D } from '@leafer/interface';
2
2
  import { Leaf, LeafList } from '@leafer/core';
3
3
  import { IUI, IUIData, IUIInputData, ILeafer, IGroup, IBlendMode, IFill, IStroke, IStrokeAlign, IStrokeWidthString, IStrokeCap, IStrokeJoin, IDashPatternString, IArrowType, ICornerRadiusString, IShadowEffect, IShadowString, IBlurEffect, IGrayscaleEffect, IAnimation, IStates, IStateName, IStateStyle, IColorString, IEditorConfig, IAnimate, IFindUIMethod, IKeyframe, IAnimateType, IExportOptions, IExportResult, IEditorConfigFunction, IEditToolFunction, IGroupData, IGroupInputData, IUIJSONData, IFindCondition as IFindCondition$1, 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, IBackgroundBoxStyle, IHitType as IHitType$1, IFontWeight, ITextCase, ITextDecoration, IWritingMode, ITextAlign, IVerticalAlign, ITextWrap, ITextDrawData, ITextInputData, IPath, IPathData, IPathInputData, IPen, IPenData, IPathCommandData as IPathCommandData$1, IPenInputData, IPointData as IPointData$1 } from '@leafer-ui/interface';
4
4
 
@@ -256,7 +256,7 @@ declare class Leafer extends Group implements ILeafer {
256
256
  waitViewReady(item: IFunction, bind?: IObject): void;
257
257
  waitViewCompleted(item: IFunction, bind?: IObject): void;
258
258
  nextRender(item: IFunction, bind?: IObject, off?: 'off'): void;
259
- zoom(_zoomType: IZoomType, _padding?: IFourNumber, _fixedScale?: boolean, _transition?: ITransition): IBoundsData;
259
+ zoom(_zoomType: IZoomType, _optionsOrPadding?: IZoomOptions | IFourNumber, _scroll?: 'x' | 'y' | boolean, _transition?: ITransition): IBoundsData;
260
260
  getValidMove(moveX: number, moveY: number): IPointData;
261
261
  getValidScale(changeScale: number): number;
262
262
  getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
@@ -430,6 +430,7 @@ declare class Text extends UI implements IText {
430
430
  __updateRenderBounds(): void;
431
431
  __drawRenderPath(canvas: ILeaferCanvas): void;
432
432
  __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
433
+ __drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void;
433
434
  destroy(): void;
434
435
  }
435
436