@leafer/interface 1.1.0 → 1.1.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/interface",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "@leafer/interface",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -17,7 +17,7 @@ import { IControl } from '../control/IControl'
17
17
  import { IFunction } from '../function/IFunction'
18
18
 
19
19
 
20
- export type ILeaferType = 'draw' | 'block' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom'
20
+ export type ILeaferType = 'draw' | 'block' | 'viewport' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom'
21
21
  export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
22
22
  start?: boolean
23
23
  type?: ILeaferType
@@ -55,6 +55,7 @@ export interface ILeaferAttrData {
55
55
  lazyBounds: IBounds
56
56
 
57
57
  config: ILeaferConfig
58
+ userConfig?: ILeaferConfig
58
59
 
59
60
  readonly cursorPoint: IPointData
60
61
  readonly clientBounds: IBoundsData
@@ -71,6 +72,8 @@ export interface ILeaferAttrData {
71
72
  unlockLayout(): void
72
73
  lockLayout(): void
73
74
 
75
+ requestRender(change: boolean): void
76
+
74
77
  updateCursor(cursor?: ICursorType): void
75
78
  resize(size: IScreenSizeData): void
76
79
 
@@ -94,6 +97,7 @@ export type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | numb
94
97
  export interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
95
98
  readonly isApp: boolean
96
99
  readonly app: ILeaferBase
100
+ parentApp?: IAppBase
97
101
  parent?: IAppBase
98
102
  }
99
103
 
@@ -81,7 +81,7 @@ export interface IWatchEvent extends IEvent {
81
81
  export interface IMultiTouchData {
82
82
  move: IPointData,
83
83
  scale: number,
84
- angle: number,
84
+ rotation: number,
85
85
  center: IPointData
86
86
  }
87
87
 
@@ -83,6 +83,11 @@ export interface IMoveEvent extends IDragEvent {
83
83
  moveType?: 'drag' | 'move'
84
84
  }
85
85
 
86
+ export interface IWheelEvent extends IUIEvent {
87
+ deltaX: number
88
+ deltaY: number
89
+ }
90
+
86
91
  export interface ISwipeEvent extends IDragEvent {
87
92
 
88
93
  }
package/src/index.ts CHANGED
@@ -46,10 +46,10 @@ export { IExportOptions, IJSONOptions, IExportResult, IExportResultFunction, IEx
46
46
 
47
47
  export { InnerId, IEventer, IEventMap, IEventListener, IEventOption, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
48
48
  export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IAnimateEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, IMultiTouchData, IKeepTouchData } from './event/IEvent'
49
- export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
49
+ export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IWheelEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
50
50
  export { ICursorTypeMap, ICursorRotate, ICursorRotateMap } from './interaction/ICursor'
51
51
  export { IInteraction, IInteractionCanvas, IInteractionConfig, IMoveConfig, ICursorConfig, IZoomConfig, IWheelConfig, ITouchConfig, IMultiTouchConfig, IPointerConfig } from './interaction/IInteraction'
52
-
52
+ export { ITransformer } from './interaction/ITransformer'
53
53
 
54
54
  export { INumber, IBoolean, IString, IValue, IFourNumber, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IFunctionMap, IPointDataMap, IDataTypeHandle } from './data/IData'
55
55
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
@@ -30,6 +30,8 @@ export interface IInteraction extends IControl {
30
30
  readonly isHoldSpaceKey: boolean
31
31
 
32
32
  config: IInteractionConfig
33
+ readonly m: IMoveConfig
34
+ readonly p: IPointerConfig
33
35
 
34
36
  cursor: ICursorType | ICursorType[]
35
37
  readonly hitRadius: number
@@ -113,11 +115,11 @@ export interface IMoveConfig {
113
115
  holdSpaceKey?: boolean
114
116
  holdMiddleKey?: boolean
115
117
  holdRightKey?: boolean
116
- scroll?: boolean | 'limit'
118
+ scroll?: boolean | 'x' | 'y' | 'limit' | 'x-limit' | 'y-limit'
117
119
  drag?: boolean | 'auto'
118
120
  dragAnimate?: boolean
119
121
  dragEmpty?: boolean
120
- dragOut?: boolean
122
+ dragOut?: boolean | number
121
123
  autoDistance?: number
122
124
  }
123
125
 
@@ -0,0 +1,10 @@
1
+ import { IMoveEvent, IZoomEvent, IRotateEvent } from '../event/IUIEvent'
2
+
3
+ export interface ITransformer {
4
+ readonly transforming: boolean
5
+ move(data: IMoveEvent): void
6
+ zoom(data: IZoomEvent): void
7
+ rotate(data: IRotateEvent): void
8
+ transformEnd(): void
9
+ destroy(): void
10
+ }
@@ -36,7 +36,7 @@ export interface IRenderer extends IControl {
36
36
 
37
37
  config: IRendererConfig
38
38
 
39
- update(): void
39
+ update(change?: boolean): void
40
40
 
41
41
  requestLayout(): void
42
42
 
package/types/index.d.ts CHANGED
@@ -403,7 +403,7 @@ interface IWatchEvent extends IEvent {
403
403
  interface IMultiTouchData {
404
404
  move: IPointData;
405
405
  scale: number;
406
- angle: number;
406
+ rotation: number;
407
407
  center: IPointData;
408
408
  }
409
409
  interface IKeepTouchData {
@@ -1124,7 +1124,7 @@ interface IRenderer extends IControl {
1124
1124
  changed: boolean;
1125
1125
  ignore: boolean;
1126
1126
  config: IRendererConfig;
1127
- update(): void;
1127
+ update(change?: boolean): void;
1128
1128
  requestLayout(): void;
1129
1129
  render(callback?: IFunction): void;
1130
1130
  renderAgain(): void;
@@ -1777,6 +1777,10 @@ interface IZoomEvent extends IUIEvent {
1777
1777
  interface IMoveEvent extends IDragEvent {
1778
1778
  moveType?: 'drag' | 'move';
1779
1779
  }
1780
+ interface IWheelEvent extends IUIEvent {
1781
+ deltaX: number;
1782
+ deltaY: number;
1783
+ }
1780
1784
  interface ISwipeEvent extends IDragEvent {
1781
1785
  }
1782
1786
  interface IKeyEvent extends IUIEvent {
@@ -1805,6 +1809,8 @@ interface IInteraction extends IControl {
1805
1809
  readonly isHoldRightKey: boolean;
1806
1810
  readonly isHoldSpaceKey: boolean;
1807
1811
  config: IInteractionConfig;
1812
+ readonly m: IMoveConfig;
1813
+ readonly p: IPointerConfig;
1808
1814
  cursor: ICursorType | ICursorType[];
1809
1815
  readonly hitRadius: number;
1810
1816
  bottomList?: IPickBottom[];
@@ -1866,11 +1872,11 @@ interface IMoveConfig {
1866
1872
  holdSpaceKey?: boolean;
1867
1873
  holdMiddleKey?: boolean;
1868
1874
  holdRightKey?: boolean;
1869
- scroll?: boolean | 'limit';
1875
+ scroll?: boolean | 'x' | 'y' | 'limit' | 'x-limit' | 'y-limit';
1870
1876
  drag?: boolean | 'auto';
1871
1877
  dragAnimate?: boolean;
1872
1878
  dragEmpty?: boolean;
1873
- dragOut?: boolean;
1879
+ dragOut?: boolean | number;
1874
1880
  autoDistance?: number;
1875
1881
  }
1876
1882
  interface IWheelConfig {
@@ -1919,7 +1925,7 @@ interface IHitCanvasManager extends ICanvasManager {
1919
1925
  interface IZoomView extends IBranch {
1920
1926
  }
1921
1927
 
1922
- type ILeaferType = 'draw' | 'block' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom';
1928
+ type ILeaferType = 'draw' | 'block' | 'viewport' | 'editor' | 'design' | 'board' | 'document' | 'app' | 'website' | 'game' | 'player' | 'chart' | 'custom';
1923
1929
  interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
1924
1930
  start?: boolean;
1925
1931
  type?: ILeaferType;
@@ -1948,6 +1954,7 @@ interface ILeaferAttrData {
1948
1954
  autoLayout?: IAutoBounds;
1949
1955
  lazyBounds: IBounds;
1950
1956
  config: ILeaferConfig;
1957
+ userConfig?: ILeaferConfig;
1951
1958
  readonly cursorPoint: IPointData;
1952
1959
  readonly clientBounds: IBoundsData;
1953
1960
  leafs: number;
@@ -1958,6 +1965,7 @@ interface ILeaferAttrData {
1958
1965
  stop(): void;
1959
1966
  unlockLayout(): void;
1960
1967
  lockLayout(): void;
1968
+ requestRender(change: boolean): void;
1961
1969
  updateCursor(cursor?: ICursorType): void;
1962
1970
  resize(size: IScreenSizeData): void;
1963
1971
  waitReady(item: IFunction, bind?: IObject): void;
@@ -1975,6 +1983,7 @@ type IZoomType = 'in' | 'out' | 'fit' | 'fit-width' | 'fit-height' | number | IL
1975
1983
  interface ILeaferBase extends IZoomView, IControl, ILeaferAttrData {
1976
1984
  readonly isApp: boolean;
1977
1985
  readonly app: ILeaferBase;
1986
+ parentApp?: IAppBase;
1978
1987
  parent?: IAppBase;
1979
1988
  }
1980
1989
  interface ILeaferTypeCreator {
@@ -2180,4 +2189,13 @@ interface ICursorRotateMap {
2180
2189
  [name: string]: ICursorRotate;
2181
2190
  }
2182
2191
 
2183
- export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, 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, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWindingRule, IZoomConfig, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };
2192
+ interface ITransformer {
2193
+ readonly transforming: boolean;
2194
+ move(data: IMoveEvent): void;
2195
+ zoom(data: IZoomEvent): void;
2196
+ rotate(data: IRotateEvent): void;
2197
+ transformEnd(): void;
2198
+ destroy(): void;
2199
+ }
2200
+
2201
+ export type { ACommandData, ArcCommandData, ArcToCommandData, BezierCurveToCommandObject, CCommandData, CanvasPathCommand, EllipseCommandData, HCommandData, IAlign, IAnimateEvent, IAnswer, IAppBase, IAround, IAttrDecorator, IAutoBounds, IAutoBoundsData, IAutoBoxData, IAutoSize, IAxis, IAxisAlign, IAxisReverse, IBaseLineAlign, IBlendMode, IBlob, IBlobFunction, IBoolean, IBooleanMap, IBounds, IBoundsData, IBoundsDataFn, IBoundsType, IBranch, IBranchRender, IBranchRenderModule, ICachedLeaf, ICanvasAttr, ICanvasCacheOptions, ICanvasContext2D, ICanvasContext2DSettings, ICanvasManager, ICanvasPattern, ICanvasStrokeOptions, ICanvasType, IChildEvent, IClientPointData, IConstraint, IConstraintType, IControl, ICreator, ICursorConfig, ICursorRotate, ICursorRotateMap, ICursorType, ICursorTypeMap, IDataProcessor, IDataTypeHandle, IDirection, IDirection4, IDragEvent, IDropEvent, IEditSize, IEraserType, IEvent, IEventListener, IEventListenerId, IEventListenerItem, IEventListenerMap, IEventListenerOptions, IEventMap, IEventOption, IEventTarget, IEventer, IExportFileType, IExportImageType, IExportOnCanvasFunction, IExportOptions, IExportResult, IExportResultFunction, IFindCondition, IFindMethod, 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, IMatrixWithOptionScaleData, IMatrixWithScaleData, IMiniapp, IMiniappSelect, IMiniappSizeView, IMotionPathData, IMoveConfig, IMoveEvent, IMultiTouchConfig, IMultiTouchData, INumber, INumberFunction, INumberMap, IObject, IObjectFunction, IOffsetBoundsData, IPartLayoutConfig, IPath2D, IPathCommandData, IPathCommandObject, IPathCreator, IPathDrawer, IPathString, IPercentData, IPickBottom, IPickOptions, IPickResult, IPlatform, IPlugin, IPoint, IPointData, IPointDataFunction, IPointDataMap, IPointGap, IPointerConfig, IPointerEvent, IPropertyEvent, IRadiusPointData, IRangeSize, IRenderEvent, IRenderOptions, IRenderer, IRendererConfig, IResizeEvent, IResizeEventListener, IRotateEvent, IRotationPointData, IScaleData, IScaleRotationData, IScreenSizeData, IScrollPointData, ISelector, ISelectorConfig, ISelectorProxy, ISide, ISize, ISizeData, ISkewData, ISkiaCanvas, ISkiaCanvasExportConfig, ISkiaNAPICanvas, IStateStyleType, IString, IStringFunction, IStringMap, ISwipeEvent, ITaskItem, ITaskOptions, ITaskProcessor, ITaskProcessorConfig, ITextMetrics, ITimer, ITouchConfig, ITransformer, ITwoPointBoundsData, IUICreator, IUIEvent, IUnitData, IUnitPointData, IUpdateEvent, IValue, IWatchEvent, IWatchEventData, IWatcher, IWatcherConfig, IWheelConfig, IWheelEvent, IWindingRule, IZoomConfig, IZoomEvent, IZoomType, IZoomView, InnerId, LCommandData, LineToCommandObject, MCommandData, MoveToCommandObject, PointerType, QCommandData, QuadraticCurveToCommandObject, RectCommandData, RoundRectCommandData, SCommandData, TCommandData, VCommandData, ZCommandData };