@leafer-ui/event 1.0.1 → 1.0.3
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 +3 -3
- package/src/DragEvent.ts +4 -2
- package/src/PointerEvent.ts +3 -1
- package/src/UIEvent.ts +14 -4
- package/src/index.ts +2 -2
- package/types/index.d.ts +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/event",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "@leafer-ui/event",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.0.
|
|
25
|
+
"@leafer/core": "1.0.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@leafer/interface": "1.0.
|
|
28
|
+
"@leafer/interface": "1.0.3"
|
|
29
29
|
}
|
|
30
30
|
}
|
package/src/DragEvent.ts
CHANGED
|
@@ -101,7 +101,7 @@ export class DragEvent extends PointerEvent implements IDragEvent {
|
|
|
101
101
|
|
|
102
102
|
public getPageBounds(): IBoundsData {
|
|
103
103
|
const total = this.getPageTotal()
|
|
104
|
-
const start = this.
|
|
104
|
+
const start = this.getPagePoint()
|
|
105
105
|
const bounds = {} as IBoundsData
|
|
106
106
|
BoundsHelper.set(bounds, start.x - total.x, start.y - total.y, total.x, total.y)
|
|
107
107
|
BoundsHelper.unsign(bounds)
|
|
@@ -113,4 +113,6 @@ export class DragEvent extends PointerEvent implements IDragEvent {
|
|
|
113
113
|
move.y = total ? this.totalY : this.moveY
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export const MyDragEvent = DragEvent
|
package/src/PointerEvent.ts
CHANGED
package/src/UIEvent.ts
CHANGED
|
@@ -33,20 +33,30 @@ export class UIEvent extends Event implements IUIEvent {
|
|
|
33
33
|
Object.assign(this, params)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
public
|
|
37
|
-
|
|
36
|
+
public getBoxPoint(relative?: ILeaf): IPointData {
|
|
37
|
+
if (!relative) relative = this.current
|
|
38
|
+
return relative.getBoxPoint(this)
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
public
|
|
41
|
+
public getInnerPoint(relative?: ILeaf): IPointData {
|
|
41
42
|
if (!relative) relative = this.current
|
|
42
43
|
return relative.getInnerPoint(this)
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
public
|
|
46
|
+
public getLocalPoint(relative?: ILeaf): IPointData {
|
|
46
47
|
if (!relative) relative = this.current
|
|
47
48
|
return relative.getLocalPoint(this)
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
public getPagePoint(): IPointData {
|
|
52
|
+
return this.current.getPagePoint(this)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 兼容代码,未来可移除
|
|
56
|
+
public getInner = this.getInnerPoint
|
|
57
|
+
public getLocal = this.getLocalPoint
|
|
58
|
+
public getPage = this.getPagePoint
|
|
59
|
+
|
|
50
60
|
static changeName(oldName: string, newName: string): void {
|
|
51
61
|
EventCreator.changeName(oldName, newName)
|
|
52
62
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { UIEvent } from './UIEvent'
|
|
2
|
-
export { DragEvent } from './DragEvent'
|
|
2
|
+
export { DragEvent, MyDragEvent } from './DragEvent'
|
|
3
3
|
export { DropEvent } from './DropEvent'
|
|
4
4
|
export { MoveEvent } from './MoveEvent'
|
|
5
|
-
export { PointerEvent } from './PointerEvent'
|
|
5
|
+
export { PointerEvent, MyPointerEvent } from './PointerEvent'
|
|
6
6
|
export { RotateEvent } from './RotateEvent'
|
|
7
7
|
export { SwipeEvent } from './SwipeEvent'
|
|
8
8
|
export { ZoomEvent } from './ZoomEvent'
|
package/types/index.d.ts
CHANGED
|
@@ -19,9 +19,13 @@ declare class UIEvent extends Event implements IUIEvent {
|
|
|
19
19
|
readonly current: ILeaf;
|
|
20
20
|
readonly bubbles: boolean;
|
|
21
21
|
constructor(params: IUIEvent);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
getBoxPoint(relative?: ILeaf): IPointData;
|
|
23
|
+
getInnerPoint(relative?: ILeaf): IPointData;
|
|
24
|
+
getLocalPoint(relative?: ILeaf): IPointData;
|
|
25
|
+
getPagePoint(): IPointData;
|
|
26
|
+
getInner: (relative?: ILeaf) => IPointData;
|
|
27
|
+
getLocal: (relative?: ILeaf) => IPointData;
|
|
28
|
+
getPage: () => IPointData;
|
|
25
29
|
static changeName(oldName: string, newName: string): void;
|
|
26
30
|
}
|
|
27
31
|
|
|
@@ -55,6 +59,7 @@ declare class PointerEvent extends UIEvent implements IPointerEvent {
|
|
|
55
59
|
readonly tiltY?: number;
|
|
56
60
|
readonly twist?: number;
|
|
57
61
|
}
|
|
62
|
+
declare const MyPointerEvent: typeof PointerEvent;
|
|
58
63
|
|
|
59
64
|
declare class DragEvent extends PointerEvent implements IDragEvent {
|
|
60
65
|
static BEFORE_DRAG: string;
|
|
@@ -84,6 +89,7 @@ declare class DragEvent extends PointerEvent implements IDragEvent {
|
|
|
84
89
|
getPageBounds(): IBoundsData;
|
|
85
90
|
protected assignMove(total: boolean): void;
|
|
86
91
|
}
|
|
92
|
+
declare const MyDragEvent: typeof DragEvent;
|
|
87
93
|
|
|
88
94
|
declare class DropEvent extends PointerEvent implements IDropEvent {
|
|
89
95
|
static DROP: string;
|
|
@@ -152,4 +158,4 @@ declare const PointerButton: {
|
|
|
152
158
|
middle(event: IUIEvent): boolean;
|
|
153
159
|
};
|
|
154
160
|
|
|
155
|
-
export { DragEvent, DropEvent, KeyEvent, Keyboard, MoveEvent, PointerButton, PointerEvent, RotateEvent, SwipeEvent, UIEvent, ZoomEvent };
|
|
161
|
+
export { DragEvent, DropEvent, KeyEvent, Keyboard, MoveEvent, MyDragEvent, MyPointerEvent, PointerButton, PointerEvent, RotateEvent, SwipeEvent, UIEvent, ZoomEvent };
|