@leafer/interface 1.0.0-beta.12 → 1.0.0-beta.15
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 +4 -2
- package/src/index.ts +2 -2
- package/types/index.d.ts +1672 -0
- package/src/app/IApp.ts +0 -6
- package/src/app/ILeafer.ts +0 -96
- package/src/canvas/ICanvas.ts +0 -334
- package/src/canvas/ICanvasManager.ts +0 -10
- package/src/canvas/IHitCanvasManager.ts +0 -9
- package/src/canvas/ILeaferCanvas.ts +0 -198
- package/src/canvas/ISkiaCanvas.ts +0 -20
- package/src/control/IControl.ts +0 -5
- package/src/data/IData.ts +0 -29
- package/src/data/ILeafData.ts +0 -27
- package/src/data/IList.ts +0 -45
- package/src/display/IBranch.ts +0 -9
- package/src/display/ILeaf.ts +0 -295
- package/src/display/IView.ts +0 -10
- package/src/display/module/IBranchRender.ts +0 -10
- package/src/display/module/ILeafBounds.ts +0 -21
- package/src/display/module/ILeafDataProxy.ts +0 -10
- package/src/display/module/ILeafEventer.ts +0 -18
- package/src/display/module/ILeafHit.ts +0 -12
- package/src/display/module/ILeafMask.ts +0 -12
- package/src/display/module/ILeafMatrix.ts +0 -8
- package/src/display/module/ILeafRender.ts +0 -16
- package/src/event/IEvent.ts +0 -111
- package/src/event/IEventer.ts +0 -43
- package/src/event/IUIEvent.ts +0 -85
- package/src/file/IFileType.ts +0 -2
- package/src/function/IFunction.ts +0 -13
- package/src/image/IImageManager.ts +0 -18
- package/src/image/ILeaferImage.ts +0 -41
- package/src/interaction/IInteraction.ts +0 -92
- package/src/layout/ILeafLayout.ts +0 -95
- package/src/layouter/ILayouter.ts +0 -60
- package/src/math/IMath.ts +0 -183
- package/src/path/IPathCommand.ts +0 -50
- package/src/path/IPathDrawer.ts +0 -36
- package/src/platform/IPlatform.ts +0 -47
- package/src/plugin/IPlugin.ts +0 -10
- package/src/renderer/IRenderer.ts +0 -53
- package/src/selector/ISelector.ts +0 -35
- package/src/task/ITaskProcessor.ts +0 -44
- package/src/watcher/IWatcher.ts +0 -30
package/src/event/IUIEvent.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { IObject } from '../data/IData'
|
|
2
|
-
import { ILeafList } from '../data/IList'
|
|
3
|
-
import { IEvent } from './IEvent'
|
|
4
|
-
import { ILeaferImage } from '../image/ILeaferImage'
|
|
5
|
-
import { ILeaf } from '../display/ILeaf'
|
|
6
|
-
import { IPointData } from '../math/IMath'
|
|
7
|
-
|
|
8
|
-
export interface IUIEvent extends IEvent {
|
|
9
|
-
x: number
|
|
10
|
-
y: number
|
|
11
|
-
|
|
12
|
-
altKey?: boolean
|
|
13
|
-
ctrlKey?: boolean
|
|
14
|
-
shiftKey?: boolean
|
|
15
|
-
metaKey?: boolean
|
|
16
|
-
readonly spaceKey?: boolean
|
|
17
|
-
|
|
18
|
-
readonly left?: boolean
|
|
19
|
-
readonly right?: boolean
|
|
20
|
-
readonly middle?: boolean
|
|
21
|
-
buttons?: number
|
|
22
|
-
|
|
23
|
-
path?: ILeafList
|
|
24
|
-
throughPath?: ILeafList // 穿透path,不受层级影响,从上到下只要碰撞到区域就算,一般点击的时候
|
|
25
|
-
|
|
26
|
-
origin?: IObject
|
|
27
|
-
|
|
28
|
-
getInner?(target?: ILeaf): IPointData
|
|
29
|
-
getLocal?(target?: ILeaf): IPointData
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
export interface IPointerEvent extends IUIEvent {
|
|
34
|
-
width?: number
|
|
35
|
-
height?: number
|
|
36
|
-
pointerType?: PointerType
|
|
37
|
-
pressure?: number
|
|
38
|
-
tangentialPressure?: number
|
|
39
|
-
tiltX?: number
|
|
40
|
-
tiltY?: number
|
|
41
|
-
twist?: number
|
|
42
|
-
}
|
|
43
|
-
export type PointerType = 'mouse' | 'pen' | 'touch'
|
|
44
|
-
|
|
45
|
-
export interface IDragEvent extends IPointerEvent {
|
|
46
|
-
moveX: number
|
|
47
|
-
moveY: number
|
|
48
|
-
totalX: number
|
|
49
|
-
totalY: number
|
|
50
|
-
|
|
51
|
-
getInnerMove?(target?: ILeaf): IPointData
|
|
52
|
-
getLocalMove?(target?: ILeaf): IPointData
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export interface IDropEvent extends IPointerEvent {
|
|
56
|
-
list: ILeafList
|
|
57
|
-
data?: IObject
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface IRotateEvent extends IUIEvent {
|
|
61
|
-
rotation: number
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface IZoomEvent extends IUIEvent {
|
|
65
|
-
scale: number
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface IMoveEvent extends IDragEvent {
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface ISwipeEvent extends IDragEvent {
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface IKeyEvent extends IUIEvent {
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface IImageEvent extends IEvent {
|
|
81
|
-
image?: ILeaferImage
|
|
82
|
-
attrName?: string
|
|
83
|
-
attrValue?: IObject
|
|
84
|
-
error?: string | IObject
|
|
85
|
-
}
|
package/src/file/IFileType.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ILeaferImage, ILeaferImageConfig } from './ILeaferImage'
|
|
2
|
-
import { ITaskProcessor } from '../task/ITaskProcessor'
|
|
3
|
-
|
|
4
|
-
interface ILeaferImageMap {
|
|
5
|
-
[name: string]: ILeaferImage
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface IImageManager {
|
|
9
|
-
map: ILeaferImageMap
|
|
10
|
-
recycledList: ILeaferImage[]
|
|
11
|
-
tasker: ITaskProcessor
|
|
12
|
-
patternTasker: ITaskProcessor
|
|
13
|
-
readonly isComplete: boolean
|
|
14
|
-
get(config: ILeaferImageConfig): ILeaferImage
|
|
15
|
-
recycle(image: ILeaferImage): void
|
|
16
|
-
clearRecycled(): void
|
|
17
|
-
destroy(): void
|
|
18
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { IObject } from '../data/IData'
|
|
2
|
-
import { InnerId } from '../event/IEventer'
|
|
3
|
-
|
|
4
|
-
export interface ILeaferImageConfig {
|
|
5
|
-
url: string
|
|
6
|
-
thumb?: string
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ILeaferImageOnLoaded {
|
|
10
|
-
(image?: ILeaferImage): any
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ILeaferImageOnError {
|
|
14
|
-
(error?: string | IObject, image?: ILeaferImage): any
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ILeaferImage {
|
|
18
|
-
readonly innerId: InnerId
|
|
19
|
-
readonly url: string
|
|
20
|
-
|
|
21
|
-
view: unknown
|
|
22
|
-
width: number
|
|
23
|
-
height: number
|
|
24
|
-
|
|
25
|
-
isSVG: boolean
|
|
26
|
-
|
|
27
|
-
readonly completed: boolean
|
|
28
|
-
ready: boolean
|
|
29
|
-
error: IObject
|
|
30
|
-
loading: boolean
|
|
31
|
-
|
|
32
|
-
use: number
|
|
33
|
-
config: ILeaferImageConfig
|
|
34
|
-
|
|
35
|
-
load(onSuccess?: ILeaferImageOnLoaded, onError?: ILeaferImageOnError): number
|
|
36
|
-
unload(index: number, stopEvent?: boolean): void
|
|
37
|
-
getCanvas(width: number, height: number, opacity?: number, _filters?: IObject): unknown
|
|
38
|
-
destroy(): void
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export type IImageStatus = 'wait' | 'thumb-loading' | 'thumb-success' | 'thumb-error' | 'loading' | 'success' | 'error'
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { INumberFunction, IPointDataFunction } from '../function/IFunction'
|
|
2
|
-
import { IPointerEvent, IMoveEvent, IZoomEvent, IRotateEvent, IUIEvent } from '../event/IUIEvent'
|
|
3
|
-
import { ILeaf } from '../display/ILeaf'
|
|
4
|
-
import { ILeafList } from '../data/IList'
|
|
5
|
-
import { IPointData } from '../math/IMath'
|
|
6
|
-
import { ISelector } from '../selector/ISelector'
|
|
7
|
-
import { IBounds } from '../math/IMath'
|
|
8
|
-
import { IControl } from '../control/IControl'
|
|
9
|
-
import { IKeepTouchData } from '../event/IEvent'
|
|
10
|
-
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
11
|
-
import { IObject } from '../data/IData'
|
|
12
|
-
|
|
13
|
-
export interface IInteraction extends IControl {
|
|
14
|
-
target: ILeaf
|
|
15
|
-
canvas: IInteractionCanvas
|
|
16
|
-
selector: ISelector
|
|
17
|
-
|
|
18
|
-
running: boolean
|
|
19
|
-
readonly dragging: boolean
|
|
20
|
-
|
|
21
|
-
config: IInteractionConfig
|
|
22
|
-
|
|
23
|
-
readonly hitRadius: number
|
|
24
|
-
shrinkCanvasBounds: IBounds
|
|
25
|
-
|
|
26
|
-
downData: IPointerEvent
|
|
27
|
-
downTime: number
|
|
28
|
-
|
|
29
|
-
receive(event: any): void
|
|
30
|
-
|
|
31
|
-
pointerDown(data: IPointerEvent, defaultPath?: boolean): void
|
|
32
|
-
pointerMove(data: IPointerEvent): void
|
|
33
|
-
pointerMoveReal(data: IPointerEvent): void
|
|
34
|
-
pointerUp(data: IPointerEvent): void
|
|
35
|
-
pointerCancel(): void
|
|
36
|
-
|
|
37
|
-
multiTouch(data: IUIEvent, list: IKeepTouchData[]): void
|
|
38
|
-
|
|
39
|
-
move(data: IMoveEvent): void
|
|
40
|
-
zoom(data: IZoomEvent): void
|
|
41
|
-
rotate(data: IRotateEvent): void
|
|
42
|
-
|
|
43
|
-
emit(type: string, data: IUIEvent, path?: ILeafList, excludePath?: ILeafList): void
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface IInteractionCanvas extends ILeaferCanvas {
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface IInteractionConfig {
|
|
51
|
-
wheel?: IWheelConfig
|
|
52
|
-
pointer?: IPointerConfig
|
|
53
|
-
zoom?: IZoomConfig
|
|
54
|
-
move?: IMoveConfig
|
|
55
|
-
eventer?: IObject
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface IZoomConfig {
|
|
59
|
-
min?: number
|
|
60
|
-
max?: number
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface IMoveConfig {
|
|
64
|
-
dragEmpty?: boolean
|
|
65
|
-
dragOut?: boolean
|
|
66
|
-
autoDistance?: number
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface IWheelConfig {
|
|
70
|
-
zoomMode?: boolean
|
|
71
|
-
zoomSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
72
|
-
moveSpeed?: number
|
|
73
|
-
rotateSpeed?: number // 取值范围 0 ~ 1, 默认0.5
|
|
74
|
-
delta?: IPointData // 以chrome为基准, 鼠标滚动一格的距离
|
|
75
|
-
getScale?: INumberFunction
|
|
76
|
-
getMove?: IPointDataFunction
|
|
77
|
-
preventDefault?: boolean
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface IPointerConfig {
|
|
81
|
-
hitRadius?: number
|
|
82
|
-
through?: boolean
|
|
83
|
-
tapMore?: boolean
|
|
84
|
-
tapTime?: number
|
|
85
|
-
longPressTime?: number
|
|
86
|
-
transformTime?: number
|
|
87
|
-
dragHover?: boolean
|
|
88
|
-
dragDistance?: number
|
|
89
|
-
swipeDistance?: number
|
|
90
|
-
ignoreMove?: boolean // 性能优化字段, 控制move事件触发次数
|
|
91
|
-
preventDefault?: boolean
|
|
92
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { IBoundsData, IMatrixData, IMatrixDecompositionData } from '../math/IMath'
|
|
2
|
-
import { ILeaf } from '../display/ILeaf'
|
|
3
|
-
|
|
4
|
-
export type ILayoutLocationType = 'world' | 'local' | 'inner'
|
|
5
|
-
export type ILayoutBoundsType = 'content' | 'box' | 'stroke' | 'margin' | 'render'
|
|
6
|
-
|
|
7
|
-
export interface ILeafLayout {
|
|
8
|
-
|
|
9
|
-
leaf: ILeaf
|
|
10
|
-
|
|
11
|
-
useZoomProxy: boolean
|
|
12
|
-
|
|
13
|
-
// inner
|
|
14
|
-
|
|
15
|
-
boxBounds: IBoundsData // | content + padding |
|
|
16
|
-
strokeBounds: IBoundsData // | boxBounds + border |
|
|
17
|
-
renderBounds: IBoundsData // | strokeBounds + shadow |
|
|
18
|
-
|
|
19
|
-
// auto layout
|
|
20
|
-
marginBounds: IBoundsData // | strokeBounds + margin |
|
|
21
|
-
contentBounds: IBoundsData // | content |
|
|
22
|
-
|
|
23
|
-
// local
|
|
24
|
-
|
|
25
|
-
//localBoxBounds: IBoundsData = leaf.__local
|
|
26
|
-
localStrokeBounds: IBoundsData
|
|
27
|
-
localRenderBounds: IBoundsData
|
|
28
|
-
|
|
29
|
-
// state
|
|
30
|
-
|
|
31
|
-
// matrix changed
|
|
32
|
-
matrixChanged: boolean // include positionChanged scaleChanged skewChanged
|
|
33
|
-
positionChanged: boolean // x, y
|
|
34
|
-
originChanged?: boolean // originX originY
|
|
35
|
-
scaleChanged: boolean // scaleX scaleY
|
|
36
|
-
rotationChanged: boolean // rotaiton, skewX scaleY 数据更新
|
|
37
|
-
|
|
38
|
-
// bounds changed
|
|
39
|
-
boundsChanged: boolean
|
|
40
|
-
|
|
41
|
-
boxChanged: boolean
|
|
42
|
-
strokeChanged: boolean
|
|
43
|
-
renderChanged: boolean
|
|
44
|
-
|
|
45
|
-
localBoxChanged: boolean // position
|
|
46
|
-
|
|
47
|
-
// face changed
|
|
48
|
-
surfaceChanged: boolean
|
|
49
|
-
opacityChanged: boolean
|
|
50
|
-
|
|
51
|
-
hitCanvasChanged: boolean
|
|
52
|
-
|
|
53
|
-
childrenSortChanged?: boolean
|
|
54
|
-
|
|
55
|
-
// keep state
|
|
56
|
-
affectScaleOrRotation: boolean
|
|
57
|
-
affectRotation: boolean
|
|
58
|
-
affectChildrenSort?: boolean
|
|
59
|
-
|
|
60
|
-
strokeSpread: number
|
|
61
|
-
renderSpread: number
|
|
62
|
-
strokeBoxSpread: number
|
|
63
|
-
renderShapeSpread: number
|
|
64
|
-
|
|
65
|
-
checkUpdate(force?: boolean): void
|
|
66
|
-
|
|
67
|
-
getTransform(locationType: ILayoutLocationType): IMatrixData
|
|
68
|
-
decomposeTransform(locationType: ILayoutLocationType): IMatrixDecompositionData
|
|
69
|
-
getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType): IBoundsData
|
|
70
|
-
|
|
71
|
-
// 独立 / 引用 boxBounds
|
|
72
|
-
spreadStroke(): void
|
|
73
|
-
spreadRender(): void
|
|
74
|
-
spreadStrokeCancel(): void
|
|
75
|
-
spreadRenderCancel(): void
|
|
76
|
-
|
|
77
|
-
// bounds
|
|
78
|
-
boxChange(): void
|
|
79
|
-
localBoxChange(): void
|
|
80
|
-
strokeChange(): void
|
|
81
|
-
renderChange(): void
|
|
82
|
-
|
|
83
|
-
// matrix
|
|
84
|
-
positionChange(): void
|
|
85
|
-
scaleChange(): void
|
|
86
|
-
rotationChange(): void
|
|
87
|
-
|
|
88
|
-
// face
|
|
89
|
-
surfaceChange(): void
|
|
90
|
-
opacityChange(): void
|
|
91
|
-
|
|
92
|
-
childrenSortChange(): void
|
|
93
|
-
|
|
94
|
-
destroy(): void
|
|
95
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { IBounds } from '../math/IMath'
|
|
2
|
-
import { ILeaf } from '../display/ILeaf'
|
|
3
|
-
import { ILeafList } from '../data/IList'
|
|
4
|
-
import { IControl } from '../control/IControl'
|
|
5
|
-
|
|
6
|
-
export interface ILayoutChangedData {
|
|
7
|
-
matrixList: ILeaf[]
|
|
8
|
-
boundsList: ILeaf[]
|
|
9
|
-
surfaceList: ILeaf[]
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ILayoutBlockData {
|
|
13
|
-
updatedList: ILeafList
|
|
14
|
-
updatedBounds: IBounds
|
|
15
|
-
|
|
16
|
-
beforeBounds: IBounds
|
|
17
|
-
afterBounds: IBounds
|
|
18
|
-
|
|
19
|
-
setBefore?(): void
|
|
20
|
-
setAfter?(): void
|
|
21
|
-
merge?(data: ILayoutBlockData): void
|
|
22
|
-
destroy(): void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface IPartLayoutConfig {
|
|
26
|
-
maxBlocks?: number
|
|
27
|
-
maxTimes?: number
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ILayouterConfig {
|
|
31
|
-
partLayout?: IPartLayoutConfig
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface ILayouter extends IControl {
|
|
35
|
-
target: ILeaf
|
|
36
|
-
layoutedBlocks: ILayoutBlockData[]
|
|
37
|
-
|
|
38
|
-
totalTimes: number
|
|
39
|
-
times: number
|
|
40
|
-
|
|
41
|
-
disabled: boolean
|
|
42
|
-
running: boolean
|
|
43
|
-
layouting: boolean
|
|
44
|
-
|
|
45
|
-
waitAgain: boolean
|
|
46
|
-
|
|
47
|
-
config: ILayouterConfig
|
|
48
|
-
|
|
49
|
-
disable(): void
|
|
50
|
-
|
|
51
|
-
layout(): void
|
|
52
|
-
layoutAgain(): void
|
|
53
|
-
layoutOnce(): void
|
|
54
|
-
partLayout(): void
|
|
55
|
-
fullLayout(): void
|
|
56
|
-
|
|
57
|
-
createBlock(data: ILeafList | ILeaf[]): ILayoutBlockData
|
|
58
|
-
getBlocks(list: ILeafList): ILayoutBlockData[]
|
|
59
|
-
addBlocks(current: ILayoutBlockData[]): void
|
|
60
|
-
}
|
package/src/math/IMath.ts
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { IObject } from '../data/IData'
|
|
2
|
-
|
|
3
|
-
export interface IPointData {
|
|
4
|
-
x: number
|
|
5
|
-
y: number
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface IPoint extends IPointData {
|
|
9
|
-
set(x?: number, y?: number): void
|
|
10
|
-
copy(point: IPointData): IPoint
|
|
11
|
-
clone(): IPoint
|
|
12
|
-
|
|
13
|
-
rotate(angle: number, center?: IPointData): IPoint
|
|
14
|
-
|
|
15
|
-
toInnerOf(matrix: IMatrixData, to?: IPointData): IPoint
|
|
16
|
-
toOuterOf(matrix: IMatrixData, to?: IPointData): IPoint
|
|
17
|
-
|
|
18
|
-
getCenter(to: IPointData): IPointData
|
|
19
|
-
getDistance(to: IPointData): number
|
|
20
|
-
getAngle(to: IPointData): number
|
|
21
|
-
getAtan2(to: IPointData): number
|
|
22
|
-
|
|
23
|
-
reset(): void
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface IRadiusPointData extends IPointData {
|
|
27
|
-
radiusX: number
|
|
28
|
-
radiusY: number
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface ISizeData {
|
|
32
|
-
width: number
|
|
33
|
-
height: number
|
|
34
|
-
}
|
|
35
|
-
export interface ISize extends ISizeData {
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface IScreenSizeData extends ISizeData {
|
|
40
|
-
pixelRatio?: number
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface IBoundsData extends IPointData, ISizeData { }
|
|
44
|
-
|
|
45
|
-
export interface IOffsetBoundsData extends IBoundsData {
|
|
46
|
-
offsetX: number
|
|
47
|
-
offsetY: number
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface IBoundsDataHandle {
|
|
51
|
-
(target: any): IBoundsData
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface IBounds extends IBoundsData {
|
|
55
|
-
set(x?: number, y?: number, width?: number, height?: number): void
|
|
56
|
-
copy(bounds: IBoundsData): IBounds
|
|
57
|
-
clone(): IBounds
|
|
58
|
-
|
|
59
|
-
scale(scale: number): IBounds
|
|
60
|
-
toOuterOf(matrix: IMatrixData, to?: IBoundsData): IBounds
|
|
61
|
-
getFitMatrix(put: IBoundsData): IMatrix
|
|
62
|
-
|
|
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
|
|
72
|
-
|
|
73
|
-
hitPoint(point: IPointData, pointMatrix?: IMatrixData): boolean
|
|
74
|
-
hitRadiusPoint(point: IRadiusPointData, pointMatrix?: IMatrixData): boolean
|
|
75
|
-
hit(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
|
|
76
|
-
includes(bounds: IBoundsData, boundsMatrix?: IMatrixData): boolean
|
|
77
|
-
|
|
78
|
-
intersect(bounds: IBoundsData, boundsMatrix?: IMatrixData): IBounds
|
|
79
|
-
getIntersect(bounds: IBoundsData, boundsMatrix?: IMatrixData): IBounds
|
|
80
|
-
|
|
81
|
-
isSame(bounds: IBoundsData): boolean
|
|
82
|
-
isEmpty(): boolean
|
|
83
|
-
reset(): void
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface ITwoPointBoundsData {
|
|
87
|
-
minX: number
|
|
88
|
-
minY: number
|
|
89
|
-
maxX: number
|
|
90
|
-
maxY: number
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface ITwoPointBounds extends ITwoPointBoundsData {
|
|
94
|
-
addPoint(x: number, y: number): void
|
|
95
|
-
addBounds(x: number, y: number, width: number, height: number): void
|
|
96
|
-
add(pointBounds: ITwoPointBoundsData): void
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
export interface IAutoBoundsData {
|
|
101
|
-
top?: number
|
|
102
|
-
right?: number
|
|
103
|
-
bottom?: number
|
|
104
|
-
left?: number
|
|
105
|
-
|
|
106
|
-
width?: number
|
|
107
|
-
height?: number
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
export interface IAutoBounds extends IAutoBoundsData {
|
|
112
|
-
set(top?: number, right?: number, bottom?: number, left?: number, width?: number, height?: number): void
|
|
113
|
-
copy(auto: IAutoBoundsData): void
|
|
114
|
-
getBoundsFrom(parent: ISizeData): IBounds
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
export interface IMatrixData {
|
|
119
|
-
a: number
|
|
120
|
-
b: number
|
|
121
|
-
c: number
|
|
122
|
-
d: number
|
|
123
|
-
e: number
|
|
124
|
-
f: number
|
|
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
|
-
|
|
146
|
-
export interface IMatrix extends IMatrixData {
|
|
147
|
-
set(a: number, b: number, c: number, d: number, e: number, f: number): void
|
|
148
|
-
copy(matrix: IMatrixData): IMatrix
|
|
149
|
-
clone(): IMatrix
|
|
150
|
-
|
|
151
|
-
translate(x: number, y: number): IMatrix
|
|
152
|
-
translateInner(x: number, y: number): IMatrix
|
|
153
|
-
|
|
154
|
-
scale(x: number, y?: number): IMatrix
|
|
155
|
-
scaleOfOuter(origin: IPointData, x: number, y?: number): IMatrix
|
|
156
|
-
scaleOfInner(origin: IPointData, x: number, y?: number): IMatrix
|
|
157
|
-
|
|
158
|
-
rotate(angle: number): IMatrix
|
|
159
|
-
rotateOfOuter(origin: IPointData, angle: number): IMatrix
|
|
160
|
-
rotateOfInner(origin: IPointData, angle: number): IMatrix
|
|
161
|
-
|
|
162
|
-
skew(x: number, y?: number): IMatrix
|
|
163
|
-
skewOfOuter(origin: IPointData, x: number, y?: number): IMatrix
|
|
164
|
-
skewOfInner(origin: 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
|
|
173
|
-
|
|
174
|
-
decompose(): IMatrixDecompositionData
|
|
175
|
-
|
|
176
|
-
reset(): void
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
export interface IMatrixWithBoundsData extends IMatrixData, IBoundsData {
|
|
181
|
-
scaleX?: number
|
|
182
|
-
scaleY?: number
|
|
183
|
-
}
|
package/src/path/IPathCommand.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
type Command = number
|
|
2
|
-
type x = number
|
|
3
|
-
type y = number
|
|
4
|
-
type x1 = number
|
|
5
|
-
type y1 = number
|
|
6
|
-
type x2 = number
|
|
7
|
-
type y2 = number
|
|
8
|
-
type radiusX = number
|
|
9
|
-
type radiusY = number
|
|
10
|
-
type xAxisRotation = number
|
|
11
|
-
type largeArcFlag = number
|
|
12
|
-
type sweepFlag = number
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export type MCommandData = [Command, x, y]
|
|
16
|
-
export type HCommandData = [Command, x]
|
|
17
|
-
export type VCommandData = [Command, y]
|
|
18
|
-
export type LCommandData = MCommandData
|
|
19
|
-
|
|
20
|
-
export type CCommandData = [Command, x1, y1, x2, y2, x, y]
|
|
21
|
-
export type SCommandData = [Command, x2, y2, x, y]
|
|
22
|
-
|
|
23
|
-
export type QCommandData = [Command, x1, y1, x, y]
|
|
24
|
-
export type TCommandData = [Command, x, y]
|
|
25
|
-
|
|
26
|
-
export type ZCommandData = [Command]
|
|
27
|
-
|
|
28
|
-
export type ACommandData = [Command, radiusX, radiusY, xAxisRotation, largeArcFlag, sweepFlag, x, y]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// 非svg标准的canvas绘图命令
|
|
32
|
-
type width = number
|
|
33
|
-
type height = number
|
|
34
|
-
type rotation = number
|
|
35
|
-
type startAngle = number
|
|
36
|
-
type endAngle = number
|
|
37
|
-
type anticlockwise = boolean
|
|
38
|
-
type cornerRadius = number | number[]
|
|
39
|
-
type radius = number
|
|
40
|
-
|
|
41
|
-
export type RectCommandData = [Command, x, y, width, height]
|
|
42
|
-
export type RoundRectCommandData = [Command, x, y, width, height, cornerRadius]
|
|
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
|
-
export type ArcToCommandData = [Command, x1, y1, x2, y2, radius]
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export type CanvasPathCommand = 1 | 2 | 5 | 7 | 11 // M | L | C | Q | Z canvas可以绘制的命令
|
|
49
|
-
|
|
50
|
-
export type IPathCommandData = number[] // ...(MCommandData | LCommandData | CCommandData | QCommandData | ZCommandData)
|
package/src/path/IPathDrawer.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { IPathCommandData } from './IPathCommand'
|
|
2
|
-
export interface IPathDrawer {
|
|
3
|
-
beginPath?(): void
|
|
4
|
-
|
|
5
|
-
moveTo(x: number, y: number): void
|
|
6
|
-
lineTo(x: number, y: number): void
|
|
7
|
-
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void
|
|
8
|
-
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void
|
|
9
|
-
closePath(): void
|
|
10
|
-
|
|
11
|
-
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
|
|
12
|
-
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
|
|
13
|
-
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
|
|
14
|
-
|
|
15
|
-
rect(x: number, y: number, width: number, height: number): void
|
|
16
|
-
roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): void
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface IPathCreator {
|
|
20
|
-
path: IPathCommandData
|
|
21
|
-
|
|
22
|
-
beginPath(): IPathCreator
|
|
23
|
-
|
|
24
|
-
moveTo(x: number, y: number): IPathCreator
|
|
25
|
-
lineTo(x: number, y: number): IPathCreator
|
|
26
|
-
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): IPathCreator
|
|
27
|
-
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): IPathCreator
|
|
28
|
-
closePath(): IPathCreator
|
|
29
|
-
|
|
30
|
-
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
|
|
31
|
-
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): IPathCreator
|
|
32
|
-
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): IPathCreator
|
|
33
|
-
|
|
34
|
-
rect(x: number, y: number, width: number, height: number): IPathCreator
|
|
35
|
-
roundRect(x: number, y: number, width: number, height: number, radius?: number | number[]): IPathCreator
|
|
36
|
-
}
|