@leafer/interface 1.0.0-alpha.21 → 1.0.0-alpha.30
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 +36 -21
- package/src/canvas/ICanvas.ts +2 -16
- package/src/canvas/ILeaferCanvas.ts +32 -7
- package/src/control/IControl.ts +5 -0
- package/src/data/IData.ts +1 -2
- package/src/data/ILeafData.ts +5 -0
- package/src/display/IBranch.ts +3 -3
- package/src/display/ILeaf.ts +100 -32
- package/src/display/module/ILeafBounds.ts +5 -5
- package/src/display/module/ILeafDataProxy.ts +2 -3
- package/src/display/module/ILeafHit.ts +2 -0
- package/src/display/module/ILeafMask.ts +11 -0
- package/src/display/module/ILeafMatrix.ts +1 -1
- package/src/display/module/ILeafRender.ts +2 -0
- package/src/event/IEvent.ts +6 -1
- package/src/event/IUIEvent.ts +10 -0
- package/src/image/IImageManager.ts +6 -0
- package/src/image/ILeaferImage.ts +14 -1
- package/src/index.ts +12 -10
- package/src/interaction/IInteraction.ts +14 -9
- package/src/layout/ILeafLayout.ts +20 -19
- package/src/layouter/ILayouter.ts +9 -8
- package/src/math/IMath.ts +46 -7
- package/src/path/IPathCommand.ts +3 -3
- package/src/path/IPathDrawer.ts +22 -2
- package/src/platform/IPlatform.ts +3 -0
- package/src/renderer/IRenderer.ts +12 -7
- package/src/selector/ISelector.ts +9 -2
- package/src/watcher/IWatcher.ts +4 -4
package/package.json
CHANGED
package/src/app/IApp.ts
CHANGED
package/src/app/ILeafer.ts
CHANGED
|
@@ -2,36 +2,40 @@ import { ILeaf } from '../display/ILeaf'
|
|
|
2
2
|
import { IRenderer, IRendererConfig } from '../renderer/IRenderer'
|
|
3
3
|
import { IHitCanvas, ILeaferCanvas, ILeaferCanvasConfig, IHitCanvasConfig } from '../canvas/ILeaferCanvas'
|
|
4
4
|
import { ILayouter, ILayouterConfig } from '../layouter/ILayouter'
|
|
5
|
-
import { ISelector } from '../selector/ISelector'
|
|
6
|
-
import { IInteraction, IInteractionConfig } from '../interaction/IInteraction'
|
|
7
|
-
import { IWatcher } from '../watcher/IWatcher'
|
|
5
|
+
import { ISelector, ISelectorConfig } from '../selector/ISelector'
|
|
6
|
+
import { IInteraction, IInteractionCanvas, IInteractionConfig } from '../interaction/IInteraction'
|
|
7
|
+
import { IWatcher, IWatcherConfig } from '../watcher/IWatcher'
|
|
8
8
|
import { IAutoBounds, IScreenSizeData } from '../math/IMath'
|
|
9
9
|
import { ICanvasManager } from '../canvas/ICanvasManager'
|
|
10
10
|
import { IHitCanvasManager } from '../canvas/IHitCanvasManager'
|
|
11
11
|
import { IImageManager } from '../image/IImageManager'
|
|
12
|
+
import { IEventListenerId } from '../event/IEventer'
|
|
12
13
|
import { IObject } from '../data/IData'
|
|
13
14
|
import { IZoomView } from '../display/IView'
|
|
14
15
|
import { IApp } from './IApp'
|
|
15
16
|
import { ILeaferImage, ILeaferImageConfig } from '../image/ILeaferImage'
|
|
16
|
-
import {
|
|
17
|
+
import { IControl } from '../control/IControl'
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
export type ILeaferType = 'draw' | 'design' | 'board' | 'document' | 'user'
|
|
19
21
|
export interface ILeaferConfig extends IRendererConfig, ILeaferCanvasConfig, IInteractionConfig, ILayouterConfig {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
start?: boolean
|
|
23
|
+
type?: ILeaferType
|
|
24
|
+
realCanvas?: boolean
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
export interface ILeafer extends IZoomView {
|
|
26
|
-
|
|
27
|
-
creator: ICreator
|
|
27
|
+
export interface ILeafer extends IZoomView, IControl {
|
|
28
28
|
|
|
29
29
|
readonly isApp: boolean
|
|
30
30
|
parent?: IApp
|
|
31
31
|
|
|
32
32
|
running: boolean
|
|
33
|
+
ready: boolean
|
|
34
|
+
viewReady: boolean
|
|
33
35
|
|
|
34
|
-
|
|
36
|
+
pixelRatio: number
|
|
37
|
+
|
|
38
|
+
view: unknown
|
|
35
39
|
|
|
36
40
|
canvas: ILeaferCanvas
|
|
37
41
|
renderer: IRenderer
|
|
@@ -46,28 +50,39 @@ export interface ILeafer extends IZoomView {
|
|
|
46
50
|
hitCanvasManager?: IHitCanvasManager
|
|
47
51
|
imageManager: IImageManager
|
|
48
52
|
|
|
53
|
+
autoLayout?: IAutoBounds
|
|
54
|
+
|
|
49
55
|
config: ILeaferConfig
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
__eventIds: IEventListenerId[]
|
|
58
|
+
|
|
59
|
+
init(userConfig?: ILeaferConfig, parentApp?: IApp): void
|
|
60
|
+
|
|
61
|
+
forceFullRender(): void
|
|
53
62
|
|
|
54
63
|
resize(size: IScreenSizeData): void
|
|
55
64
|
}
|
|
56
65
|
|
|
57
|
-
export interface
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
export interface ILeaferTypeFunction {
|
|
67
|
+
(leafer: ILeafer): void
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ILeaferTypeList {
|
|
71
|
+
[key: string]: ILeaferTypeFunction
|
|
72
|
+
}
|
|
73
|
+
|
|
60
74
|
|
|
75
|
+
export interface ICreator {
|
|
61
76
|
image?(options?: ILeaferImageConfig): ILeaferImage
|
|
62
77
|
canvas?(options?: ILeaferCanvasConfig, manager?: ICanvasManager): ILeaferCanvas
|
|
63
78
|
hitCanvas?(options?: IHitCanvasConfig, manager?: ICanvasManager): IHitCanvas
|
|
64
79
|
|
|
65
|
-
watcher?(target: ILeaf): IWatcher
|
|
66
|
-
layouter?(target: ILeaf): ILayouter
|
|
67
|
-
renderer?(target: ILeaf, canvas: ILeaferCanvas, options
|
|
68
|
-
selector?(target: ILeaf): ISelector
|
|
80
|
+
watcher?(target: ILeaf, options?: IWatcherConfig): IWatcher
|
|
81
|
+
layouter?(target: ILeaf, options?: ILayouterConfig): ILayouter
|
|
82
|
+
renderer?(target: ILeaf, canvas: ILeaferCanvas, options?: IRendererConfig): IRenderer
|
|
83
|
+
selector?(target: ILeaf, options?: ISelectorConfig): ISelector
|
|
69
84
|
|
|
70
|
-
interaction?(target: ILeaf, canvas:
|
|
85
|
+
interaction?(target: ILeaf, canvas: IInteractionCanvas, selector: ISelector, options?: IInteractionConfig): IInteraction
|
|
71
86
|
}
|
|
72
87
|
|
|
73
88
|
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
|
|
|
@@ -89,11 +81,11 @@ interface CanvasImageSmoothing {
|
|
|
89
81
|
}
|
|
90
82
|
|
|
91
83
|
interface CanvasPath {
|
|
92
|
-
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number,
|
|
84
|
+
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
|
|
93
85
|
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void
|
|
94
86
|
bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void
|
|
95
87
|
closePath(): void
|
|
96
|
-
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number,
|
|
88
|
+
ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void
|
|
97
89
|
lineTo(x: number, y: number): void
|
|
98
90
|
moveTo(x: number, y: number): void
|
|
99
91
|
quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void
|
|
@@ -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,7 @@ export interface ILeaferCanvasConfig extends IAutoBoundsData {
|
|
|
10
10
|
view?: string | IObject
|
|
11
11
|
fill?: string
|
|
12
12
|
pixelRatio?: number
|
|
13
|
+
smooth?: boolean
|
|
13
14
|
hittable?: boolean
|
|
14
15
|
offscreen?: boolean
|
|
15
16
|
webgl?: boolean
|
|
@@ -28,7 +29,7 @@ export interface ICanvasStrokeOptions {
|
|
|
28
29
|
miterLimit?: number
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
export interface ICanvasAttr extends ICanvasStrokeOptions {
|
|
32
|
+
export interface ICanvasAttr extends ICanvasStrokeOptions, IObject {
|
|
32
33
|
|
|
33
34
|
smooth: boolean // imageSmoothingEnabled: boolean
|
|
34
35
|
smoothLevel: string // imageSmoothingQuality: string
|
|
@@ -73,6 +74,7 @@ interface ICanvasMethod {
|
|
|
73
74
|
strokeRect(x: number, y: number, width: number, height: number): void
|
|
74
75
|
clearRect(x: number, y: number, width: number, height: number): void
|
|
75
76
|
|
|
77
|
+
transform(a: number, b: number, c: number, d: number, e: number, f: number): void
|
|
76
78
|
translate(x: number, y: number): void
|
|
77
79
|
scale(x: number, y: number): void
|
|
78
80
|
rotate(angle: number): void
|
|
@@ -98,10 +100,14 @@ interface ICanvasMethod {
|
|
|
98
100
|
|
|
99
101
|
// custom
|
|
100
102
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
saveBlendMode(blendMode?: string): void
|
|
104
|
+
restoreBlendMode(): void
|
|
105
|
+
|
|
106
|
+
hitFill(point: IPointData, fillRule?: string): boolean
|
|
107
|
+
hitStroke(point: IPointData, strokeWidth?: number): boolean
|
|
103
108
|
|
|
104
109
|
setStroke(strokeStyle: string | object, strokeWidth: number, options?: ICanvasStrokeOptions): void
|
|
110
|
+
setStrokeOptions(options: ICanvasStrokeOptions): void
|
|
105
111
|
|
|
106
112
|
setWorld(matrix: IMatrixData, parentMatrix?: IMatrixData): void
|
|
107
113
|
|
|
@@ -109,7 +115,9 @@ interface ICanvasMethod {
|
|
|
109
115
|
setWorldBlur(blur: number): void
|
|
110
116
|
|
|
111
117
|
copyWorld(canvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData, blendMode?: string): void
|
|
112
|
-
|
|
118
|
+
copyWorldToInner(canvas: ILeaferCanvas, fromWorld: IMatrixWithBoundsData, toInnerBounds: IBoundsData, blendMode?: string): void
|
|
119
|
+
useMask(maskCanvas: ILeaferCanvas, fromBounds?: IBoundsData, toBounds?: IBoundsData): void
|
|
120
|
+
|
|
113
121
|
fillWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void
|
|
114
122
|
strokeWorld(bounds: IBoundsData, color: string | object, blendMode?: string): void
|
|
115
123
|
clipWorld(bounds: IBoundsData, ceilPixel?: boolean): void
|
|
@@ -120,9 +128,10 @@ interface ICanvasMethod {
|
|
|
120
128
|
|
|
121
129
|
export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
122
130
|
|
|
123
|
-
manager: ICanvasManager
|
|
124
|
-
|
|
125
131
|
readonly innerId: InnerId
|
|
132
|
+
name: string
|
|
133
|
+
|
|
134
|
+
manager: ICanvasManager
|
|
126
135
|
|
|
127
136
|
width: number
|
|
128
137
|
height: number
|
|
@@ -130,20 +139,35 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
130
139
|
pixelRatio: number
|
|
131
140
|
readonly pixelWidth: number
|
|
132
141
|
readonly pixelHeight: number
|
|
142
|
+
readonly allowBackgroundColor?: boolean
|
|
133
143
|
|
|
134
144
|
bounds: IBounds
|
|
135
145
|
|
|
146
|
+
config: ILeaferCanvasConfig
|
|
147
|
+
|
|
148
|
+
autoLayout: boolean
|
|
149
|
+
|
|
136
150
|
view: unknown
|
|
151
|
+
parentView: unknown
|
|
152
|
+
|
|
153
|
+
unreal?: boolean
|
|
154
|
+
|
|
137
155
|
offscreen: boolean
|
|
156
|
+
|
|
138
157
|
context: ICanvasContext2D
|
|
139
158
|
|
|
140
159
|
recycled?: boolean
|
|
141
160
|
|
|
161
|
+
init(): void
|
|
162
|
+
|
|
163
|
+
setBackgroundColor(color: string): void
|
|
164
|
+
setHittable(hittable: boolean): void
|
|
165
|
+
|
|
142
166
|
startAutoLayout(autoBounds: IAutoBounds, listener: IResizeEventListener): void
|
|
143
167
|
stopAutoLayout(): void
|
|
144
168
|
|
|
145
169
|
resize(size: IScreenSizeData): void
|
|
146
|
-
|
|
170
|
+
setViewSize(size: IScreenSizeData): void
|
|
147
171
|
|
|
148
172
|
// other
|
|
149
173
|
isSameSize(options: ILeaferCanvasConfig): boolean
|
|
@@ -152,6 +176,7 @@ export interface ILeaferCanvas extends ICanvasAttr, ICanvasMethod, IPathDrawer {
|
|
|
152
176
|
useSameTransform(canvas: ILeaferCanvas): void
|
|
153
177
|
recycle(): void
|
|
154
178
|
|
|
179
|
+
unrealCanvas(): void
|
|
155
180
|
destroy(): void
|
|
156
181
|
}
|
|
157
182
|
|
package/src/data/IData.ts
CHANGED
|
@@ -3,8 +3,7 @@ export type __Boolean = boolean // boolean | string will convert to boolean
|
|
|
3
3
|
export type __String = string // string | other will convert to string
|
|
4
4
|
export type __Object = IObject // will convert to object
|
|
5
5
|
export type __Value = __Number | __Boolean | __String | __Object //
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
export type ITimer = any
|
|
8
7
|
export interface IObject {
|
|
9
8
|
[name: string]: any
|
|
10
9
|
}
|
package/src/data/ILeafData.ts
CHANGED
|
@@ -5,8 +5,13 @@ export interface IDataProcessor extends IObject {
|
|
|
5
5
|
__leaf: ILeaf
|
|
6
6
|
__input: IObject
|
|
7
7
|
__middle: IObject
|
|
8
|
+
__get(name: string): unknown
|
|
9
|
+
|
|
8
10
|
__setInput(name: string, value: unknown): void
|
|
9
11
|
__getInput(name: string): unknown
|
|
12
|
+
__removeInput(name: string): void
|
|
13
|
+
__getInputData(): IObject
|
|
14
|
+
|
|
10
15
|
__setMiddle(name: string, value: unknown): void
|
|
11
16
|
__getMiddle(name: string): unknown
|
|
12
17
|
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,15 +5,16 @@ 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
|
+
import { ILeafMask } from './module/ILeafMask'
|
|
17
18
|
import { ILeafData } from '../data/ILeafData'
|
|
18
19
|
|
|
19
20
|
|
|
@@ -30,8 +31,10 @@ export interface ILeafAttrData {
|
|
|
30
31
|
name: __String
|
|
31
32
|
className: __String
|
|
32
33
|
|
|
34
|
+
blendMode: IBlendMode
|
|
33
35
|
opacity: __Number
|
|
34
36
|
visible: __Boolean
|
|
37
|
+
isMask: __Boolean
|
|
35
38
|
zIndex: __Number
|
|
36
39
|
|
|
37
40
|
// layout data
|
|
@@ -48,11 +51,35 @@ export interface ILeafAttrData {
|
|
|
48
51
|
draggable: __Boolean
|
|
49
52
|
|
|
50
53
|
hittable: __Boolean
|
|
51
|
-
|
|
54
|
+
hitFill: IHitType
|
|
55
|
+
hitStroke: IHitType
|
|
52
56
|
hitChildren: __Boolean
|
|
57
|
+
hitSelf: __Boolean
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
export type IHitType =
|
|
60
|
+
export type IHitType =
|
|
61
|
+
| 'visible'
|
|
62
|
+
| 'always'
|
|
63
|
+
| 'none'
|
|
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'
|
|
56
83
|
|
|
57
84
|
export interface ILeafInputData {
|
|
58
85
|
// layer data
|
|
@@ -60,8 +87,10 @@ export interface ILeafInputData {
|
|
|
60
87
|
name?: __String
|
|
61
88
|
className?: __String
|
|
62
89
|
|
|
90
|
+
blendMode?: IBlendMode
|
|
63
91
|
opacity?: __Number
|
|
64
92
|
visible?: __Boolean
|
|
93
|
+
isMask?: __Boolean
|
|
65
94
|
zIndex?: __Number
|
|
66
95
|
|
|
67
96
|
// layout data
|
|
@@ -78,8 +107,10 @@ export interface ILeafInputData {
|
|
|
78
107
|
draggable?: __Boolean
|
|
79
108
|
|
|
80
109
|
hittable?: __Boolean
|
|
81
|
-
|
|
110
|
+
hitFill?: IHitType
|
|
111
|
+
hitStroke?: IHitType
|
|
82
112
|
hitChildren?: __Boolean
|
|
113
|
+
hitSelf?: __Boolean
|
|
83
114
|
}
|
|
84
115
|
export interface ILeafComputedData {
|
|
85
116
|
// layer data
|
|
@@ -87,8 +118,10 @@ export interface ILeafComputedData {
|
|
|
87
118
|
name?: string
|
|
88
119
|
className?: string
|
|
89
120
|
|
|
121
|
+
blendMode?: IBlendMode
|
|
90
122
|
opacity?: number
|
|
91
123
|
visible?: boolean
|
|
124
|
+
isMask?: boolean
|
|
92
125
|
zIndex?: number
|
|
93
126
|
|
|
94
127
|
// layout data
|
|
@@ -105,79 +138,114 @@ export interface ILeafComputedData {
|
|
|
105
138
|
draggable?: boolean
|
|
106
139
|
|
|
107
140
|
hittable?: boolean
|
|
108
|
-
|
|
141
|
+
hitFill?: IHitType
|
|
142
|
+
hitStroke?: IHitType
|
|
109
143
|
hitChildren?: boolean
|
|
144
|
+
hitSelf?: boolean
|
|
110
145
|
|
|
111
146
|
// other
|
|
112
147
|
__childBranchNumber?: number // 存在子分支的个数
|
|
113
148
|
__complex?: boolean // 外观是否复杂
|
|
114
149
|
}
|
|
115
150
|
|
|
116
|
-
export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
117
|
-
|
|
151
|
+
export interface ILeaf extends ILeafMask, ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix, ILeafDataProxy, ILeafInputData, IEventer {
|
|
152
|
+
tag: string
|
|
153
|
+
readonly __tag: string
|
|
154
|
+
readonly innerName: string
|
|
155
|
+
|
|
118
156
|
readonly __DataProcessor: IObject // IDataProcessor
|
|
119
157
|
readonly __LayoutProcessor: IObject // ILeafLayout
|
|
120
158
|
|
|
121
159
|
leafer?: ILeafer
|
|
122
|
-
root?: ILeaf
|
|
123
160
|
parent?: ILeaf
|
|
124
161
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
162
|
+
readonly isApp?: boolean
|
|
163
|
+
isLeafer?: boolean
|
|
164
|
+
isBranch?: boolean
|
|
165
|
+
isBranchLeaf?: boolean
|
|
128
166
|
|
|
129
167
|
__: ILeafData
|
|
130
168
|
__layout: ILeafLayout
|
|
131
169
|
|
|
132
|
-
|
|
170
|
+
__local: IMatrixWithBoundsData
|
|
133
171
|
__world: IMatrixWithBoundsData
|
|
134
|
-
|
|
135
172
|
__worldOpacity: number
|
|
136
|
-
|
|
173
|
+
|
|
174
|
+
readonly worldTransform: IMatrixData
|
|
175
|
+
readonly localTransform: IMatrixData
|
|
176
|
+
|
|
177
|
+
readonly worldBoxBounds: IBoundsData
|
|
178
|
+
readonly worldStrokeBounds: IBoundsData
|
|
179
|
+
readonly worldRenderBounds: IBoundsData
|
|
180
|
+
|
|
181
|
+
readonly worldOpacity: number
|
|
182
|
+
|
|
183
|
+
__renderTime?: number // μs 1000微秒 = 1毫秒
|
|
137
184
|
|
|
138
185
|
__level: number // 图层级别 root(1) -> hight
|
|
139
186
|
__tempNumber?: number // 用于临时运算储存状态
|
|
140
187
|
|
|
188
|
+
__hasMask?: boolean
|
|
141
189
|
__hitCanvas?: IHitCanvas
|
|
142
190
|
|
|
191
|
+
readonly __onlyHitMask: boolean
|
|
192
|
+
readonly __ignoreHitWorld: boolean
|
|
193
|
+
|
|
143
194
|
__parentWait?: IFunction[]
|
|
195
|
+
__leaferWait?: IFunction[]
|
|
144
196
|
|
|
145
|
-
|
|
146
|
-
|
|
197
|
+
waitParent(item: IFunction): void
|
|
198
|
+
waitLeafer(item: IFunction): void
|
|
147
199
|
|
|
148
|
-
|
|
149
|
-
__setAsRoot(): void
|
|
200
|
+
__bindLeafer(leafer: ILeafer | null): void
|
|
150
201
|
|
|
151
|
-
|
|
202
|
+
set(data: IObject): void
|
|
203
|
+
get(attrNames?: string[]): IObject
|
|
152
204
|
|
|
153
205
|
// ILeafData ->
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
206
|
+
__setAttr(attrName: string, newValue: __Value): void
|
|
207
|
+
__getAttr(attrName: string): __Value
|
|
208
|
+
|
|
209
|
+
forceUpdate(attrName?: string): void
|
|
157
210
|
|
|
158
211
|
// ILeafMatrix ->
|
|
159
212
|
__updateWorldMatrix(): void
|
|
160
|
-
|
|
213
|
+
__updateLocalMatrix(): void
|
|
161
214
|
|
|
162
215
|
// ILeafBounds ->
|
|
163
216
|
__updateWorldBounds(): void
|
|
164
217
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
218
|
+
__updateLocalBoxBounds(): void
|
|
219
|
+
__updateLocalStrokeBounds(): void
|
|
220
|
+
__updateLocalRenderBounds(): void
|
|
168
221
|
|
|
169
222
|
__updateBoxBounds(): void
|
|
170
|
-
|
|
223
|
+
__updateStrokeBounds(): void
|
|
171
224
|
__updateRenderBounds(): void
|
|
172
225
|
|
|
173
|
-
|
|
226
|
+
__updateStrokeBoundsSpreadWidth(): number
|
|
174
227
|
__updateRenderBoundsSpreadWidth(): number
|
|
175
228
|
|
|
176
229
|
__onUpdateSize(): void
|
|
177
230
|
|
|
231
|
+
// IBranchMask ->
|
|
232
|
+
__updateMask(value?: boolean): void
|
|
233
|
+
__renderMask(canvas: ILeaferCanvas, content: ILeaferCanvas, mask: ILeaferCanvas): void
|
|
234
|
+
__removeMask(child?: ILeaf): void
|
|
235
|
+
|
|
236
|
+
// convert
|
|
237
|
+
getWorld(attrName: IMatrixDecompositionAttr): number
|
|
238
|
+
getBounds(type: ILayoutBoundsType, locationType?: ILayoutLocationType): IBoundsData
|
|
239
|
+
|
|
240
|
+
worldToLocal(world: IPointData, to?: IPointData, isMovePoint?: boolean): void
|
|
241
|
+
localToWorld(local: IPointData, to?: IPointData, isMovePoint?: boolean): void
|
|
242
|
+
worldToInner(world: IPointData, to?: IPointData, isMovePoint?: boolean): void
|
|
243
|
+
innerToWorld(inner: IPointData, to?: IPointData, isMovePoint?: boolean): void
|
|
244
|
+
|
|
178
245
|
// ILeafHit ->
|
|
179
246
|
__hitWorld(point: IRadiusPointData): boolean
|
|
180
247
|
__hit(local: IRadiusPointData): boolean
|
|
248
|
+
__drawHitPath(canvas: ILeaferCanvas): void
|
|
181
249
|
__updateHitCanvas(): void
|
|
182
250
|
|
|
183
251
|
// ILeafRender ->
|
|
@@ -185,6 +253,8 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
185
253
|
__drawFast(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
186
254
|
__draw(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
187
255
|
|
|
256
|
+
__renderShape(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
257
|
+
|
|
188
258
|
__updateWorldOpacity(): void
|
|
189
259
|
__updateRenderTime(): void
|
|
190
260
|
__updateChange(): void
|
|
@@ -201,6 +271,4 @@ export interface ILeaf extends ILeafRender, ILeafHit, ILeafBounds, ILeafMatrix,
|
|
|
201
271
|
__updateSortChildren(): void
|
|
202
272
|
add(child: ILeaf, index?: number): void
|
|
203
273
|
remove(child?: ILeaf): void
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
274
|
+
}
|
|
@@ -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,7 @@ import { __Value } from '../../data/IData'
|
|
|
4
4
|
export type ILeafDataProxyModule = ILeafDataProxy & ThisType<ILeaf>
|
|
5
5
|
|
|
6
6
|
export interface ILeafDataProxy {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
__updateAttr?(attrName: string): void
|
|
7
|
+
__setAttr?(name: string, newValue: __Value): void
|
|
8
|
+
__getAttr?(name: string): __Value
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -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
|
+
|
|
@@ -9,6 +9,8 @@ export interface ILeafRender {
|
|
|
9
9
|
__draw?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
10
10
|
__drawFast?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
11
11
|
|
|
12
|
+
__renderShape?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
13
|
+
|
|
12
14
|
__drawBefore?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
13
15
|
__drawAfter?(canvas: ILeaferCanvas, options: IRenderOptions): void
|
|
14
16
|
|