@leafer/display 1.3.2 → 1.4.0
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 +11 -11
- package/src/Leaf.ts +27 -23
- package/types/index.d.ts +14 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/math": "1.
|
|
26
|
-
"@leafer/data": "1.
|
|
27
|
-
"@leafer/layout": "1.
|
|
28
|
-
"@leafer/display-module": "1.
|
|
29
|
-
"@leafer/event": "1.
|
|
30
|
-
"@leafer/decorator": "1.
|
|
31
|
-
"@leafer/helper": "1.
|
|
32
|
-
"@leafer/debug": "1.
|
|
33
|
-
"@leafer/platform": "1.
|
|
25
|
+
"@leafer/math": "1.4.0",
|
|
26
|
+
"@leafer/data": "1.4.0",
|
|
27
|
+
"@leafer/layout": "1.4.0",
|
|
28
|
+
"@leafer/display-module": "1.4.0",
|
|
29
|
+
"@leafer/event": "1.4.0",
|
|
30
|
+
"@leafer/decorator": "1.4.0",
|
|
31
|
+
"@leafer/helper": "1.4.0",
|
|
32
|
+
"@leafer/debug": "1.4.0",
|
|
33
|
+
"@leafer/platform": "1.4.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@leafer/interface": "1.
|
|
36
|
+
"@leafer/interface": "1.4.0"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/src/Leaf.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaferBase, ILeaf, ILeafInputData, ILeafData, ILeaferCanvas, IRenderOptions, IBoundsType, ILocationType, IMatrixWithBoundsData, ILayoutBoundsData, IValue, ILeafLayout, InnerId, IHitCanvas, IRadiusPointData, IEventListenerMap, IEventListener, IEventListenerId, IEvent, IObject, IFunction, IPointData, IBoundsData, IBranch, IFindMethod, IMatrixData, IAttrDecorator, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAlign, IJSONOptions, IEventMap, IEventOption, IAxis, IMotionPathData, IUnitData, IRotationPointData } from '@leafer/interface'
|
|
1
|
+
import { ILeaferBase, ILeaf, ILeafInputData, ILeafData, ILeaferCanvas, IRenderOptions, IBoundsType, ILocationType, IMatrixWithBoundsData, ILayoutBoundsData, IValue, ILeafLayout, InnerId, IHitCanvas, IRadiusPointData, IEventListenerMap, IEventListener, IEventListenerId, IEvent, IObject, IFunction, IPointData, IBoundsData, IBranch, IFindMethod, IMatrixData, IAttrDecorator, IMatrixWithBoundsScaleData, IMatrixWithScaleData, IAlign, IJSONOptions, IEventMap, IEventOption, IAxis, IMotionPathData, IUnitData, IRotationPointData, ITransition } from '@leafer/interface'
|
|
2
2
|
import { BoundsHelper, IncrementId, MatrixHelper, PointHelper } from '@leafer/math'
|
|
3
3
|
import { LeafData } from '@leafer/data'
|
|
4
4
|
import { LeafLayout } from '@leafer/layout'
|
|
@@ -86,7 +86,7 @@ export class Leaf implements ILeaf {
|
|
|
86
86
|
|
|
87
87
|
public get __onlyHitMask(): boolean { return this.__hasMask && !this.__.hitChildren }
|
|
88
88
|
public get __ignoreHitWorld(): boolean { return (this.__hasMask || this.__hasEraser) && this.__.hitChildren }
|
|
89
|
-
public get __inLazyBounds(): boolean {
|
|
89
|
+
public get __inLazyBounds(): boolean { return this.leaferIsCreated && this.leafer.lazyBounds.hit(this.__world) }
|
|
90
90
|
|
|
91
91
|
public get pathInputed(): boolean { return this.__.__pathInputed as unknown as boolean }
|
|
92
92
|
|
|
@@ -254,6 +254,10 @@ export class Leaf implements ILeaf {
|
|
|
254
254
|
this.forceUpdate('surface')
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
+
public __extraUpdate(): void {
|
|
258
|
+
if (this.leaferIsReady) this.leafer.layouter.addExtra(this) // add part 额外更新元素
|
|
259
|
+
}
|
|
260
|
+
|
|
257
261
|
// LeafMatrix rewrite
|
|
258
262
|
|
|
259
263
|
public __updateWorldMatrix(): void { }
|
|
@@ -462,58 +466,58 @@ export class Leaf implements ILeaf {
|
|
|
462
466
|
|
|
463
467
|
// transform
|
|
464
468
|
|
|
465
|
-
public setTransform(matrix: IMatrixData, resize?: boolean): void {
|
|
466
|
-
setTransform(this, matrix, resize)
|
|
469
|
+
public setTransform(matrix: IMatrixData, resize?: boolean, transition?: ITransition): void {
|
|
470
|
+
setTransform(this, matrix, resize, transition)
|
|
467
471
|
}
|
|
468
472
|
|
|
469
|
-
public transform(matrix: IMatrixData, resize?: boolean): void {
|
|
470
|
-
transform(this, matrix, resize)
|
|
473
|
+
public transform(matrix: IMatrixData, resize?: boolean, transition?: ITransition): void {
|
|
474
|
+
transform(this, matrix, resize, transition)
|
|
471
475
|
}
|
|
472
476
|
|
|
473
|
-
public move(x: number | IPointData, y?: number, transition?:
|
|
477
|
+
public move(x: number | IPointData, y?: number, transition?: ITransition): void {
|
|
474
478
|
moveLocal(this, x, y, transition)
|
|
475
479
|
}
|
|
476
480
|
|
|
477
481
|
|
|
478
|
-
public moveInner(x: number | IPointData, y?: number, transition?:
|
|
482
|
+
public moveInner(x: number | IPointData, y?: number, transition?: ITransition): void {
|
|
479
483
|
moveWorld(this, x, y, true, transition)
|
|
480
484
|
}
|
|
481
485
|
|
|
482
|
-
public scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void {
|
|
483
|
-
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize)
|
|
486
|
+
public scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void {
|
|
487
|
+
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize, transition)
|
|
484
488
|
}
|
|
485
489
|
|
|
486
|
-
public rotateOf(origin: IPointData | IAlign, rotation: number): void {
|
|
487
|
-
rotateOfLocal(this, getLocalOrigin(this, origin), rotation)
|
|
490
|
+
public rotateOf(origin: IPointData | IAlign, rotation: number, transition?: ITransition): void {
|
|
491
|
+
rotateOfLocal(this, getLocalOrigin(this, origin), rotation, transition)
|
|
488
492
|
}
|
|
489
493
|
|
|
490
|
-
public skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void {
|
|
491
|
-
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize)
|
|
494
|
+
public skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void {
|
|
495
|
+
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize, transition)
|
|
492
496
|
}
|
|
493
497
|
|
|
494
498
|
|
|
495
|
-
public transformWorld(worldTransform?: IMatrixData, resize?: boolean): void {
|
|
496
|
-
transformWorld(this, worldTransform, resize)
|
|
499
|
+
public transformWorld(worldTransform?: IMatrixData, resize?: boolean, transition?: ITransition): void {
|
|
500
|
+
transformWorld(this, worldTransform, resize, transition)
|
|
497
501
|
}
|
|
498
502
|
|
|
499
|
-
public moveWorld(x: number | IPointData, y?: number, transition?:
|
|
503
|
+
public moveWorld(x: number | IPointData, y?: number, transition?: ITransition): void {
|
|
500
504
|
moveWorld(this, x, y, false, transition)
|
|
501
505
|
}
|
|
502
506
|
|
|
503
|
-
public scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void {
|
|
504
|
-
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize)
|
|
507
|
+
public scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void {
|
|
508
|
+
zoomOfWorld(this, worldOrigin, scaleX, scaleY, resize, transition)
|
|
505
509
|
}
|
|
506
510
|
|
|
507
511
|
public rotateOfWorld(worldOrigin: IPointData, rotation: number): void {
|
|
508
512
|
rotateOfWorld(this, worldOrigin, rotation)
|
|
509
513
|
}
|
|
510
514
|
|
|
511
|
-
public skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void {
|
|
512
|
-
skewOfWorld(this, worldOrigin, skewX, skewY, resize)
|
|
515
|
+
public skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void {
|
|
516
|
+
skewOfWorld(this, worldOrigin, skewX, skewY, resize, transition)
|
|
513
517
|
}
|
|
514
518
|
|
|
515
|
-
public flip(axis: IAxis): void {
|
|
516
|
-
transform(this, getFlipTransform(this, axis))
|
|
519
|
+
public flip(axis: IAxis, transition?: ITransition): void {
|
|
520
|
+
transform(this, getFlipTransform(this, axis), false, transition)
|
|
517
521
|
}
|
|
518
522
|
|
|
519
523
|
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventMap, IEventListenerMap, ILeafInputData, IFunction, IObject, IValue, IJSONOptions, IFindMethod, ILeaferCanvas, IRenderOptions, ILocationType, IBoundsType, ILayoutBoundsData, IPointData, IAlign, IAxis, IRadiusPointData, IMotionPathData, IUnitData, IRotationPointData, IEventListener, IEventOption, IEventListenerId, IEvent, IAttrDecorator } from '@leafer/interface';
|
|
1
|
+
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventMap, IEventListenerMap, ILeafInputData, IFunction, IObject, IValue, IJSONOptions, IFindMethod, ILeaferCanvas, IRenderOptions, ILocationType, IBoundsType, ILayoutBoundsData, IPointData, ITransition, IAlign, IAxis, IRadiusPointData, IMotionPathData, IUnitData, IRotationPointData, IEventListener, IEventOption, IEventListenerId, IEvent, IAttrDecorator } from '@leafer/interface';
|
|
2
2
|
import { LeafData } from '@leafer/data';
|
|
3
3
|
import { LeafLayout } from '@leafer/layout';
|
|
4
4
|
|
|
@@ -84,6 +84,7 @@ declare class Leaf implements ILeaf {
|
|
|
84
84
|
updateLayout(): void;
|
|
85
85
|
forceUpdate(attrName?: string): void;
|
|
86
86
|
forceRender(_bounds?: IBoundsData, _sync?: boolean): void;
|
|
87
|
+
__extraUpdate(): void;
|
|
87
88
|
__updateWorldMatrix(): void;
|
|
88
89
|
__updateLocalMatrix(): void;
|
|
89
90
|
__updateWorldBounds(): void;
|
|
@@ -127,19 +128,19 @@ declare class Leaf implements ILeaf {
|
|
|
127
128
|
getWorldPointByBox(box: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
128
129
|
getWorldPointByLocal(local: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
129
130
|
getWorldPointByPage(page: IPointData, relative?: ILeaf, distance?: boolean, change?: boolean): IPointData;
|
|
130
|
-
setTransform(matrix: IMatrixData, resize?: boolean): void;
|
|
131
|
-
transform(matrix: IMatrixData, resize?: boolean): void;
|
|
132
|
-
move(x: number | IPointData, y?: number, transition?:
|
|
133
|
-
moveInner(x: number | IPointData, y?: number, transition?:
|
|
134
|
-
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
135
|
-
rotateOf(origin: IPointData | IAlign, rotation: number): void;
|
|
136
|
-
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void;
|
|
137
|
-
transformWorld(worldTransform?: IMatrixData, resize?: boolean): void;
|
|
138
|
-
moveWorld(x: number | IPointData, y?: number, transition?:
|
|
139
|
-
scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
131
|
+
setTransform(matrix: IMatrixData, resize?: boolean, transition?: ITransition): void;
|
|
132
|
+
transform(matrix: IMatrixData, resize?: boolean, transition?: ITransition): void;
|
|
133
|
+
move(x: number | IPointData, y?: number, transition?: ITransition): void;
|
|
134
|
+
moveInner(x: number | IPointData, y?: number, transition?: ITransition): void;
|
|
135
|
+
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
|
|
136
|
+
rotateOf(origin: IPointData | IAlign, rotation: number, transition?: ITransition): void;
|
|
137
|
+
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
|
|
138
|
+
transformWorld(worldTransform?: IMatrixData, resize?: boolean, transition?: ITransition): void;
|
|
139
|
+
moveWorld(x: number | IPointData, y?: number, transition?: ITransition): void;
|
|
140
|
+
scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number | ITransition, resize?: boolean, transition?: ITransition): void;
|
|
140
141
|
rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
|
|
141
|
-
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
142
|
-
flip(axis: IAxis): void;
|
|
142
|
+
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean, transition?: ITransition): void;
|
|
143
|
+
flip(axis: IAxis, transition?: ITransition): void;
|
|
143
144
|
scaleResize(scaleX: number, scaleY?: number, _noResize?: boolean): void;
|
|
144
145
|
__scaleResize(_scaleX: number, _scaleY: number): void;
|
|
145
146
|
resizeWidth(_width: number): void;
|