@leafer-ui/interaction 1.12.1 → 1.12.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 +6 -6
- package/src/Dragger.ts +10 -3
- package/src/Interaction.ts +4 -0
- package/src/InteractionHelper.ts +1 -0
- package/types/index.d.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leafer-ui/interaction",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.3",
|
|
4
4
|
"description": "@leafer-ui/interaction",
|
|
5
5
|
"author": "Chao (Leafer) Wan",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"leaferjs"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@leafer/core": "1.12.
|
|
26
|
-
"@leafer-ui/draw": "1.12.
|
|
27
|
-
"@leafer-ui/event": "1.12.
|
|
25
|
+
"@leafer/core": "1.12.3",
|
|
26
|
+
"@leafer-ui/draw": "1.12.3",
|
|
27
|
+
"@leafer-ui/event": "1.12.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@leafer/interface": "1.12.
|
|
31
|
-
"@leafer-ui/interface": "1.12.
|
|
30
|
+
"@leafer/interface": "1.12.3",
|
|
31
|
+
"@leafer-ui/interface": "1.12.3"
|
|
32
32
|
}
|
|
33
33
|
}
|
package/src/Dragger.ts
CHANGED
|
@@ -20,6 +20,8 @@ export class Dragger {
|
|
|
20
20
|
public dragData: IDragEvent
|
|
21
21
|
public downData: IPointerEvent
|
|
22
22
|
|
|
23
|
+
public dragDataList: IDragEvent[] = [] // 记录列表备用
|
|
24
|
+
|
|
23
25
|
public draggableList: ILeafList
|
|
24
26
|
public realDraggableList: ILeafList
|
|
25
27
|
protected dragOverPath: ILeafList
|
|
@@ -104,6 +106,8 @@ export class Dragger {
|
|
|
104
106
|
if (throughPath) this.dragData.throughPath = throughPath
|
|
105
107
|
this.dragData.path = path
|
|
106
108
|
|
|
109
|
+
this.dragDataList.push(this.dragData)
|
|
110
|
+
|
|
107
111
|
if (this.moving) {
|
|
108
112
|
data.moving = true;
|
|
109
113
|
(this.dragData as IMoveEvent).moveType = 'drag'
|
|
@@ -158,13 +162,13 @@ export class Dragger {
|
|
|
158
162
|
this.dragEnterPath = path
|
|
159
163
|
}
|
|
160
164
|
|
|
161
|
-
public dragEnd(data: IPointerEvent
|
|
165
|
+
public dragEnd(data: IPointerEvent): void {
|
|
162
166
|
if (!this.dragging && !this.moving) return
|
|
163
|
-
if (this.checkDragEndAnimate(data
|
|
167
|
+
if (this.checkDragEndAnimate(data)) return
|
|
164
168
|
this.dragEndReal(data)
|
|
165
169
|
}
|
|
166
170
|
|
|
167
|
-
|
|
171
|
+
public dragEndReal(data?: IPointerEvent): void {
|
|
168
172
|
const { interaction, downData, dragData } = this
|
|
169
173
|
if (!data) data = dragData
|
|
170
174
|
const { path, throughPath } = downData
|
|
@@ -212,6 +216,7 @@ export class Dragger {
|
|
|
212
216
|
|
|
213
217
|
protected dragReset(): void {
|
|
214
218
|
DragEvent.list = DragEvent.data = this.draggableList = this.dragData = this.downData = this.dragOverPath = this.dragEnterPath = null
|
|
219
|
+
this.dragDataList = []
|
|
215
220
|
}
|
|
216
221
|
|
|
217
222
|
|
|
@@ -221,6 +226,8 @@ export class Dragger {
|
|
|
221
226
|
|
|
222
227
|
public animate(_func?: IFunction, _off?: 'off'): void { } // dragEnd animation
|
|
223
228
|
|
|
229
|
+
public stopAnimate(): void { }
|
|
230
|
+
|
|
224
231
|
public checkDragOut(_data: IPointerEvent): void { }
|
|
225
232
|
|
|
226
233
|
public autoMoveOnDragOut(_data: IPointerEvent): void { }
|
package/src/Interaction.ts
CHANGED
|
@@ -409,6 +409,10 @@ export class InteractionBase implements IInteraction {
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
+
public stopDragAnimate(): void {
|
|
413
|
+
this.dragger.stopAnimate()
|
|
414
|
+
}
|
|
415
|
+
|
|
412
416
|
|
|
413
417
|
public updateDownData(data?: IPointerEvent, options?: IPickOptions, merge?: boolean): void {
|
|
414
418
|
const { downData } = this
|
package/src/InteractionHelper.ts
CHANGED
|
@@ -52,6 +52,7 @@ export const InteractionHelper = {
|
|
|
52
52
|
ctrlKey: e.ctrlKey,
|
|
53
53
|
shiftKey: e.shiftKey,
|
|
54
54
|
metaKey: e.metaKey,
|
|
55
|
+
time: Date.now(),
|
|
55
56
|
buttons: isUndefined(e.buttons) ? 1 : (e.buttons === 0 ? pointerUpButtons : e.buttons), // touchEvent no button and buttons, set default
|
|
56
57
|
origin: e
|
|
57
58
|
} as IUIEvent
|
package/types/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare class Dragger {
|
|
|
7
7
|
dragging: boolean;
|
|
8
8
|
dragData: IDragEvent;
|
|
9
9
|
downData: IPointerEvent;
|
|
10
|
+
dragDataList: IDragEvent[];
|
|
10
11
|
draggableList: ILeafList;
|
|
11
12
|
realDraggableList: ILeafList;
|
|
12
13
|
protected dragOverPath: ILeafList;
|
|
@@ -27,13 +28,14 @@ declare class Dragger {
|
|
|
27
28
|
protected dragReal(isDragEnd?: boolean): void;
|
|
28
29
|
dragOverOrOut(data: IPointerEvent): void;
|
|
29
30
|
dragEnterOrLeave(data: IPointerEvent): void;
|
|
30
|
-
dragEnd(data: IPointerEvent
|
|
31
|
-
|
|
31
|
+
dragEnd(data: IPointerEvent): void;
|
|
32
|
+
dragEndReal(data?: IPointerEvent): void;
|
|
32
33
|
protected swipe(data: IPointerEvent, downData: IPointerEvent, dragData: IDragEvent, endDragData: IDragEvent): void;
|
|
33
34
|
protected drop(data: IPointerEvent, dropList: ILeafList, dragEnterPath: ILeafList): void;
|
|
34
35
|
protected dragReset(): void;
|
|
35
36
|
checkDragEndAnimate(_data: IPointerEvent, _speed?: number): boolean | number;
|
|
36
37
|
animate(_func?: IFunction, _off?: 'off'): void;
|
|
38
|
+
stopAnimate(): void;
|
|
37
39
|
checkDragOut(_data: IPointerEvent): void;
|
|
38
40
|
autoMoveOnDragOut(_data: IPointerEvent): void;
|
|
39
41
|
autoMoveCancel(): void;
|
|
@@ -114,6 +116,7 @@ declare class InteractionBase implements IInteraction {
|
|
|
114
116
|
isHover(leaf: ILeaf): boolean;
|
|
115
117
|
isFocus(leaf: ILeaf): boolean;
|
|
116
118
|
cancelHover(): void;
|
|
119
|
+
stopDragAnimate(): void;
|
|
117
120
|
updateDownData(data?: IPointerEvent, options?: IPickOptions, merge?: boolean): void;
|
|
118
121
|
updateHoverData(data?: IPointerEvent): void;
|
|
119
122
|
updateCursor(data?: IPointerEvent): void;
|