@leafer/display 1.0.0 → 1.0.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 +10 -10
- package/src/Leaf.ts +17 -5
- package/types/index.d.ts +7 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer/display",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "@leafer/display",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/math": "1.0.
|
|
26
|
-
"@leafer/data": "1.0.
|
|
27
|
-
"@leafer/layout": "1.0.
|
|
28
|
-
"@leafer/display-module": "1.0.
|
|
29
|
-
"@leafer/event": "1.0.
|
|
30
|
-
"@leafer/decorator": "1.0.
|
|
31
|
-
"@leafer/helper": "1.0.
|
|
32
|
-
"@leafer/platform": "1.0.
|
|
25
|
+
"@leafer/math": "1.0.2",
|
|
26
|
+
"@leafer/data": "1.0.2",
|
|
27
|
+
"@leafer/layout": "1.0.2",
|
|
28
|
+
"@leafer/display-module": "1.0.2",
|
|
29
|
+
"@leafer/event": "1.0.2",
|
|
30
|
+
"@leafer/decorator": "1.0.2",
|
|
31
|
+
"@leafer/helper": "1.0.2",
|
|
32
|
+
"@leafer/platform": "1.0.2"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@leafer/interface": "1.0.
|
|
35
|
+
"@leafer/interface": "1.0.2"
|
|
36
36
|
}
|
|
37
37
|
}
|
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,
|
|
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 } 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'
|
|
@@ -12,7 +12,7 @@ const { LEAF, create } = IncrementId
|
|
|
12
12
|
const { toInnerPoint, toOuterPoint, multiplyParent } = MatrixHelper
|
|
13
13
|
const { toOuterOf } = BoundsHelper
|
|
14
14
|
const { copy } = PointHelper
|
|
15
|
-
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper
|
|
15
|
+
const { moveLocal, zoomOfLocal, rotateOfLocal, skewOfLocal, moveWorld, zoomOfWorld, rotateOfWorld, skewOfWorld, transform, transformWorld, setTransform, getFlipTransform, getLocalOrigin, getRelativeWorld, drop } = LeafHelper
|
|
16
16
|
|
|
17
17
|
@useModule(LeafDataProxy)
|
|
18
18
|
@useModule(LeafMatrix)
|
|
@@ -84,6 +84,8 @@ export class Leaf implements ILeaf {
|
|
|
84
84
|
public get pathInputed(): boolean { return this.__.__pathInputed as unknown as boolean }
|
|
85
85
|
|
|
86
86
|
// event
|
|
87
|
+
public set event(map: IEventMap) { let event; for (let key in map) event = map[key], event instanceof Array ? this.on(key, event[0], event[1]) : this.on(key, event) }
|
|
88
|
+
|
|
87
89
|
public __captureMap?: IEventListenerMap
|
|
88
90
|
public __bubbleMap?: IEventListenerMap
|
|
89
91
|
|
|
@@ -442,6 +444,11 @@ export class Leaf implements ILeaf {
|
|
|
442
444
|
moveLocal(this, x, y)
|
|
443
445
|
}
|
|
444
446
|
|
|
447
|
+
|
|
448
|
+
public moveInner(x: number | IPointData, y?: number): void {
|
|
449
|
+
moveWorld(this, x, y, true)
|
|
450
|
+
}
|
|
451
|
+
|
|
445
452
|
public scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void {
|
|
446
453
|
zoomOfLocal(this, getLocalOrigin(this, origin), scaleX, scaleY, resize)
|
|
447
454
|
}
|
|
@@ -454,6 +461,7 @@ export class Leaf implements ILeaf {
|
|
|
454
461
|
skewOfLocal(this, getLocalOrigin(this, origin), skewX, skewY, resize)
|
|
455
462
|
}
|
|
456
463
|
|
|
464
|
+
|
|
457
465
|
public transformWorld(worldTransform?: IMatrixData, resize?: boolean): void {
|
|
458
466
|
transformWorld(this, worldTransform, resize)
|
|
459
467
|
}
|
|
@@ -474,6 +482,10 @@ export class Leaf implements ILeaf {
|
|
|
474
482
|
skewOfWorld(this, worldOrigin, skewX, skewY, resize)
|
|
475
483
|
}
|
|
476
484
|
|
|
485
|
+
public flip(axis: IAxis): void {
|
|
486
|
+
transform(this, getFlipTransform(this, axis))
|
|
487
|
+
}
|
|
488
|
+
|
|
477
489
|
|
|
478
490
|
// @leafer-in/resize rewrite
|
|
479
491
|
|
|
@@ -560,11 +572,11 @@ export class Leaf implements ILeaf {
|
|
|
560
572
|
|
|
561
573
|
// LeafEventer rewrite
|
|
562
574
|
|
|
563
|
-
public on(_type: string | string[], _listener: IEventListener, _options?:
|
|
575
|
+
public on(_type: string | string[], _listener: IEventListener, _options?: IEventOption): void { }
|
|
564
576
|
|
|
565
|
-
public off(_type?: string | string[], _listener?: IEventListener, _options?:
|
|
577
|
+
public off(_type?: string | string[], _listener?: IEventListener, _options?: IEventOption): void { }
|
|
566
578
|
|
|
567
|
-
public on_(_type: string | string[], _listener: IEventListener, _bind?: IObject, _options?:
|
|
579
|
+
public on_(_type: string | string[], _listener: IEventListener, _bind?: IObject, _options?: IEventOption): IEventListenerId { return undefined }
|
|
568
580
|
|
|
569
581
|
public off_(_id: IEventListenerId | IEventListenerId[]): void { }
|
|
570
582
|
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventListenerMap, IFunction, ILeafInputData, IObject, IValue, IJSONOptions, IFindMethod, ILeaferCanvas, IRenderOptions, ILocationType, IBoundsType, ILayoutBoundsData, IPointData, IAlign, IRadiusPointData, IEventListener,
|
|
1
|
+
import { ILeaf, InnerId, ILeaferBase, ILeafData, ILeafLayout, IMatrixWithBoundsScaleData, IMatrixWithBoundsData, IMatrixData, IBoundsData, IMatrixWithScaleData, IHitCanvas, IEventMap, IEventListenerMap, IFunction, ILeafInputData, IObject, IValue, IJSONOptions, IFindMethod, ILeaferCanvas, IRenderOptions, ILocationType, IBoundsType, ILayoutBoundsData, IPointData, IAlign, IAxis, IRadiusPointData, IEventListener, IEventOption, IEventListenerId, IEvent, IAttrDecorator } from '@leafer/interface';
|
|
2
2
|
import { LeafData } from '@leafer/data';
|
|
3
3
|
import { LeafLayout } from '@leafer/layout';
|
|
4
4
|
|
|
@@ -43,6 +43,7 @@ declare class Leaf implements ILeaf {
|
|
|
43
43
|
get __ignoreHitWorld(): boolean;
|
|
44
44
|
get __inLazyBounds(): boolean;
|
|
45
45
|
get pathInputed(): boolean;
|
|
46
|
+
set event(map: IEventMap);
|
|
46
47
|
__captureMap?: IEventListenerMap;
|
|
47
48
|
__bubbleMap?: IEventListenerMap;
|
|
48
49
|
__parentWait?: IFunction[];
|
|
@@ -122,6 +123,7 @@ declare class Leaf implements ILeaf {
|
|
|
122
123
|
setTransform(matrix: IMatrixData, resize?: boolean): void;
|
|
123
124
|
transform(matrix: IMatrixData, resize?: boolean): void;
|
|
124
125
|
move(x: number | IPointData, y?: number): void;
|
|
126
|
+
moveInner(x: number | IPointData, y?: number): void;
|
|
125
127
|
scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
126
128
|
rotateOf(origin: IPointData | IAlign, rotation: number): void;
|
|
127
129
|
skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, resize?: boolean): void;
|
|
@@ -130,6 +132,7 @@ declare class Leaf implements ILeaf {
|
|
|
130
132
|
scaleOfWorld(worldOrigin: IPointData, scaleX: number, scaleY?: number, resize?: boolean): void;
|
|
131
133
|
rotateOfWorld(worldOrigin: IPointData, rotation: number): void;
|
|
132
134
|
skewOfWorld(worldOrigin: IPointData, skewX: number, skewY?: number, resize?: boolean): void;
|
|
135
|
+
flip(axis: IAxis): void;
|
|
133
136
|
scaleResize(scaleX: number, scaleY?: number, _noResize?: boolean): void;
|
|
134
137
|
__scaleResize(_scaleX: number, _scaleY: number): void;
|
|
135
138
|
resizeWidth(_width: number): void;
|
|
@@ -156,9 +159,9 @@ declare class Leaf implements ILeaf {
|
|
|
156
159
|
add(_child: ILeaf, _index?: number): void;
|
|
157
160
|
remove(_child?: ILeaf, destroy?: boolean): void;
|
|
158
161
|
dropTo(parent: ILeaf, index?: number, resize?: boolean): void;
|
|
159
|
-
on(_type: string | string[], _listener: IEventListener, _options?:
|
|
160
|
-
off(_type?: string | string[], _listener?: IEventListener, _options?:
|
|
161
|
-
on_(_type: string | string[], _listener: IEventListener, _bind?: IObject, _options?:
|
|
162
|
+
on(_type: string | string[], _listener: IEventListener, _options?: IEventOption): void;
|
|
163
|
+
off(_type?: string | string[], _listener?: IEventListener, _options?: IEventOption): void;
|
|
164
|
+
on_(_type: string | string[], _listener: IEventListener, _bind?: IObject, _options?: IEventOption): IEventListenerId;
|
|
162
165
|
off_(_id: IEventListenerId | IEventListenerId[]): void;
|
|
163
166
|
once(_type: string | string[], _listener: IEventListener, _capture?: boolean): void;
|
|
164
167
|
emit(_type: string, _event?: IEvent | IObject, _capture?: boolean): void;
|