@leafer-ui/display 1.9.5 → 1.9.6

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.9.5",
3
+ "version": "1.9.6",
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.9.5",
26
- "@leafer-ui/data": "1.9.5",
27
- "@leafer-ui/display-module": "1.9.5",
28
- "@leafer-ui/decorator": "1.9.5",
29
- "@leafer-ui/external": "1.9.5"
25
+ "@leafer/core": "1.9.6",
26
+ "@leafer-ui/data": "1.9.6",
27
+ "@leafer-ui/display-module": "1.9.6",
28
+ "@leafer-ui/decorator": "1.9.6",
29
+ "@leafer-ui/external": "1.9.6"
30
30
  },
31
31
  "devDependencies": {
32
- "@leafer/interface": "1.9.5",
33
- "@leafer-ui/interface": "1.9.5"
32
+ "@leafer/interface": "1.9.6",
33
+ "@leafer-ui/interface": "1.9.6"
34
34
  }
35
35
  }
package/src/Leafer.ts CHANGED
@@ -1,5 +1,5 @@
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, ICanvasSizeAttr } from '@leafer/interface'
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'
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, ICanvasSizeAttr, ILeaferMode } from '@leafer/interface'
2
+ import { AutoBounds, LayoutEvent, ResizeEvent, LeaferEvent, CanvasManager, ImageManager, Resource, DataHelper, Creator, Run, Debug, RenderEvent, registerUI, boundsType, canvasSizeAttrs, dataProcessor, WaitHelper, WatchEvent, Bounds, LeafList, Plugin, getBoundsData, dataType } from '@leafer/core'
3
3
 
4
4
  import { ILeaferInputData, ILeaferData, IFunction, IUIInputData, ILeafer, IApp, IEditorBase } from '@leafer-ui/interface'
5
5
  import { LeaferData } from '@leafer-ui/data'
@@ -23,6 +23,9 @@ export class Leafer extends Group implements ILeafer {
23
23
  @boundsType()
24
24
  declare public pixelRatio?: INumber
25
25
 
26
+ @dataType('normal')
27
+ public mode: ILeaferMode
28
+
26
29
  public get isApp(): boolean { return false }
27
30
  public get app(): ILeafer { return this.parent || this }
28
31
 
@@ -268,7 +271,7 @@ export class Leafer extends Group implements ILeafer {
268
271
  } else if (attrName === 'zIndex') {
269
272
  this.canvas.zIndex = newValue as any
270
273
  setTimeout(() => this.parent && this.parent.__updateSortChildren())
271
- }
274
+ } else if (attrName === 'mode') this.emit(LeaferEvent.UPDATE_MODE, { mode: newValue })
272
275
  }
273
276
  return super.__setAttr(attrName, newValue)
274
277
  }
package/src/Polygon.ts CHANGED
@@ -1,16 +1,14 @@
1
1
  import { INumber, IPointData } from '@leafer/interface'
2
- import { PathCommandDataHelper, dataProcessor, pathType, registerUI, rewrite, rewriteAble } from '@leafer/core'
2
+ import { PathCommandDataHelper, dataProcessor, pathType, registerUI, rewriteAble } from '@leafer/core'
3
3
 
4
4
  import { IPolygon, IPolygonData, IPolygonInputData } from '@leafer-ui/interface'
5
5
  import { PolygonData } from '@leafer-ui/data'
6
6
 
7
7
  import { UI } from './UI'
8
- import { Line } from './Line'
9
8
 
10
9
 
11
10
  const { sin, cos, PI } = Math
12
11
  const { moveTo, lineTo, closePath, drawPoints } = PathCommandDataHelper
13
- const line = Line.prototype
14
12
 
15
13
  @rewriteAble()
16
14
  @registerUI()
@@ -57,10 +55,4 @@ export class Polygon<TInputData = IPolygonInputData> extends UI<TInputData> impl
57
55
 
58
56
  }
59
57
 
60
- @rewrite(line.__updateRenderPath)
61
- public __updateRenderPath(): void { }
62
-
63
- @rewrite(line.__updateBoxBounds)
64
- public __updateBoxBounds(): void { }
65
-
66
58
  }
package/src/Text.ts CHANGED
@@ -154,11 +154,6 @@ export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData
154
154
  else data.__textBoxBounds = b
155
155
  }
156
156
 
157
- override __onUpdateSize(): void {
158
- if (this.__box) this.__box.__onUpdateSize()
159
- super.__onUpdateSize()
160
- }
161
-
162
157
  override __updateRenderSpread(): number {
163
158
  let width = super.__updateRenderSpread()
164
159
  if (!width) width = this.isOverflow ? 1 : 0
@@ -171,6 +166,12 @@ export class Text<TConstructorData = ITextInputData> extends UI<TConstructorData
171
166
  if (this.__box) this.__box.__layout.renderBounds = renderBounds
172
167
  }
173
168
 
169
+ override __updateChange(): void {
170
+ super.__updateChange()
171
+ const box = this.__box
172
+ if (box) box.__onUpdateSize(), box.__updateChange()
173
+ }
174
+
174
175
  override __drawRenderPath(canvas: ILeaferCanvas): void {
175
176
  canvas.font = this.__.__font
176
177
  }
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, IDragBoundsType, IHitType, ICursorType, IScaleFixed, 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, ICanvasSizeAttr, IZoomType, IZoomOptions, 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, IDragBoundsType, IHitType, ICursorType, IScaleFixed, IFilter, ITransition, IUnitData, IObject, IPointData, IPathCreator, IValue, IFindCondition, ILeaferCanvas, IPathDrawer, ILeaferImage, IExportFileType, IJSONOptions, IPickOptions, IPickResult, ILeaferMode, IRenderer, IWatcher, ILayouter, ISelector, IInteraction, ICanvasManager, IHitCanvasManager, ILeaferConfig, IAutoBounds, IBounds, IEventListenerId, ITimer, IControl, ILeaferType, IScreenSizeData, IResizeEvent, ICanvasSizeAttr, IZoomType, IZoomOptions, IClientPointData, IRenderOptions, 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, 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
 
@@ -185,6 +185,7 @@ declare class Leafer extends Group implements ILeafer {
185
185
  get __tag(): string;
186
186
  __: ILeaferData;
187
187
  pixelRatio?: INumber;
188
+ mode: ILeaferMode;
188
189
  get isApp(): boolean;
189
190
  get app(): ILeafer;
190
191
  get isLeafer(): boolean;
@@ -334,8 +335,6 @@ declare class Polygon<TInputData = IPolygonInputData> extends UI<TInputData> imp
334
335
  points?: number[] | IPointData[];
335
336
  curve?: boolean | number;
336
337
  __updatePath(): void;
337
- __updateRenderPath(): void;
338
- __updateBoxBounds(): void;
339
338
  }
340
339
 
341
340
  declare class Star<TInputData = IStarInputData> extends UI<TInputData> implements IStar {
@@ -423,9 +422,9 @@ declare class Text<TConstructorData = ITextInputData> extends UI<TConstructorDat
423
422
  get textDrawData(): ITextDrawData;
424
423
  __updateTextDrawData(): void;
425
424
  __updateBoxBounds(): void;
426
- __onUpdateSize(): void;
427
425
  __updateRenderSpread(): number;
428
426
  __updateRenderBounds(): void;
427
+ __updateChange(): void;
429
428
  __drawRenderPath(canvas: ILeaferCanvas): void;
430
429
  __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
431
430
  __drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void;