@leafer/interface 1.0.0-alpha.10 → 1.0.0-alpha.23
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 +1 -1
- package/src/app/IApp.ts +1 -0
- package/src/app/ILeafer.ts +11 -9
- package/src/canvas/ICanvas.ts +0 -14
- package/src/canvas/ILeaferCanvas.ts +22 -13
- package/src/data/ILeafData.ts +2 -0
- package/src/display/IBranch.ts +3 -3
- package/src/display/ILeaf.ts +97 -28
- package/src/display/module/ILeafBounds.ts +5 -5
- package/src/display/module/ILeafDataProxy.ts +3 -3
- package/src/display/module/ILeafHit.ts +2 -0
- package/src/display/module/ILeafMatrix.ts +1 -1
- package/src/display/module/ILeafRender.ts +4 -1
- package/src/event/IEvent.ts +5 -1
- package/src/event/IUIEvent.ts +10 -0
- package/src/image/IImageManager.ts +6 -0
- package/src/image/ILeaferImage.ts +17 -2
- package/src/index.ts +7 -7
- package/src/interaction/IInteraction.ts +12 -4
- package/src/layout/ILeafLayout.ts +19 -18
- package/src/math/IMath.ts +58 -21
- package/src/platform/IPlatform.ts +2 -0
- package/src/renderer/IRenderer.ts +2 -2
package/package.json
CHANGED
package/src/app/IApp.ts
CHANGED
package/src/app/ILeafer.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { IRenderer, IRendererConfig } from '../renderer/IRenderer'
|
|
|
3
3
|
import { IHitCanvas, ILeaferCanvas, ILeaferCanvasConfig, IHitCanvasConfig } from '../canvas/ILeaferCanvas'
|
|
4
4
|
import { ILayouter, ILayouterConfig } from '../layouter/ILayouter'
|
|
5
5
|
import { ISelector } from '../selector/ISelector'
|
|
6
|
-
import { IInteraction, IInteractionConfig } from '../interaction/IInteraction'
|
|
6
|
+
import { IInteraction, IInteractionCanvas, IInteractionConfig } from '../interaction/IInteraction'
|
|
7
7
|
import { IWatcher } from '../watcher/IWatcher'
|
|
8
8
|
import { IAutoBounds, IScreenSizeData } from '../math/IMath'
|
|
9
9
|
import { ICanvasManager } from '../canvas/ICanvasManager'
|
|
@@ -13,13 +13,12 @@ import { IObject } from '../data/IData'
|
|
|
13
13
|
import { IZoomView } from '../display/IView'
|
|
14
14
|
import { IApp } from './IApp'
|
|
15
15
|
import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
|
|
16
|
-
import { IEvent } from '../event/IEvent'
|
|
17
|
-
|
|
18
16
|
|
|
17
|
+
export type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'user'
|
|
19
18
|
export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
20
19
|
start?: boolean
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
type?: ILeaferType
|
|
21
|
+
virtualCanvas?: boolean
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export interface ILeafer extends IZoomView {
|
|
@@ -30,9 +29,13 @@ export interface ILeafer extends IZoomView {
|
|
|
30
29
|
parent?: IApp
|
|
31
30
|
|
|
32
31
|
running: boolean
|
|
32
|
+
ready: boolean
|
|
33
|
+
|
|
34
|
+
startTimer: number
|
|
33
35
|
|
|
34
36
|
autoLayout?: IAutoBounds
|
|
35
37
|
|
|
38
|
+
view: unknown
|
|
36
39
|
canvas: ILeaferCanvas
|
|
37
40
|
renderer: IRenderer
|
|
38
41
|
|
|
@@ -46,6 +49,8 @@ export interface ILeafer extends IZoomView {
|
|
|
46
49
|
hitCanvasManager?: IHitCanvasManager
|
|
47
50
|
imageManager: IImageManager
|
|
48
51
|
|
|
52
|
+
config: ILeaferConfig
|
|
53
|
+
|
|
49
54
|
start(): void
|
|
50
55
|
stop(): void
|
|
51
56
|
|
|
@@ -53,9 +58,6 @@ export interface ILeafer extends IZoomView {
|
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
export interface ICreator {
|
|
56
|
-
ui?(tag: string, data?: IObject): ILeaf
|
|
57
|
-
event?(type: string, event: IEvent): IEvent
|
|
58
|
-
|
|
59
61
|
image?(options?: ILeaferImageConfig): ILeaferImage
|
|
60
62
|
canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas
|
|
61
63
|
hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas
|
|
@@ -65,7 +67,7 @@ export interface ICreator {
|
|
|
65
67
|
renderer?(target: ILeaf, canvas: ILeaferCanvas, options: IRendererConfig): IRenderer
|
|
66
68
|
selector?(target: ILeaf): ISelector
|
|
67
69
|
|
|
68
|
-
interaction?(target: ILeaf, canvas:
|
|
70
|
+
interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
export interface IUICreator {
|
package/src/canvas/ICanvas.ts
CHANGED
|
@@ -10,9 +10,7 @@ type CanvasTextAlign = 'center' | 'end' | 'left' | 'right' | 'start'
|
|
|
10
10
|
type CanvasTextBaseline = 'alphabetic' | 'bottom' | 'hanging' | 'ideographic' | 'middle' | 'top'
|
|
11
11
|
//type CanvasTextRendering = 'auto' | 'geometricPrecision' | 'optimizeLegibility' | 'optimizeSpeed'
|
|
12
12
|
|
|
13
|
-
/** This Canvas 2D API interface is used to declare a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. */
|
|
14
13
|
export interface IPath2D extends CanvasPath {
|
|
15
|
-
/** Adds to the path the path given by the argument. */
|
|
16
14
|
addPath(path: IPath2D, transform?: DOMMatrix2DInit): void
|
|
17
15
|
}
|
|
18
16
|
|
|
@@ -60,13 +58,7 @@ interface CanvasFilters {
|
|
|
60
58
|
filter: string
|
|
61
59
|
}
|
|
62
60
|
|
|
63
|
-
/** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */
|
|
64
61
|
export interface CanvasGradient {
|
|
65
|
-
/**
|
|
66
|
-
* Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end.
|
|
67
|
-
*
|
|
68
|
-
* Throws an 'IndexSizeError' DOMException if the offset is out of range. Throws a 'SyntaxError' DOMException if the color cannot be parsed.
|
|
69
|
-
*/
|
|
70
62
|
addColorStop(offset: number, color: string): void
|
|
71
63
|
}
|
|
72
64
|
|
|
@@ -111,9 +103,7 @@ interface CanvasPathDrawingStyles {
|
|
|
111
103
|
setLineDash(segments: number[]): void
|
|
112
104
|
}
|
|
113
105
|
|
|
114
|
-
/** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */
|
|
115
106
|
export interface CanvasPattern {
|
|
116
|
-
/** Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation. */
|
|
117
107
|
setTransform(transform?: DOMMatrix2DInit): void
|
|
118
108
|
}
|
|
119
109
|
|
|
@@ -135,8 +125,6 @@ interface CanvasRenderingContext2DSettings {
|
|
|
135
125
|
desynchronized?: boolean
|
|
136
126
|
willReadFrequently?: boolean
|
|
137
127
|
}
|
|
138
|
-
|
|
139
|
-
/** The CanvasRenderingContext2D interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a <canvas> element. It is used for drawing shapes, text, images, and other objects. */
|
|
140
128
|
export interface ICanvasContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform, CanvasUserInterface {
|
|
141
129
|
readonly canvas: HTMLCanvasElement
|
|
142
130
|
getContextAttributes(): CanvasRenderingContext2DSettings
|
|
@@ -165,7 +153,6 @@ interface CanvasUserInterface {
|
|
|
165
153
|
}
|
|
166
154
|
|
|
167
155
|
|
|
168
|
-
/** The dimensions of a piece of text in the canvas, as created by the CanvasRenderingContext2D.measureText() method. */
|
|
169
156
|
export interface ITextMetrics {
|
|
170
157
|
/** Returns the measurement described below. */
|
|
171
158
|
readonly actualBoundingBoxAscent: number
|
|
@@ -277,7 +264,6 @@ interface DOMMatrixReadOnly {
|
|
|
277
264
|
rotateFromVector(x?: number, y?: number): DOMMatrix
|
|
278
265
|
scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix
|
|
279
266
|
scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix
|
|
280
|
-
/** @deprecated */
|
|
281
267
|
scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix
|
|
282
268
|
skewX(sx?: number): DOMMatrix
|
|
283
269
|
skewY(sy?: number): DOMMatrix
|
|
@@ -10,6 +10,8 @@ export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
|
10
10
|
view?: string | IObject
|
|
11
11
|
fill?: string
|
|
12
12
|
pixelRatio?: number
|
|
13
|
+
hittable?: boolean
|
|
14
|
+
offscreen?: boolean
|
|
13
15
|
webgl?: boolean
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -71,6 +73,7 @@ interface ICanvasMethod {
|
|
|
71
73
|
strokeRect(x: number, y: number, width: number, height: number): void
|
|
72
74
|
clearRect(x: number, y: number, width: number, height: number): void
|
|
73
75
|
|
|
76
|
+
transform(a: number, b: number, c: number, d: number, e: number, f: number): void
|
|
74
77
|
translate(x: number, y: number): void
|
|
75
78
|
scale(x: number, y: number): void
|
|
76
79
|
rotate(angle: number): void
|
|
@@ -96,24 +99,26 @@ interface ICanvasMethod {
|
|
|
96
99
|
|
|
97
100
|
// custom
|
|
98
101
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
saveBlendMode(blendMode?: string): void
|
|
103
|
+
restoreBlendMode(): void
|
|
104
|
+
|
|
105
|
+
hitFill(point: IPointData, fillRule?: string): boolean
|
|
106
|
+
hitStroke(point: IPointData): boolean
|
|
102
107
|
|
|
108
|
+
setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void
|
|
103
109
|
|
|
104
110
|
setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void
|
|
105
111
|
|
|
112
|
+
setWorldShadow(x: number, y: number, blur: number, color?: string): void
|
|
113
|
+
setWorldBlur(blur: number): void
|
|
106
114
|
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
|
|
116
|
+
copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void
|
|
117
|
+
fillWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void
|
|
118
|
+
strokeWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void
|
|
119
|
+
clipWorld(bounds: IBoundsData, ceilPixel?: boolean): void
|
|
120
|
+
clearWorld(bounds: IBoundsData, ceilPixel?: boolean): void
|
|
109
121
|
|
|
110
|
-
replaceBy(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
|
|
111
|
-
copy(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
|
|
112
|
-
copyWorldToLocal(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toLocalBounds: IBoundsData, blendMode?: string): void
|
|
113
|
-
fillBounds(bounds: IBoundsData, color: string | object, blendMode?: string): void
|
|
114
|
-
strokeBounds(bounds: IBoundsData, color: string | object, blendMode?: string): void
|
|
115
|
-
clipBounds(bounds: IBoundsData): void
|
|
116
|
-
clearBounds(bounds: IBoundsData): void
|
|
117
122
|
clear(): void
|
|
118
123
|
}
|
|
119
124
|
|
|
@@ -133,13 +138,16 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
133
138
|
bounds: IBounds
|
|
134
139
|
|
|
135
140
|
view: unknown
|
|
141
|
+
parentView: unknown
|
|
142
|
+
offscreen: boolean
|
|
143
|
+
|
|
136
144
|
context: ICanvasContext2D
|
|
137
145
|
|
|
138
146
|
recycled?: boolean
|
|
139
147
|
|
|
140
148
|
debug(): void
|
|
141
149
|
|
|
142
|
-
|
|
150
|
+
startAutoLayout(autoBounds: IAutoBounds, listener: IResizeEventListener): void
|
|
143
151
|
stopAutoLayout(): void
|
|
144
152
|
|
|
145
153
|
resize(size: IScreenSizeData): void
|
|
@@ -152,6 +160,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
152
160
|
useSameTransform(canvas: ILeaferCanvas): void
|
|
153
161
|
recycle(): void
|
|
154
162
|
|
|
163
|
+
unloadView(): void
|
|
155
164
|
destroy(): void
|
|
156
165
|
}
|
|
157
166
|
|
package/src/data/ILeafData.ts
CHANGED
|
@@ -5,8 +5,10 @@ export interface IDataProcessor extends IObject {
|
|
|
5
5
|
__leaf: ILeaf
|
|
6
6
|
__input: IObject
|
|
7
7
|
__middle: IObject
|
|
8
|
+
__get(name: string): unknown
|
|
8
9
|
__setInput(name: string, value: unknown): void
|
|
9
10
|
__getInput(name: string): unknown
|
|
11
|
+
__getInputData(): IObject
|
|
10
12
|
__setMiddle(name: string, value: unknown): void
|
|
11
13
|
__getMiddle(name: string): unknown
|
|
12
14
|
destroy(): void
|
package/src/display/IBranch.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ILeaf } from './ILeaf'
|
|
|
3
3
|
export interface IBranch extends ILeaf {
|
|
4
4
|
children: ILeaf[]
|
|
5
5
|
|
|
6
|
-
__updateSortChildren(): void
|
|
7
|
-
add(child: ILeaf, index?: number): void
|
|
8
|
-
remove(child?: ILeaf): void
|
|
6
|
+
// __updateSortChildren(): void
|
|
7
|
+
// add(child: ILeaf, index?: number): void
|
|
8
|
+
// remove(child?: ILeaf): void
|
|
9
9
|
}
|
package/src/display/ILeaf.ts
CHANGED
|
@@ -5,13 +5,13 @@ import { ILeaferCanvas, IHitCanvas } from '../canvas/ILeaferCanvas'
|
|
|
5
5
|
import { IRenderOptions } from '../renderer/IRenderer'
|
|
6
6
|
|
|
7
7
|
import { IObject, __Number, __Boolean, __Value, __String } from '../data/IData'
|
|
8
|
-
import { IMatrixWithBoundsData, IMatrix, IBoundsData, IRadiusPointData } from '../math/IMath'
|
|
8
|
+
import { IMatrixWithBoundsData, IMatrix, IPointData, IBoundsData, IMatrixData, IRadiusPointData, IMatrixDecompositionAttr } from '../math/IMath'
|
|
9
9
|
import { IFunction } from '../function/IFunction'
|
|
10
10
|
|
|
11
11
|
import { ILeafDataProxy } from './module/ILeafDataProxy'
|
|
12
12
|
import { ILeafMatrix } from './module/ILeafMatrix'
|
|
13
13
|
import { ILeafBounds } from './module/ILeafBounds'
|
|
14
|
-
import { ILeafLayout } from '../layout/ILeafLayout'
|
|
14
|
+
import { ILeafLayout, ILayoutBoundsType, ILayoutLocationType } from '../layout/ILeafLayout'
|
|
15
15
|
import { ILeafHit } from './module/ILeafHit'
|
|
16
16
|
import { ILeafRender } from './module/ILeafRender'
|
|
17
17
|
import { ILeafData } from '../data/ILeafData'
|
|
@@ -23,14 +23,17 @@ export interface ICachedLeaf {
|
|
|
23
23
|
bounds: IBoundsData
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
|
|
26
27
|
export interface ILeafAttrData {
|
|
27
28
|
// layer data
|
|
28
29
|
id: __String
|
|
29
30
|
name: __String
|
|
30
31
|
className: __String
|
|
31
32
|
|
|
33
|
+
blendMode: IBlendMode
|
|
32
34
|
opacity: __Number
|
|
33
35
|
visible: __Boolean
|
|
36
|
+
isMask: __Boolean
|
|
34
37
|
zIndex: __Number
|
|
35
38
|
|
|
36
39
|
// layout data
|
|
@@ -45,16 +48,49 @@ export interface ILeafAttrData {
|
|
|
45
48
|
skewY: __Number
|
|
46
49
|
|
|
47
50
|
draggable: __Boolean
|
|
51
|
+
|
|
52
|
+
hittable: __Boolean
|
|
53
|
+
hitType: IHitType
|
|
54
|
+
hitChildren: __Boolean
|
|
48
55
|
}
|
|
49
56
|
|
|
57
|
+
export type IHitType =
|
|
58
|
+
| 'visible'
|
|
59
|
+
| 'fill-visible'
|
|
60
|
+
| 'stroke-visible'
|
|
61
|
+
| 'all'
|
|
62
|
+
| 'fill'
|
|
63
|
+
| 'stroke'
|
|
64
|
+
|
|
65
|
+
export type IBlendMode =
|
|
66
|
+
| 'pass-through'
|
|
67
|
+
| 'normal'
|
|
68
|
+
| 'multiply'
|
|
69
|
+
| 'screen'
|
|
70
|
+
| 'overlay'
|
|
71
|
+
| 'darken'
|
|
72
|
+
| 'lighten'
|
|
73
|
+
| 'color-dodge'
|
|
74
|
+
| 'color-burn'
|
|
75
|
+
| 'hard-light'
|
|
76
|
+
| 'soft-light'
|
|
77
|
+
| 'difference'
|
|
78
|
+
| 'exclusion'
|
|
79
|
+
| 'hue'
|
|
80
|
+
| 'saturation'
|
|
81
|
+
| 'color'
|
|
82
|
+
| 'luminosity'
|
|
83
|
+
|
|
50
84
|
export interface ILeafInputData {
|
|
51
85
|
// layer data
|
|
52
86
|
id?: __String
|
|
53
87
|
name?: __String
|
|
54
88
|
className?: __String
|
|
55
89
|
|
|
90
|
+
blendMode?: IBlendMode
|
|
56
91
|
opacity?: __Number
|
|
57
92
|
visible?: __Boolean
|
|
93
|
+
isMask?: __Boolean
|
|
58
94
|
zIndex?: __Number
|
|
59
95
|
|
|
60
96
|
// layout data
|
|
@@ -69,6 +105,10 @@ export interface ILeafInputData {
|
|
|
69
105
|
skewY?: __Number
|
|
70
106
|
|
|
71
107
|
draggable?: __Boolean
|
|
108
|
+
|
|
109
|
+
hittable?: __Boolean
|
|
110
|
+
hitType?: IHitType
|
|
111
|
+
hitChildren?: __Boolean
|
|
72
112
|
}
|
|
73
113
|
export interface ILeafComputedData {
|
|
74
114
|
// layer data
|
|
@@ -76,8 +116,10 @@ export interface ILeafComputedData {
|
|
|
76
116
|
name?: string
|
|
77
117
|
className?: string
|
|
78
118
|
|
|
119
|
+
blendMode?: IBlendMode
|
|
79
120
|
opacity?: number
|
|
80
121
|
visible?: boolean
|
|
122
|
+
isMask?: boolean
|
|
81
123
|
zIndex?: number
|
|
82
124
|
|
|
83
125
|
// layout data
|
|
@@ -92,37 +134,52 @@ export interface ILeafComputedData {
|
|
|
92
134
|
skewY?: number
|
|
93
135
|
|
|
94
136
|
draggable?: boolean
|
|
137
|
+
|
|
138
|
+
hittable?: boolean
|
|
139
|
+
hitType?: IHitType
|
|
140
|
+
hitChildren?: boolean
|
|
141
|
+
|
|
142
|
+
// other
|
|
143
|
+
__childBranchNumber?: number // 存在子分支的个数
|
|
144
|
+
__complex?: boolean // 外观是否复杂
|
|
95
145
|
}
|
|
96
146
|
|
|
97
147
|
export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
98
|
-
|
|
148
|
+
tag: string
|
|
149
|
+
readonly __tag: string
|
|
150
|
+
|
|
99
151
|
readonly __DataProcessor: IObject // IDataProcessor
|
|
100
152
|
readonly __LayoutProcessor: IObject // ILeafLayout
|
|
101
153
|
|
|
102
154
|
leafer?: ILeafer
|
|
103
|
-
root?: ILeaf
|
|
104
155
|
parent?: ILeaf
|
|
105
156
|
|
|
106
|
-
|
|
107
|
-
__childrenInteractionOff?: boolean
|
|
108
|
-
|
|
109
|
-
__isRoot?: boolean
|
|
157
|
+
isLeafer?: boolean
|
|
110
158
|
__isBranch?: boolean
|
|
111
159
|
__isBranchLeaf?: boolean
|
|
112
160
|
|
|
113
161
|
__: ILeafData
|
|
114
162
|
__layout: ILeafLayout
|
|
115
163
|
|
|
116
|
-
|
|
164
|
+
__local: IMatrixWithBoundsData
|
|
117
165
|
__world: IMatrixWithBoundsData
|
|
118
|
-
|
|
119
166
|
__worldOpacity: number
|
|
120
|
-
|
|
121
|
-
|
|
167
|
+
|
|
168
|
+
readonly worldTransform: IMatrixData
|
|
169
|
+
readonly localTransform: IMatrixData
|
|
170
|
+
|
|
171
|
+
readonly worldBoxBounds: IBoundsData
|
|
172
|
+
readonly worldStrokeBounds: IBoundsData
|
|
173
|
+
readonly worldRenderBounds: IBoundsData
|
|
174
|
+
|
|
175
|
+
readonly worldOpacity: number
|
|
176
|
+
|
|
177
|
+
__renderTime?: number // μs 1000微秒 = 1毫秒
|
|
122
178
|
|
|
123
179
|
__level: number // 图层级别 root(1) -> hight
|
|
124
180
|
__tempNumber?: number // 用于临时运算储存状态
|
|
125
181
|
|
|
182
|
+
__hasMask?: boolean
|
|
126
183
|
__hitCanvas?: IHitCanvas
|
|
127
184
|
|
|
128
185
|
__parentWait?: IFunction[]
|
|
@@ -130,39 +187,51 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
130
187
|
__addParentWait(item: IFunction): void
|
|
131
188
|
__runParentWait(): void
|
|
132
189
|
|
|
133
|
-
|
|
134
|
-
__setAsRoot(): void
|
|
190
|
+
__bindLeafer(leafer: ILeafer): void
|
|
135
191
|
|
|
136
|
-
|
|
192
|
+
set(data: IObject): void
|
|
193
|
+
get(attrNames?: string[]): IObject
|
|
137
194
|
|
|
138
195
|
// ILeafData ->
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
__updateAttr(attrName
|
|
196
|
+
__setAttr(attrName: string, newValue: __Value): void
|
|
197
|
+
__getAttr(attrName: string): __Value
|
|
198
|
+
__updateAttr(attrName?: string, value?: __Value): void
|
|
199
|
+
|
|
200
|
+
forceUpdate(): void
|
|
142
201
|
|
|
143
202
|
// ILeafMatrix ->
|
|
144
203
|
__updateWorldMatrix(): void
|
|
145
|
-
|
|
204
|
+
__updateLocalMatrix(): void
|
|
146
205
|
|
|
147
206
|
// ILeafBounds ->
|
|
148
207
|
__updateWorldBounds(): void
|
|
149
208
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
209
|
+
__updateLocalBoxBounds(): void
|
|
210
|
+
__updateLocalStrokeBounds(): void
|
|
211
|
+
__updateLocalRenderBounds(): void
|
|
153
212
|
|
|
154
213
|
__updateBoxBounds(): void
|
|
155
|
-
|
|
214
|
+
__updateStrokeBounds(): void
|
|
156
215
|
__updateRenderBounds(): void
|
|
157
216
|
|
|
158
|
-
|
|
217
|
+
__updateStrokeBoundsSpreadWidth(): number
|
|
159
218
|
__updateRenderBoundsSpreadWidth(): number
|
|
160
219
|
|
|
161
220
|
__onUpdateSize(): void
|
|
162
221
|
|
|
222
|
+
// convert
|
|
223
|
+
getWorld(attrName: IMatrixDecompositionAttr): number
|
|
224
|
+
getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
|
|
225
|
+
|
|
226
|
+
worldToLocal(world: IPointData, to?: IPointData, isMovePoint?: boolean): void
|
|
227
|
+
localToWorld(local: IPointData, to?: IPointData, isMovePoint?: boolean): void
|
|
228
|
+
worldToInner(world: IPointData, to?: IPointData, isMovePoint?: boolean): void
|
|
229
|
+
innerToWorld(inner: IPointData, to?: IPointData, isMovePoint?: boolean): void
|
|
230
|
+
|
|
163
231
|
// ILeafHit ->
|
|
164
232
|
__hitWorld(point: IRadiusPointData): boolean
|
|
165
233
|
__hit(local: IRadiusPointData): boolean
|
|
234
|
+
__drawHitPath(canvas: ILeaferCanvas): void
|
|
166
235
|
__updateHitCanvas(): void
|
|
167
236
|
|
|
168
237
|
// ILeafRender ->
|
|
@@ -170,7 +239,10 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
170
239
|
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
171
240
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
172
241
|
|
|
242
|
+
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
243
|
+
|
|
173
244
|
__updateWorldOpacity(): void
|
|
245
|
+
__updateRenderTime(): void
|
|
174
246
|
__updateChange(): void
|
|
175
247
|
|
|
176
248
|
// path
|
|
@@ -181,11 +253,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
181
253
|
|
|
182
254
|
// branch
|
|
183
255
|
children?: ILeaf[]
|
|
184
|
-
__childBranchNumber?: number // 存在子分支的个数
|
|
185
256
|
|
|
186
257
|
__updateSortChildren(): void
|
|
187
258
|
add(child: ILeaf, index?: number): void
|
|
188
259
|
remove(child?: ILeaf): void
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
260
|
+
}
|
|
@@ -5,15 +5,15 @@ export type ILeafBoundsModule = ILeafBounds & ThisType<ILeaf>
|
|
|
5
5
|
export interface ILeafBounds {
|
|
6
6
|
__updateWorldBounds?(): void
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
__updateLocalBoxBounds?(): void
|
|
9
|
+
__updateLocalStrokeBounds?(): void
|
|
10
|
+
__updateLocalRenderBounds?(): void
|
|
11
11
|
|
|
12
12
|
__updateBoxBounds?(): void
|
|
13
|
-
|
|
13
|
+
__updateStrokeBounds?(): void
|
|
14
14
|
__updateRenderBounds?(): void
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
__updateStrokeBoundsSpreadWidth?(): number
|
|
17
17
|
__updateRenderBoundsSpreadWidth?(): number
|
|
18
18
|
|
|
19
19
|
__onUpdateSize?(): void
|
|
@@ -4,8 +4,8 @@ import { __Value } from '../../data/IData'
|
|
|
4
4
|
export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
|
|
5
5
|
|
|
6
6
|
export interface ILeafDataProxy {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__updateAttr?(
|
|
7
|
+
__setAttr?(name: string, newValue: __Value): void
|
|
8
|
+
__getAttr?(name: string): __Value
|
|
9
|
+
__updateAttr?(name?: string, value?: __Value): void
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -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
|
}
|
|
@@ -6,12 +6,15 @@ 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
|
+
|
|
12
|
+
__renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
11
13
|
|
|
12
14
|
__drawBefore?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
13
15
|
__drawAfter?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
14
16
|
|
|
15
17
|
__updateWorldOpacity?(): void
|
|
18
|
+
__updateRenderTime?(): void
|
|
16
19
|
__updateChange?(): void
|
|
17
20
|
}
|
package/src/event/IEvent.ts
CHANGED
|
@@ -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
|
|
59
|
+
export interface IPropertyEvent extends IEvent {
|
|
56
60
|
readonly attrName: string
|
|
57
61
|
readonly oldValue: unknown
|
|
58
62
|
readonly newValue: unknown
|
package/src/event/IUIEvent.ts
CHANGED
|
@@ -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,9 @@
|
|
|
1
|
+
import { ILeaferImage, ILeaferImageConfig, ILeaferImageOnError, ILeaferImageOnLoaded } from './ILeaferImage'
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
export interface IImageManager {
|
|
5
|
+
get(config: ILeaferImageConfig): ILeaferImage
|
|
6
|
+
onLoad(config: ILeaferImageConfig, onLoaded: ILeaferImageOnLoaded): void
|
|
7
|
+
onError(config: ILeaferImageConfig, onError: ILeaferImageOnError): void
|
|
2
8
|
destory(): void
|
|
3
9
|
}
|
|
@@ -1,10 +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
|
+
}
|
|
6
11
|
|
|
12
|
+
export interface ILeaferImageOnError {
|
|
13
|
+
(error?: string | IObject, image?: ILeaferImage): any
|
|
14
|
+
}
|
|
7
15
|
|
|
8
16
|
export interface ILeaferImage {
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
}
|
|
24
|
+
|
|
25
|
+
export type IImageStatus = 'wait' | 'thumb-loading' | 'thumb-success' | 'thumb-error' | 'loading' | 'success' | 'error'
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { IApp } from './app/IApp'
|
|
2
|
-
export { ILeafer, ILeaferConfig, ICreator, IUICreator } from './app/ILeafer'
|
|
3
|
-
export { ILeaf, ILeafAttrData, ILeafComputedData, ILeafInputData, ICachedLeaf } from './display/ILeaf'
|
|
2
|
+
export { ILeafer, ILeaferType, 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
|
|
|
@@ -34,15 +34,15 @@ export { IPathDrawer } from './path/IPathDrawer'
|
|
|
34
34
|
export { IWindingRule, ICanvasContext2D, ITextMetrics, IPath2D } from './canvas/ICanvas'
|
|
35
35
|
export { CanvasPathCommand, IPathCommandData, MCommandData, HCommandData, VCommandData, LCommandData, CCommandData, SCommandData, QCommandData, TCommandData, ZCommandData, ACommandData, RectCommandData, RoundRectCommandData, EllipseCommandData, ArcCommandData, ArcToCommandData } from './path/IPathCommand'
|
|
36
36
|
|
|
37
|
-
export { ILeaferImage, ILeaferImageConfig } from './image/ILeaferImage'
|
|
37
|
+
export { ILeaferImage, ILeaferImageConfig, ILeaferImageOnLoaded, ILeaferImageOnError } from './image/ILeaferImage'
|
|
38
38
|
|
|
39
39
|
export { InnerId, IEventer, IEventListener, IEventListenerOptions, IEventListenerMap, IEventListenerItem, IEventListenerId } from './event/IEventer'
|
|
40
|
-
export { IEventTarget, 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'
|
|
40
|
+
export { IEventTarget, IEvent, ILeaferEvent, IPropertyEvent, 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, IImageEvent } from './event/IUIEvent'
|
|
42
|
+
export { IInteraction, IInteractionCanvas, IInteractionConfig, IWheelConfig, IPointerConfig } from './interaction/IInteraction'
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
export { __Number, __Boolean, __String, __Object, __Value, IObject, INumberMap, IStringMap, IBooleanMap, IDataTypeHandle } from './data/IData'
|
|
46
46
|
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'
|
|
47
|
+
export { IPoint, IPointData, IRadiusPointData, ISize, ISizeData, IScreenSizeData, IBounds, IBoundsData, IBoundsDataHandle, IOffsetBoundsData, ITwoPointBounds, ITwoPointBoundsData, IAutoBounds, IAutoBoundsData, IMatrix, IMatrixData, IMatrixWithBoundsData, IMatrixDecompositionData, IMatrixDecompositionAttr } from './math/IMath'
|
|
48
48
|
export { IFunction } from './function/IFunction'
|
|
@@ -4,12 +4,11 @@ import { ILeaf } from '../display/ILeaf'
|
|
|
4
4
|
import { ILeafList } from '../data/IList'
|
|
5
5
|
import { IPointData } from '../math/IMath'
|
|
6
6
|
import { ISelector } from '../selector/ISelector'
|
|
7
|
-
import { ILeaferCanvas } from '../canvas/ILeaferCanvas'
|
|
8
7
|
import { IBounds } from '../math/IMath'
|
|
9
8
|
|
|
10
9
|
export interface IInteraction {
|
|
11
10
|
target: ILeaf
|
|
12
|
-
canvas:
|
|
11
|
+
canvas: IInteractionCanvas
|
|
13
12
|
selector: ISelector
|
|
14
13
|
|
|
15
14
|
running: boolean
|
|
@@ -40,6 +39,11 @@ export interface IInteraction {
|
|
|
40
39
|
destroy(): void
|
|
41
40
|
}
|
|
42
41
|
|
|
42
|
+
export interface IInteractionCanvas {
|
|
43
|
+
bounds: IBounds
|
|
44
|
+
view: unknown
|
|
45
|
+
}
|
|
46
|
+
|
|
43
47
|
export interface IInteractionConfig {
|
|
44
48
|
wheel?: IWheelConfig
|
|
45
49
|
pointer?: IPointerConfig
|
|
@@ -54,16 +58,20 @@ export interface IWheelConfig {
|
|
|
54
58
|
delta?: IPointData // 以chrome为基准, 鼠标滚动一格的距离
|
|
55
59
|
getScale?: INumberFunction
|
|
56
60
|
getMove?: IPointDataFunction
|
|
61
|
+
preventDefault?: boolean
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
export interface IPointerConfig {
|
|
60
65
|
hitRadius?: number
|
|
61
66
|
through?: boolean
|
|
62
|
-
|
|
67
|
+
tapMulti?: boolean
|
|
68
|
+
tapTime?: number
|
|
63
69
|
longPressTime?: number
|
|
64
70
|
transformTime?: number
|
|
71
|
+
dragHover?: boolean
|
|
65
72
|
dragDistance?: number
|
|
66
73
|
swipeDistance?: number
|
|
67
74
|
autoMoveDistance?: number
|
|
68
|
-
ignoreMove
|
|
75
|
+
ignoreMove?: boolean // 性能优化字段, 控制move事件触发次数
|
|
76
|
+
preventDefault?: boolean
|
|
69
77
|
}
|
|
@@ -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' | '
|
|
5
|
-
export type ILayoutBoundsType = 'content' | 'box' | '
|
|
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
|
-
|
|
17
|
-
renderBounds: IBoundsData // |
|
|
16
|
+
strokeBounds: IBoundsData // | boxBounds + border |
|
|
17
|
+
renderBounds: IBoundsData // | strokeBounds + shadow |
|
|
18
18
|
|
|
19
19
|
// auto layout
|
|
20
|
-
marginBounds: IBoundsData // |
|
|
20
|
+
marginBounds: IBoundsData // | strokeBounds + margin |
|
|
21
21
|
contentBounds: IBoundsData // | content |
|
|
22
22
|
|
|
23
|
-
//
|
|
23
|
+
// local
|
|
24
24
|
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
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 数据更新
|
|
@@ -38,7 +38,7 @@ export interface ILeafLayout {
|
|
|
38
38
|
boundsChanged: boolean
|
|
39
39
|
|
|
40
40
|
boxBoundsChanged: boolean
|
|
41
|
-
|
|
41
|
+
strokeBoundsChanged: boolean
|
|
42
42
|
renderBoundsChanged: boolean
|
|
43
43
|
|
|
44
44
|
localBoxBoundsChanged: boolean // position
|
|
@@ -54,24 +54,25 @@ export interface ILeafLayout {
|
|
|
54
54
|
// keep state
|
|
55
55
|
affectScaleOrRotation: boolean
|
|
56
56
|
affectRotation: boolean
|
|
57
|
-
|
|
57
|
+
strokeBoundsSpreadWidth: number
|
|
58
58
|
renderBoundsSpreadWidth: number
|
|
59
59
|
renderShapeBoundsSpreadWidth: number
|
|
60
60
|
|
|
61
61
|
update(): void
|
|
62
62
|
|
|
63
|
-
getTransform(
|
|
64
|
-
|
|
63
|
+
getTransform(locationType: ILayoutLocationType): IMatrixData
|
|
64
|
+
getMatrixDecompositionData(locationType: ILayoutLocationType): IMatrixDecompositionData
|
|
65
|
+
getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType): IBoundsData
|
|
65
66
|
|
|
66
67
|
// 独立 / 引用 boxBounds
|
|
67
|
-
|
|
68
|
+
strokeBoundsSpread(): void
|
|
68
69
|
renderBoundsSpread(): void
|
|
69
|
-
|
|
70
|
+
strokeBoundsSpreadCancel(): void
|
|
70
71
|
renderBoundsSpreadCancel(): void
|
|
71
72
|
|
|
72
73
|
// bounds
|
|
73
74
|
boxBoundsChange(): void
|
|
74
|
-
|
|
75
|
+
strokeBoundsChange(): void
|
|
75
76
|
renderBoundsChange(): void
|
|
76
77
|
|
|
77
78
|
// matrix
|
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):
|
|
13
|
+
rotate(angle: number, center?: IPointData): IPoint
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
58
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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
|
-
|
|
83
|
+
reset(): void
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
export interface ITwoPointBoundsData {
|
|
@@ -120,21 +122,56 @@ export interface IMatrixData {
|
|
|
120
122
|
e: number
|
|
121
123
|
f: number
|
|
122
124
|
}
|
|
125
|
+
|
|
126
|
+
export interface IMatrixDecompositionData {
|
|
127
|
+
x: number
|
|
128
|
+
y: number
|
|
129
|
+
scaleX: number
|
|
130
|
+
scaleY: number
|
|
131
|
+
rotation: number
|
|
132
|
+
skewX: number
|
|
133
|
+
skewY: number
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export type IMatrixDecompositionAttr =
|
|
137
|
+
| 'x'
|
|
138
|
+
| 'y'
|
|
139
|
+
| 'scaleX'
|
|
140
|
+
| 'scaleY'
|
|
141
|
+
| 'rotation'
|
|
142
|
+
| 'skewX'
|
|
143
|
+
| 'skewY'
|
|
144
|
+
|
|
123
145
|
export interface IMatrix extends IMatrixData {
|
|
124
146
|
set(a: number, b: number, c: number, d: number, e: number, f: number): void
|
|
125
147
|
copy(matrix: IMatrixData): IMatrix
|
|
126
148
|
clone(): IMatrix
|
|
127
149
|
|
|
128
150
|
translate(x: number, y: number): IMatrix
|
|
151
|
+
translateInner(x: number, y: number): IMatrix
|
|
152
|
+
|
|
129
153
|
scale(x: number, y?: number): IMatrix
|
|
154
|
+
scaleOf(center: IPointData, x: number, y?: number): IMatrix
|
|
155
|
+
scaleOfInner(center: IPointData, x: number, y?: number): IMatrix
|
|
156
|
+
|
|
130
157
|
rotate(angle: number): IMatrix
|
|
158
|
+
rotateOf(center: IPointData, angle: number): IMatrix
|
|
159
|
+
rotateOfInner(center: IPointData, angle: number): IMatrix
|
|
160
|
+
|
|
161
|
+
skew(x: number, y?: number): IMatrix
|
|
162
|
+
skewOf(center: IPointData, x: number, y?: number): IMatrix
|
|
163
|
+
skewOfInner(center: IPointData, x: number, y?: number): IMatrix
|
|
164
|
+
|
|
165
|
+
multiply(matrix: IMatrixData): IMatrix
|
|
166
|
+
divide(matrix: IMatrixData): IMatrix
|
|
167
|
+
invert(): IMatrix
|
|
168
|
+
|
|
169
|
+
toOuterPoint(inner: IPointData, to?: IPointData): void
|
|
170
|
+
toInnerPoint(outer: IPointData, to?: IPointData): void
|
|
131
171
|
|
|
132
|
-
|
|
133
|
-
divide(matrix: IMatrixData): void
|
|
134
|
-
invert(): void
|
|
172
|
+
decompose(): IMatrixDecompositionData
|
|
135
173
|
|
|
136
|
-
|
|
137
|
-
toLocalPoint(world: IPointData, local?: IPointData): void
|
|
174
|
+
reset(): void
|
|
138
175
|
}
|
|
139
176
|
|
|
140
177
|
|
|
@@ -38,8 +38,8 @@ export interface IRenderer {
|
|
|
38
38
|
render(callback?: IFunction): void
|
|
39
39
|
renderOnce(callback?: IFunction): void
|
|
40
40
|
partRender(): void
|
|
41
|
-
clipRender(bounds: IBounds
|
|
42
|
-
fullRender(
|
|
41
|
+
clipRender(bounds: IBounds): void
|
|
42
|
+
fullRender(): void
|
|
43
43
|
|
|
44
44
|
addBlock(block: IBounds): void
|
|
45
45
|
mergeBlocks(): void
|