@leafer-ui/event 1.0.2 → 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 +1 -1
- package/src/UIEvent.ts +14 -4
- package/types/index.d.ts +7 -3
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)
|
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/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
|
|