@leafer/interface 1.0.0-alpha.9 → 1.0.0-beta

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.
@@ -4,8 +4,7 @@ import { __Value } from '../../data/IData'
4
4
  export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
5
5
 
6
6
  export interface ILeafDataProxy {
7
- __set?(attrName: string, newValue: __Value): void
8
- __get?(attrName: string): __Value
9
- __updateAttr?(attrName: string): void
7
+ __setAttr?(name: string, newValue: __Value): void
8
+ __getAttr?(name: string): __Value
10
9
  }
11
10
 
@@ -9,8 +9,8 @@ export type ILeafEventerModule = ILeafEventer & ThisType<ILeaf>
9
9
  export interface ILeafEventer {
10
10
  on?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
11
11
  off?(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
12
- on__?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
13
- off__?(id: IEventListenerId | IEventListenerId[]): void
12
+ on_?(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
13
+ off_?(id: IEventListenerId | IEventListenerId[]): void
14
14
  once?(type: string | string[], listener: IEventListener, capture?: boolean): void
15
15
  emit?(type: string, event?: IEvent | IObject, capture?: boolean): void
16
16
  emitEvent?(event?: IEvent, capture?: boolean): void
@@ -1,10 +1,12 @@
1
1
  import { IRadiusPointData } from '../../math/IMath'
2
2
  import { ILeaf } from '../ILeaf'
3
+ import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
3
4
 
4
5
  export type ILeafHitModule = ILeafHit & ThisType<ILeaf>
5
6
 
6
7
  export interface ILeafHit {
7
8
  __hitWorld?(point: IRadiusPointData): boolean
8
9
  __hit?(local: IRadiusPointData): boolean
10
+ __drawHitPath?(canvas: ILeaferCanvas): void
9
11
  __updateHitCanvas?(): void
10
12
  }
@@ -0,0 +1,11 @@
1
+ import { ILeaf } from '../ILeaf'
2
+ import { ILeaferCanvas } from '../../canvas/ILeaferCanvas'
3
+
4
+ export type ILeafMaskModule = ILeafMask & ThisType<ILeaf>
5
+
6
+ export interface ILeafMask {
7
+ __updateMask?(value?: boolean): void
8
+ __renderMask?(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
9
+ __removeMask?(child?: ILeaf): void
10
+ }
11
+
@@ -4,5 +4,5 @@ export type ILeafMatrixModule = ILeafMatrix & ThisType<ILeaf>
4
4
 
5
5
  export interface ILeafMatrix {
6
6
  __updateWorldMatrix?(): void
7
- __updateRelativeMatrix?(): void
7
+ __updateLocalMatrix?(): void
8
8
  }
@@ -6,11 +6,10 @@ export type ILeafRenderModule = ILeafRender & ThisType<ILeaf>
6
6
 
7
7
  export interface ILeafRender {
8
8
  __render?(canvas: ILeaferCanvas, options: IRenderOptions): void
9
- __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
10
9
  __draw?(canvas: ILeaferCanvas, options: IRenderOptions): void
10
+ __drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
11
11
 
12
- __drawBefore?(canvas: ILeaferCanvas, options: IRenderOptions): void
13
- __drawAfter?(canvas: ILeaferCanvas, options: IRenderOptions): void
12
+ __renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
14
13
 
15
14
  __updateWorldOpacity?(): void
16
15
  __updateChange?(): void
@@ -24,6 +24,10 @@ export interface IEventTarget extends IEventer {
24
24
 
25
25
  }
26
26
 
27
+ export interface ILeaferEvent {
28
+
29
+ }
30
+
27
31
  export interface IRenderEvent {
28
32
 
29
33
  }
@@ -52,7 +56,7 @@ export interface IUpdateEvent extends IEvent {
52
56
 
53
57
  }
54
58
 
55
- export interface IAttrEvent extends IEvent {
59
+ export interface IPropertyEvent extends IEvent {
56
60
  readonly attrName: string
57
61
  readonly oldValue: unknown
58
62
  readonly newValue: unknown
@@ -60,6 +64,7 @@ export interface IAttrEvent extends IEvent {
60
64
 
61
65
  export interface ILayoutEvent extends IEvent {
62
66
  readonly data: ILayoutBlockData[]
67
+ readonly times: number
63
68
  }
64
69
 
65
70
  export interface IWatchEvent extends IEvent {
@@ -32,8 +32,8 @@ export interface IEventer extends ILeafEventer {
32
32
 
33
33
  on(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
34
34
  off(type: string | string[], listener: IEventListener, options?: IEventListenerOptions | boolean): void
35
- on__(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
36
- off__(id: IEventListenerId | IEventListenerId[]): void
35
+ on_(type: string | string[], listener: IEventListener, bind?: IObject, options?: IEventListenerOptions | boolean): IEventListenerId
36
+ off_(id: IEventListenerId | IEventListenerId[]): void
37
37
  once(type: string | string[], listener: IEventListener): void
38
38
  emit(type: string, event?: IEvent | IObject, capture?: boolean): void
39
39
  emitEvent(event?: IEvent, capture?: boolean): void
@@ -1,5 +1,7 @@
1
+ import { IObject } from '../data/IData'
1
2
  import { ILeafList } from '../data/IList'
2
3
  import { IEvent } from './IEvent'
4
+ import { ILeaferImage } from '../image/ILeaferImage'
3
5
 
4
6
  export interface IUIEvent extends IEvent {
5
7
  x: number
@@ -19,6 +21,8 @@ export interface IUIEvent extends IEvent {
19
21
  path: ILeafList
20
22
  throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
21
23
 
24
+ origin: IObject
25
+
22
26
  stopDefault(): void
23
27
  stopNow(): void
24
28
  stop(): void
@@ -46,6 +50,7 @@ export interface IDragEvent extends IPointerEvent {
46
50
 
47
51
  export interface IDropEvent extends IPointerEvent {
48
52
  list: ILeafList
53
+ data?: IObject
49
54
  }
50
55
 
51
56
  export interface IRotateEvent extends IUIEvent {
@@ -66,4 +71,9 @@ export interface ISwipeEvent extends IDragEvent {
66
71
 
67
72
  export interface IKeyEvent extends IUIEvent {
68
73
 
74
+ }
75
+
76
+ export interface IImageEvent extends IEvent {
77
+ image: ILeaferImage
78
+ error: string | IObject
69
79
  }
@@ -1,3 +1,7 @@
1
+ import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
2
+
3
+
1
4
  export interface IImageManager {
5
+ get(config: ILeaferImageConfig): ILeaferImage
2
6
  destory(): void
3
7
  }
@@ -1,8 +1,25 @@
1
+ import { IObject } from '../data/IData'
2
+
1
3
  export interface ILeaferImageConfig {
2
4
  url: string
3
5
  thumb?: string
4
6
  }
5
7
 
8
+ export interface ILeaferImageOnLoaded {
9
+ (image?: ILeaferImage): any
10
+ }
11
+
12
+ export interface ILeaferImageOnError {
13
+ (error?: string | IObject, image?: ILeaferImage): any
14
+ }
15
+
6
16
  export interface ILeaferImage {
17
+ view: unknown
18
+ width: number
19
+ height: number
20
+ ready: boolean
21
+ load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): void
22
+ getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown
23
+ }
7
24
 
8
- }
25
+ export type IImageStatus = 'wait' | 'thumb-loading' | 'thumb-success' | 'thumb-error' | 'loading' | 'success' | 'error'
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { ISupperLeafer } from './app/ISupperLeafer'
2
- export { ILeafer, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
3
- export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf } from './display/ILeaf'
1
+ export { IApp } from './app/IApp'
2
+ export { ILeafer, ILeaferType, ILeaferTypeFunction, ILeaferTypeList, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
3
+ export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf, IHitType, IBlendMode } from './display/ILeaf'
4
4
  export { IBranch } from './display/IBranch'
5
5
  export { IZoomView } from './display/IView'
6
6
 
@@ -14,35 +14,37 @@ export { ILeafBounds, ILeafBoundsModule } from './display/module/ILeafBounds'
14
14
  export { ILeafHit, ILeafHitModule } from './display/module/ILeafHit'
15
15
  export { ILeafRender, ILeafRenderModule } from './display/module/ILeafRender'
16
16
  export { ILeafEventer, ILeafEventerModule } from './display/module/ILeafEventer'
17
+ export { ILeafMask, ILeafMaskModule } from './display/module/ILeafMask'
17
18
 
18
19
  export { IRenderer, IRendererConfig, IRenderOptions } from './renderer/IRenderer'
19
20
  export { IWatcher, IWatchEventData, IWatcherConfig } from './watcher/IWatcher'
20
21
  export { ILayouter, ILayoutChangedData, ILayoutBlockData, ILayouterConfig, IPartLayoutConfig } from './layouter/ILayouter'
21
- export { ISelector, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
22
+ export { ISelector, ISelectorConfig, ISelectPathResult, ISelectPathOptions } from './selector/ISelector'
22
23
 
23
24
  export { ICanvasManager } from './canvas/ICanvasManager'
24
25
  export { IHitCanvasManager } from './canvas/IHitCanvasManager'
25
26
  export { IImageManager } from './image/IImageManager'
26
27
 
27
28
 
29
+ export { IControl } from './control/IControl'
28
30
  export { IPlatform } from './platform/IPlatform'
29
31
  export { IPlugin } from './plugin/IPlugin'
30
32
 
31
33
 
32
34
  export { ILeaferCanvas, IHitCanvas, ICanvasAttr, ICanvasStrokeOptions, ILeaferCanvasConfig, IHitCanvasConfig } from './canvas/ILeaferCanvas'
33
- export { IPathDrawer } from './path/IPathDrawer'
35
+ export { IPathDrawer, IPathCreator } from './path/IPathDrawer'
34
36
  export { IWindingRule, ICanvasContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'
35
37
  export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
36
38
 
37
- export { ILeaferImage, ILeaferImageConfig } from './image/ILeaferImage'
39
+ export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnError } from './image/ILeaferImage'
38
40
 
39
41
  export { InnerId, IEventer, IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
40
- export { IEventTarget, IEvent, IAttrEvent, ILayoutEvent, IRenderEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode } from './event/IEvent'
41
- export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent } from './event/IUIEvent'
42
- export { IInteraction, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
42
+ export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, ILayoutEvent, IRenderEvent, IChildEvent, IResizeEvent, IResizeEventListener, IUpdateEvent, IWatchEvent, ITransformEvent, ITransformEventData, TransformMode } from './event/IEvent'
43
+ export { IUIEvent, IPointerEvent, PointerType, IDragEvent, IDropEvent, ISwipeEvent, IMoveEvent, IZoomEvent, IRotateEvent, IKeyEvent, IImageEvent } from './event/IUIEvent'
44
+ export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
43
45
 
44
46
 
45
- export { __Number, __Boolean, __String, __Object, __Value, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
47
+ export { __Number, __Boolean, __String, __Object, __Value, IPathString, ITimer, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
46
48
  export { ILeafList, ILeafArrayMap, ILeafMap, ILeafLevelList, ILeafListItemCallback } from './data/IList'
47
- export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData } from './math/IMath'
49
+ export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixDecompositionData, IMatrixDecompositionAttr } from './math/IMath'
48
50
  export { IFunction } from './function/IFunction'
@@ -1,20 +1,31 @@
1
1
  import { INumberFunction, IPointDataFunction } from '../function/IFunction'
2
- import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent } from '../event/IUIEvent'
2
+ import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent, IUIEvent } from '../event/IUIEvent'
3
3
  import { ILeaf } from '../display/ILeaf'
4
+ import { ILeafList } from '../data/IList'
4
5
  import { IPointData } from '../math/IMath'
6
+ import { ISelector } from '../selector/ISelector'
7
+ import { IBounds } from '../math/IMath'
8
+ import { IControl } from '../control/IControl'
5
9
 
6
- export interface IInteraction {
10
+ export interface IInteraction extends IControl {
7
11
  target: ILeaf
8
- config: IInteractionConfig
12
+ canvas: IInteractionCanvas
13
+ selector: ISelector
14
+
9
15
  running: boolean
16
+ readonly dragging: boolean
10
17
 
11
- pointerMoveIgnore: boolean
18
+ config: IInteractionConfig
12
19
 
13
- start(): void
14
- stop(): void
20
+ readonly hitRadius: number
21
+ shrinkCanvasBounds: IBounds
22
+
23
+ downData: IPointerEvent
24
+ downTime: number
15
25
 
16
26
  pointerDown(data: IPointerEvent): void
17
27
  pointerMove(data: IPointerEvent): void
28
+ pointerMoveReal(data: IPointerEvent): void
18
29
  pointerUp(data: IPointerEvent): void
19
30
  pointerCancel(): void
20
31
 
@@ -22,13 +33,30 @@ export interface IInteraction {
22
33
  zoom(data: IZoomEvent): void
23
34
  rotate(data: IRotateEvent): void
24
35
 
25
- destroy(): void
36
+ emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
37
+ }
38
+
39
+ export interface IInteractionCanvas {
40
+ bounds: IBounds
41
+ view: unknown
26
42
  }
27
43
 
28
44
  export interface IInteractionConfig {
29
45
  wheel?: IWheelConfig
30
46
  pointer?: IPointerConfig
47
+ zoom?: IZoomConfig
48
+ move?: IMoveConfig
49
+ }
50
+
51
+ export interface IZoomConfig {
52
+ min?: number
53
+ max?: number
54
+ }
31
55
 
56
+ export interface IMoveConfig {
57
+ dragEmpty?: boolean
58
+ dragOut?: boolean
59
+ autoDistance?: number
32
60
  }
33
61
 
34
62
  export interface IWheelConfig {
@@ -36,18 +64,22 @@ export interface IWheelConfig {
36
64
  zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
37
65
  moveSpeed?: number
38
66
  rotateSpeed?: number // 取值范围 0 ~ 1, 默认0.5
39
- delta?: IPointData
67
+ delta?: IPointData // 以chrome为基准, 鼠标滚动一格的距离
40
68
  getScale?: INumberFunction
41
69
  getMove?: IPointDataFunction
70
+ preventDefault?: boolean
42
71
  }
43
72
 
44
73
  export interface IPointerConfig {
45
74
  hitRadius?: number
46
75
  through?: boolean
47
- clickTime?: number
76
+ tapMore?: boolean
77
+ tapTime?: number
48
78
  longPressTime?: number
49
79
  transformTime?: number
80
+ dragHover?: boolean
50
81
  dragDistance?: number
51
82
  swipeDistance?: number
52
- autoMoveDistance?: number
83
+ ignoreMove?: boolean // 性能优化字段, 控制move事件触发次数
84
+ preventDefault?: boolean
53
85
  }
@@ -1,8 +1,8 @@
1
- import { IBoundsData, IMatrixData } from '../math/IMath'
1
+ import { IBoundsData, IMatrixData, IMatrixDecompositionData } from '../math/IMath'
2
2
  import { ILeaf } from '../display/ILeaf'
3
3
 
4
- export type ILayoutLocationType = 'world' | 'relative' | 'local'
5
- export type ILayoutBoundsType = 'content' | 'box' | 'event' | 'margin' | 'render'
4
+ export type ILayoutLocationType = 'world' | 'local' | 'inner'
5
+ export type ILayoutBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render'
6
6
 
7
7
  export interface ILeafLayout {
8
8
 
@@ -13,23 +13,23 @@ export interface ILeafLayout {
13
13
  // local
14
14
 
15
15
  boxBounds: IBoundsData // | content + padding |
16
- eventBounds: IBoundsData // | boxBounds + border |
17
- renderBounds: IBoundsData // | eventBounds + shadow |
16
+ strokeBounds: IBoundsData // | boxBounds + border |
17
+ renderBounds: IBoundsData // | strokeBounds + shadow |
18
18
 
19
19
  // auto layout
20
- marginBounds: IBoundsData // | eventBounds + margin |
20
+ marginBounds: IBoundsData // | strokeBounds + margin |
21
21
  contentBounds: IBoundsData // | content |
22
22
 
23
- // relative
23
+ // local
24
24
 
25
- //relativeBoxBounds: IBoundsData = leaf.__local
26
- relativeEventBounds: IBoundsData
27
- relativeRenderBounds: IBoundsData
25
+ //localBoxBounds: IBoundsData = leaf.__local
26
+ localStrokeBounds: IBoundsData
27
+ localRenderBounds: IBoundsData
28
28
 
29
29
  // state
30
30
 
31
31
  // matrix changed
32
- matrixChanged: boolean
32
+ matrixChanged: boolean // include positionChanged scaleChanged skewChanged
33
33
  positionChanged: boolean // x, y
34
34
  scaleChanged: boolean // scaleX scaleY
35
35
  rotationChanged: boolean // rotaiton, skewX scaleY 数据更新
@@ -37,11 +37,11 @@ export interface ILeafLayout {
37
37
  // bounds changed
38
38
  boundsChanged: boolean
39
39
 
40
- boxBoundsChanged: boolean
41
- eventBoundsChanged: boolean
42
- renderBoundsChanged: boolean
40
+ boxChanged: boolean
41
+ strokeChanged: boolean
42
+ renderChanged: boolean
43
43
 
44
- localBoxBoundsChanged: boolean // position
44
+ localBoxChanged: boolean // position
45
45
 
46
46
  // face changed
47
47
  surfaceChanged: boolean
@@ -54,25 +54,29 @@ export interface ILeafLayout {
54
54
  // keep state
55
55
  affectScaleOrRotation: boolean
56
56
  affectRotation: boolean
57
- eventBoundsSpreadWidth: number
58
- renderBoundsSpreadWidth: number
59
- renderShapeBoundsSpreadWidth: number
60
57
 
61
- update(): void
58
+ strokeSpread: number
59
+ renderSpread: number
60
+ strokeBoxSpread: number
61
+ renderShapeSpread: number
62
+
63
+ checkUpdate(): void
62
64
 
63
- getTransform(type: ILayoutLocationType): IMatrixData
64
- getBounds(type: ILayoutLocationType, boundsType: ILayoutBoundsType): IBoundsData
65
+ getTransform(locationType: ILayoutLocationType): IMatrixData
66
+ decomposeTransform(locationType: ILayoutLocationType): IMatrixDecompositionData
67
+ getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType): IBoundsData
65
68
 
66
69
  // 独立 / 引用 boxBounds
67
- eventBoundsSpread(): void
68
- renderBoundsSpread(): void
69
- eventBoundsSpreadCancel(): void
70
- renderBoundsSpreadCancel(): void
70
+ spreadStroke(): void
71
+ spreadRender(): void
72
+ spreadStrokeCancel(): void
73
+ spreadRenderCancel(): void
71
74
 
72
75
  // bounds
73
- boxBoundsChange(): void
74
- eventBoundsChange(): void
75
- renderBoundsChange(): void
76
+ boxChange(): void
77
+ localBoxChange(): void
78
+ strokeChange(): void
79
+ renderChange(): void
76
80
 
77
81
  // matrix
78
82
  positionChange(): void
@@ -1,6 +1,7 @@
1
1
  import { IBounds } from '../math/IMath'
2
2
  import { ILeaf } from '../display/ILeaf'
3
3
  import { ILeafList } from '../data/IList'
4
+ import { IControl } from '../control/IControl'
4
5
 
5
6
  export interface ILayoutChangedData {
6
7
  matrixList: ILeaf[]
@@ -30,23 +31,30 @@ export interface ILayouterConfig {
30
31
  partLayout?: IPartLayoutConfig
31
32
  }
32
33
 
33
- export interface ILayouter {
34
+ export interface ILayouter extends IControl {
34
35
  target: ILeaf
35
36
  layoutedBlocks: ILayoutBlockData[]
37
+
36
38
  totalTimes: number
37
39
  times: number
38
- config: ILayouterConfig
40
+
41
+ disabled: boolean
39
42
  running: boolean
43
+ layouting: boolean
40
44
 
41
- start(): void
42
- stop(): void
45
+ waitAgain: boolean
43
46
 
44
- createBlock(data: ILeafList | ILeaf[]): ILayoutBlockData
45
- getBlocks(list: ILeafList): ILayoutBlockData[]
46
- setBlocks(current: ILayoutBlockData[]): void
47
+ config: ILayouterConfig
48
+
49
+ disable(): void
47
50
 
48
51
  layout(): void
52
+ layoutAgain(): void
53
+ layoutOnce(): void
49
54
  partLayout(): void
50
55
  fullLayout(): void
51
- destroy(): void
56
+
57
+ createBlock(data: ILeafList | ILeaf[]): ILayoutBlockData
58
+ getBlocks(list: ILeafList): ILayoutBlockData[]
59
+ addBlocks(current: ILayoutBlockData[]): void
52
60
  }
package/src/math/IMath.ts CHANGED
@@ -10,15 +10,17 @@ export interface IPoint extends IPointData {
10
10
  copy(point: IPointData): IPoint
11
11
  clone(): IPoint
12
12
 
13
- rotate(angle: number, center?: IPointData): void
13
+ rotate(angle: number, center?: IPointData): IPoint
14
14
 
15
- toLocal(matrix: IMatrixData): void
16
- toWorld(matrix: IMatrixData): void
15
+ toInnerOf(matrix: IMatrixData, to?: IPointData): IPoint
16
+ toOuterOf(matrix: IMatrixData, to?: IPointData): IPoint
17
17
 
18
18
  getCenter(to: IPointData): IPointData
19
19
  getDistance(to: IPointData): number
20
20
  getAngle(to: IPointData): number
21
21
  getAtan2(to: IPointData): number
22
+
23
+ reset(): void
22
24
  }
23
25
 
24
26
  export interface IRadiusPointData extends IPointData {
@@ -54,31 +56,31 @@ export interface IBounds extends IBoundsData {
54
56
  copy(bounds: IBoundsData): IBounds
55
57
  clone(): IBounds
56
58
 
57
- timesMatrix(matrix: IMatrixData): IBounds
58
- divideMatrix(matrix: IMatrixData): IBounds
59
+ scale(scale: number): IBounds
60
+ toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds
59
61
  getFitMatrix(put: IBoundsData): IMatrix
60
- spread(size: number): void
61
- ceil(): void
62
62
 
63
- add(bounds: IBoundsData): void
64
- addList(boundsList: IBounds[]): void
65
- setByList(boundsList: IBounds[], addMode?: boolean): void
66
- addListWithHandle(list: IObject[], boundsDataHandle: IBoundsDataHandle): void
67
- setByListWithHandle(list: IObject[], boundsDataHandle: IBoundsDataHandle, addMode: boolean): void
68
- setByBoundsTimesMatrix(fromBounds: IBoundsData, fromMatrix: IMatrixData): void
69
- setByPoints(points: IPointData[]): void
63
+ spread(size: number): IBounds
64
+ ceil(): IBounds
65
+
66
+ add(bounds: IBoundsData): IBounds
67
+ addList(boundsList: IBounds[]): IBounds
68
+ setByList(boundsList: IBounds[], addMode?: boolean): IBounds
69
+ addListWithHandle(list: IObject[], boundsDataHandle: IBoundsDataHandle): IBounds
70
+ setByListWithHandle(list: IObject[], boundsDataHandle: IBoundsDataHandle, addMode: boolean): IBounds
71
+ setByPoints(points: IPointData[]): IBounds
70
72
 
71
73
  hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean
72
74
  hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixData): boolean
73
75
  hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
74
76
  includes(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
75
77
 
78
+ intersect(bounds: IBoundsData, boundsMatrix?: IMatrixData): IBounds
76
79
  getIntersect(bounds: IBoundsData, boundsMatrix?: IMatrixData): IBounds
77
- setByIntersect(bounds: IBoundsData, boundsMatrix?: IMatrixData): void
78
80
 
79
81
  isSame(bounds: IBoundsData): boolean
80
82
  isEmpty(): boolean
81
- empty(): void
83
+ reset(): void
82
84
  }
83
85
 
84
86
  export interface ITwoPointBoundsData {
@@ -90,6 +92,7 @@ export interface ITwoPointBoundsData {
90
92
 
91
93
  export interface ITwoPointBounds extends ITwoPointBoundsData {
92
94
  addPoint(x: number, y: number): void
95
+ addBounds(x: number, y: number, width: number, height: number): void
93
96
  add(pointBounds: ITwoPointBoundsData): void
94
97
  }
95
98
 
@@ -120,21 +123,57 @@ export interface IMatrixData {
120
123
  e: number
121
124
  f: number
122
125
  }
126
+
127
+ export interface IMatrixDecompositionData {
128
+ x: number
129
+ y: number
130
+ scaleX: number
131
+ scaleY: number
132
+ rotation: number
133
+ skewX: number
134
+ skewY: number
135
+ }
136
+
137
+ export type IMatrixDecompositionAttr =
138
+ | 'x'
139
+ | 'y'
140
+ | 'scaleX'
141
+ | 'scaleY'
142
+ | 'rotation'
143
+ | 'skewX'
144
+ | 'skewY'
145
+
123
146
  export interface IMatrix extends IMatrixData {
124
147
  set(a: number, b: number, c: number, d: number, e: number, f: number): void
125
148
  copy(matrix: IMatrixData): IMatrix
126
149
  clone(): IMatrix
127
150
 
128
151
  translate(x: number, y: number): IMatrix
152
+ translateInner(x: number, y: number): IMatrix
153
+
129
154
  scale(x: number, y?: number): IMatrix
155
+ scaleOf(center: IPointData, x: number, y?: number): IMatrix
156
+ scaleOfInner(center: IPointData, x: number, y?: number): IMatrix
157
+
130
158
  rotate(angle: number): IMatrix
159
+ rotateOf(center: IPointData, angle: number): IMatrix
160
+ rotateOfInner(center: IPointData, angle: number): IMatrix
161
+
162
+ skew(x: number, y?: number): IMatrix
163
+ skewOf(center: IPointData, x: number, y?: number): IMatrix
164
+ skewOfInner(center: IPointData, x: number, y?: number): IMatrix
165
+
166
+ multiply(matrix: IMatrixData): IMatrix
167
+ divide(matrix: IMatrixData): IMatrix
168
+ preMultiply(matrix: IMatrixData): IMatrix
169
+ invert(): IMatrix
170
+
171
+ toOuterPoint(inner: IPointData, to?: IPointData): void
172
+ toInnerPoint(outer: IPointData, to?: IPointData): void
131
173
 
132
- times(matrix: IMatrixData): void
133
- divide(matrix: IMatrixData): void
134
- invert(): void
174
+ decompose(): IMatrixDecompositionData
135
175
 
136
- toWorldPoint(local: IPointData, world?: IPointData): void
137
- toLocalPoint(world: IPointData, local?: IPointData): void
176
+ reset(): void
138
177
  }
139
178
 
140
179
 
@@ -34,14 +34,14 @@ type height = number
34
34
  type rotation = number
35
35
  type startAngle = number
36
36
  type endAngle = number
37
- type counterclockwise = boolean
37
+ type anticlockwise = boolean
38
38
  type cornerRadius = number | number[]
39
39
  type radius = number
40
40
 
41
41
  export type RectCommandData = [Command, x, y, width, height]
42
42
  export type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]
43
- export type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise]
44
- export type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, counterclockwise]
43
+ export type EllipseCommandData = [Command, x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise]
44
+ export type ArcCommandData = [Command, x, y, radius, startAngle, endAngle, anticlockwise]
45
45
  export type ArcToCommandData = [Command, x1, y1, x2, y2, radius]
46
46
 
47
47