@leafer/layout 1.0.0-beta.9 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -5
- package/src/LeafLayout.ts +10 -9
- package/types/index.d.ts +61 -0
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/layout",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc.2",
|
|
4
4
|
"description": "@leafer/layout",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
|
+
"types": "types/index.d.ts",
|
|
8
9
|
"files": [
|
|
9
|
-
"src"
|
|
10
|
+
"src",
|
|
11
|
+
"types",
|
|
12
|
+
"dist"
|
|
10
13
|
],
|
|
11
14
|
"repository": {
|
|
12
15
|
"type": "git",
|
|
@@ -19,10 +22,10 @@
|
|
|
19
22
|
"leaferjs"
|
|
20
23
|
],
|
|
21
24
|
"dependencies": {
|
|
22
|
-
"@leafer/math": "1.0.0-
|
|
23
|
-
"@leafer/platform": "1.0.0-
|
|
25
|
+
"@leafer/math": "1.0.0-rc.2",
|
|
26
|
+
"@leafer/platform": "1.0.0-rc.2"
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
26
|
-
"@leafer/interface": "1.0.0-
|
|
29
|
+
"@leafer/interface": "1.0.0-rc.2"
|
|
27
30
|
}
|
|
28
31
|
}
|
package/src/LeafLayout.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILeaf, ILeafLayout, ILayoutLocationType, ILayoutBoundsType, IBoundsData, IMatrixData
|
|
2
|
-
import { BoundsHelper
|
|
1
|
+
import { ILeaf, ILeafLayout, ILayoutLocationType, ILayoutBoundsType, IBoundsData, IMatrixData } from '@leafer/interface'
|
|
2
|
+
import { BoundsHelper } from '@leafer/math'
|
|
3
3
|
import { Platform } from '@leafer/platform'
|
|
4
4
|
|
|
5
5
|
|
|
@@ -59,6 +59,7 @@ export class LeafLayout implements ILeafLayout {
|
|
|
59
59
|
// keep state
|
|
60
60
|
public affectScaleOrRotation: boolean
|
|
61
61
|
public affectRotation: boolean
|
|
62
|
+
public affectChildrenSort?: boolean
|
|
62
63
|
|
|
63
64
|
public strokeSpread: number
|
|
64
65
|
public renderSpread: number
|
|
@@ -95,11 +96,6 @@ export class LeafLayout implements ILeafLayout {
|
|
|
95
96
|
return locationType === 'world' ? this.leaf.__world : this.leaf.__local
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
public decomposeTransform(locationType: ILayoutLocationType): IMatrixDecompositionData {
|
|
99
|
-
this.checkUpdate()
|
|
100
|
-
return MatrixHelper.decompose(locationType === 'world' ? this.leaf.__world : this.leaf.__local)
|
|
101
|
-
}
|
|
102
|
-
|
|
103
99
|
public getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType): IBoundsData {
|
|
104
100
|
|
|
105
101
|
this.checkUpdate()
|
|
@@ -258,8 +254,13 @@ export class LeafLayout implements ILeafLayout {
|
|
|
258
254
|
this.surfaceChanged || this.surfaceChange()
|
|
259
255
|
}
|
|
260
256
|
|
|
261
|
-
public
|
|
262
|
-
this.
|
|
257
|
+
public childrenSortChange(): void {
|
|
258
|
+
if (!this.childrenSortChanged) {
|
|
259
|
+
this.childrenSortChanged = true
|
|
260
|
+
this.leaf.forceUpdate('surface')
|
|
261
|
+
}
|
|
263
262
|
}
|
|
264
263
|
|
|
264
|
+
public destroy(): void { }
|
|
265
|
+
|
|
265
266
|
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ILeafLayout, ILeaf, IBoundsData, ILayoutLocationType, IMatrixData, ILayoutBoundsType } from '@leafer/interface';
|
|
2
|
+
|
|
3
|
+
declare class LeafLayout implements ILeafLayout {
|
|
4
|
+
leaf: ILeaf;
|
|
5
|
+
useZoomProxy: boolean;
|
|
6
|
+
boxBounds: IBoundsData;
|
|
7
|
+
strokeBounds: IBoundsData;
|
|
8
|
+
renderBounds: IBoundsData;
|
|
9
|
+
marginBounds: IBoundsData;
|
|
10
|
+
contentBounds: IBoundsData;
|
|
11
|
+
localStrokeBounds: IBoundsData;
|
|
12
|
+
localRenderBounds: IBoundsData;
|
|
13
|
+
protected _worldContentBounds: IBoundsData;
|
|
14
|
+
protected _worldBoxBounds: IBoundsData;
|
|
15
|
+
protected _worldStrokeBounds: IBoundsData;
|
|
16
|
+
matrixChanged: boolean;
|
|
17
|
+
positionChanged: boolean;
|
|
18
|
+
scaleChanged: boolean;
|
|
19
|
+
rotationChanged: boolean;
|
|
20
|
+
boundsChanged: boolean;
|
|
21
|
+
boxChanged: boolean;
|
|
22
|
+
strokeChanged: boolean;
|
|
23
|
+
renderChanged: boolean;
|
|
24
|
+
localBoxChanged: boolean;
|
|
25
|
+
surfaceChanged: boolean;
|
|
26
|
+
opacityChanged: boolean;
|
|
27
|
+
hitCanvasChanged: boolean;
|
|
28
|
+
childrenSortChanged?: boolean;
|
|
29
|
+
affectScaleOrRotation: boolean;
|
|
30
|
+
affectRotation: boolean;
|
|
31
|
+
affectChildrenSort?: boolean;
|
|
32
|
+
strokeSpread: number;
|
|
33
|
+
renderSpread: number;
|
|
34
|
+
strokeBoxSpread: number;
|
|
35
|
+
renderShapeSpread: number;
|
|
36
|
+
constructor(leaf: ILeaf);
|
|
37
|
+
checkUpdate(force?: boolean): void;
|
|
38
|
+
getTransform(locationType: ILayoutLocationType): IMatrixData;
|
|
39
|
+
getBounds(type: ILayoutBoundsType, locationType: ILayoutLocationType): IBoundsData;
|
|
40
|
+
protected getWorldContentBounds(): IBoundsData;
|
|
41
|
+
protected getWorldBoxBounds(): IBoundsData;
|
|
42
|
+
protected getWorldStrokeBounds(): IBoundsData;
|
|
43
|
+
spreadStrokeCancel(): void;
|
|
44
|
+
spreadRenderCancel(): void;
|
|
45
|
+
spreadStroke(): void;
|
|
46
|
+
spreadRender(): void;
|
|
47
|
+
boxChange(): void;
|
|
48
|
+
localBoxChange(): void;
|
|
49
|
+
strokeChange(): void;
|
|
50
|
+
renderChange(): void;
|
|
51
|
+
positionChange(): void;
|
|
52
|
+
scaleChange(): void;
|
|
53
|
+
rotationChange(): void;
|
|
54
|
+
protected _scaleOrRotationChange(): void;
|
|
55
|
+
surfaceChange(): void;
|
|
56
|
+
opacityChange(): void;
|
|
57
|
+
childrenSortChange(): void;
|
|
58
|
+
destroy(): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { LeafLayout };
|