@leafer/interface 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/interface",
3
- "version": "1.6.6",
3
+ "version": "1.7.0",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import { ILeaf, ICursorType } from '../display/ILeaf'
1
+ import { ILeaf, ICursorType, IAlign } from '../display/ILeaf'
2
2
  import { IRenderer, IRendererConfig } from '../renderer/IRenderer'
3
3
  import { IHitCanvas, ILeaferCanvas, ILeaferCanvasConfig, IHitCanvasConfig } from '../canvas/ILeaferCanvas'
4
4
  import { ILayouter, ILayouterConfig } from '../layouter/ILayouter'
@@ -83,7 +83,7 @@ export interface ILeaferAttrData {
83
83
  waitViewReady(item: IFunction, bind?: IObject): void
84
84
  waitViewCompleted(item: IFunction, bind?: IObject): void
85
85
 
86
- zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean, transition?: ITransition): IBoundsData
86
+ zoom(zoomType: IZoomType, optionsOrPadding?: IZoomOptions | IFourNumber, scroll?: 'x' | 'y' | boolean, transition?: ITransition): IBoundsData
87
87
  getValidMove(moveX: number, moveY: number): IPointData
88
88
  getValidScale(changeScale: number): number
89
89
 
@@ -97,6 +97,13 @@ export interface ILeaferAttrData {
97
97
 
98
98
  export type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData
99
99
 
100
+ export interface IZoomOptions {
101
+ padding?: IFourNumber
102
+ scroll?: 'x' | 'y' | boolean
103
+ transition?: ITransition
104
+ origin?: IPointData | IAlign
105
+ }
106
+
100
107
  export interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
101
108
  readonly isApp: boolean
102
109
  readonly app: ILeaferBase
@@ -424,6 +424,7 @@ export interface ILeafComputedData {
424
424
  readonly __isLinePath: boolean
425
425
  readonly __blendMode: string
426
426
 
427
+ __useStroke?: boolean
427
428
  __useArrow?: boolean
428
429
  __useEffect?: boolean
429
430
 
@@ -662,7 +663,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
662
663
  __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void
663
664
 
664
665
  __clip(canvas: ILeaferCanvas, options: IRenderOptions): void
665
- __renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void
666
+ __renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
667
+ __drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void
666
668
 
667
669
  __updateWorldOpacity(): void
668
670
  __updateChange(): void
@@ -10,7 +10,8 @@ export interface ILeafRender {
10
10
  __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
11
11
 
12
12
  __clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void
13
- __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void
13
+ __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
14
+ __drawShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
14
15
 
15
16
  __updateWorldOpacity?(): void
16
17
  __updateChange?(): void
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { IAppBase } from './app/IApp'
2
- export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator, IZoomType } from './app/ILeafer'
2
+ export { ILeaferBase, ILeaferAttrData, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator, IZoomType, IZoomOptions } from './app/ILeafer'
3
3
  export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IFlowType, IFlowBoxType, IAlign, IAxisAlign, IFlowAlign, IFlowAxisAlign, ISide, IAxis, IGap, IPointGap, IAxisReverse, IBaseLineAlign, IFlowWrap, IAutoSize, IRangeSize, IPercentData, IUnitData, IConstraint, IConstraintType, IHitType, IMaskType, IEraserType, IBlendMode, IEditSize, IImageCursor, ICursorType, IStateStyleType, IDirection, IDirection4, IAround, IFilter, ILeafAttrDescriptor, ILeafAttrDescriptorFn } from './display/ILeaf'
4
4
  export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
@@ -138,6 +138,7 @@ export interface IWheelConfig {
138
138
  }
139
139
 
140
140
  export interface IPointerConfig {
141
+ type?: 'mouse' | 'pointer' | 'touch'
141
142
  snap?: boolean // 交互操作坐标是否对齐屏幕像素,避免出现小数
142
143
 
143
144
  hitRadius?: number
@@ -11,6 +11,12 @@ export interface IRenderOptions {
11
11
  matrix?: IMatrixWithScaleData,
12
12
  inCamera?: boolean
13
13
  dimOpacity?: number
14
+ exporting?: boolean // 是否通过 export() 导出渲染
15
+
16
+ // 只渲染外形
17
+ shape?: boolean
18
+ ignoreFill?: boolean, // 绘制外形时忽略fill
19
+ ignoreStroke?: boolean // 绘制外形时忽略stroke
14
20
  }
15
21
 
16
22
  export interface IRendererConfig {
package/types/index.d.ts CHANGED
@@ -1132,6 +1132,10 @@ interface IRenderOptions {
1132
1132
  matrix?: IMatrixWithScaleData;
1133
1133
  inCamera?: boolean;
1134
1134
  dimOpacity?: number;
1135
+ exporting?: boolean;
1136
+ shape?: boolean;
1137
+ ignoreFill?: boolean;
1138
+ ignoreStroke?: boolean;
1135
1139
  }
1136
1140
  interface IRendererConfig {
1137
1141
  usePartRender?: boolean;
@@ -1214,7 +1218,8 @@ interface ILeafRender {
1214
1218
  __draw?(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
1215
1219
  __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void;
1216
1220
  __clip?(_canvas: ILeaferCanvas, _options: IRenderOptions): void;
1217
- __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void;
1221
+ __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void;
1222
+ __drawShape?(canvas: ILeaferCanvas, options: IRenderOptions): void;
1218
1223
  __updateWorldOpacity?(): void;
1219
1224
  __updateChange?(): void;
1220
1225
  }
@@ -1576,6 +1581,7 @@ interface ILeafComputedData {
1576
1581
  readonly __useNaturalRatio: boolean;
1577
1582
  readonly __isLinePath: boolean;
1578
1583
  readonly __blendMode: string;
1584
+ __useStroke?: boolean;
1579
1585
  __useArrow?: boolean;
1580
1586
  __useEffect?: boolean;
1581
1587
  __pathInputed?: number;
@@ -1745,7 +1751,8 @@ interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDa
1745
1751
  __drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void;
1746
1752
  __draw(canvas: ILeaferCanvas, options: IRenderOptions, originCanvas?: ILeaferCanvas): void;
1747
1753
  __clip(canvas: ILeaferCanvas, options: IRenderOptions): void;
1748
- __renderShape(canvas: ILeaferCanvas, options: IRenderOptions, ignoreFill?: boolean, ignoreStroke?: boolean): void;
1754
+ __renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void;
1755
+ __drawShape(canvas: ILeaferCanvas, options: IRenderOptions): void;
1749
1756
  __updateWorldOpacity(): void;
1750
1757
  __updateChange(): void;
1751
1758
  __drawPath(canvas: ILeaferCanvas): void;
@@ -1999,6 +2006,7 @@ interface IWheelConfig {
1999
2006
  preventDefault?: boolean;
2000
2007
  }
2001
2008
  interface IPointerConfig {
2009
+ type?: 'mouse' | 'pointer' | 'touch';
2002
2010
  snap?: boolean;
2003
2011
  hitRadius?: number;
2004
2012
  through?: boolean;
@@ -2081,7 +2089,7 @@ interface ILeaferAttrData {
2081
2089
  waitReady(item: IFunction, bind?: IObject): void;
2082
2090
  waitViewReady(item: IFunction, bind?: IObject): void;
2083
2091
  waitViewCompleted(item: IFunction, bind?: IObject): void;
2084
- zoom(zoomType: IZoomType, padding?: IFourNumber, fixedScale?: boolean, transition?: ITransition): IBoundsData;
2092
+ zoom(zoomType: IZoomType, optionsOrPadding?: IZoomOptions | IFourNumber, scroll?: 'x' | 'y' | boolean, transition?: ITransition): IBoundsData;
2085
2093
  getValidMove(moveX: number, moveY: number): IPointData;
2086
2094
  getValidScale(changeScale: number): number;
2087
2095
  getWorldPointByClient(clientPoint: IClientPointData, updateClient?: boolean): IPointData;
@@ -2091,6 +2099,12 @@ interface ILeaferAttrData {
2091
2099
  receiveEvent(event: any): void;
2092
2100
  }
2093
2101
  type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | ILeaf | ILeaf[] | IBoundsData;
2102
+ interface IZoomOptions {
2103
+ padding?: IFourNumber;
2104
+ scroll?: 'x' | 'y' | boolean;
2105
+ transition?: ITransition;
2106
+ origin?: IPointData | IAlign;
2107
+ }
2094
2108
  interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
2095
2109
  readonly isApp: boolean;
2096
2110
  readonly app: ILeaferBase;
@@ -2322,4 +2336,4 @@ interface ITransformer {
2322
2336
  destroy(): void;
2323
2337
  }
2324
2338
 
2325
- export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsEvent, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventOption, IEventParams, IEventParamsMap, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IWindingRuleData, IZoomConfig, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
2339
+ export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEasing, IAnimateEasingFunction, IAnimateEasingName, IAnimateEnding, IAnimateEvent, IAnimateEventFunction, IAnimateEvents, IAnimateOptions, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsEvent, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICubicBezierEasing, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, ICustomEasingFunction, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventOption, IEventParams, IEventParamsMap, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFilter, IFindCondition, IFindMethod, IFinder, IFlowAlign, IFlowAxisAlign, IFlowBoxType, IFlowType, IFlowWrap, IFourNumber, IFromToData, IFunction, IFunctionMap, IGap, IHitCanvas, IHitCanvasConfig, IHitCanvasManager, IHitType, IImageCursor, IImageEvent, IImageManager, IInteraction, IInteractionCanvas, IInteractionConfig, IJSONOptions, IKeepTouchData, IKeyEvent, ILayoutAttr, ILayoutBlockData, ILayoutBoundsData, ILayoutChangedData, ILayoutData, ILayoutEvent, ILayouter, ILayouterConfig, ILeaf, ILeafArrayMap, ILeafAttrData, ILeafAttrDescriptor, ILeafAttrDescriptorFn, ILeafBounds, ILeafBoundsModule, ILeafComputedData, ILeafData, ILeafDataOptions, ILeafDataProxy, ILeafDataProxyModule, ILeafEventer, ILeafEventerModule, ILeafHit, ILeafHitModule, ILeafInputData, ILeafLayout, ILeafLevelList, ILeafList, ILeafListItemCallback, ILeafMap, ILeafMatrix, ILeafMatrixModule, ILeafRender, ILeafRenderModule, ILeaferAttrData, ILeaferBase, ILeaferCanvas, ILeaferCanvasConfig, ILeaferCanvasView, ILeaferConfig, ILeaferEvent, ILeaferImage, ILeaferImageCacheCanvas, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded, ILeaferImagePatternPaint, ILeaferType, ILeaferTypeCreator, ILeaferTypeFunction, ILeaferTypeList, ILocationType, IMaskType, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixWithBoundsScaleData, IMatrixWithLayoutData, IMatrixWithOptionHalfData, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IOptionSizeData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPicker, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IProgressData, IProgressFunction, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IResource, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IStepsEasing, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITransformer, ITransition, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IValueFunction, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IWindingRuleData, IZoomConfig, IZoomEvent, IZoomOptions, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };