forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdragon.ts
More file actions
85 lines (77 loc) · 1.97 KB
/
dragon.ts
File metadata and controls
85 lines (77 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* eslint-disable max-len */
import { IPublicTypeDisposable, IPublicTypeDragObject } from '../type';
import {
IPublicModelDragObject,
IPublicModelLocateEvent,
IPublicModelNode,
} from './';
export interface IPublicModelDragon<
Node = IPublicModelNode,
LocateEvent = IPublicModelLocateEvent,
> {
/**
* 是否正在拖动
* is dragging or not
*/
get dragging(): boolean;
/**
* 绑定 dragstart 事件
* bind a callback function which will be called on dragging start
* @param func
* @returns
*/
onDragstart(func: (e: LocateEvent) => any): IPublicTypeDisposable;
/**
* 绑定 drag 事件
* bind a callback function which will be called on dragging
* @param func
* @returns
*/
onDrag(func: (e: LocateEvent) => any): IPublicTypeDisposable;
/**
* 绑定 dragend 事件
* bind a callback function which will be called on dragging end
* @param func
* @returns
*/
onDragend(
func: (o: {
dragObject: IPublicModelDragObject<Node>;
copy?: boolean;
}) => any,
): IPublicTypeDisposable;
/**
* 设置拖拽监听的区域 shell,以及自定义拖拽转换函数 boost
* set a html element as shell to dragon as monitoring target, and
* set boost function which is used to transform a MouseEvent to type
* IPublicTypeDragNodeDataObject.
* @param shell 拖拽监听的区域
* @param boost 拖拽转换函数
*/
from(
shell: Element,
boost: (e: MouseEvent) => IPublicModelDragObject<Node> | null,
): any;
/**
* 发射拖拽对象
* boost your dragObject for dragging(flying)
*
* @param dragObject 拖拽对象
* @param boostEvent 拖拽初始时事件
*/
boost(
dragObject: IPublicTypeDragObject,
boostEvent: MouseEvent | DragEvent,
fromRglNode?: Node,
): void;
/**
* 添加投放感应区
* add sensor area
*/
addSensor(sensor: any): void;
/**
* 移除投放感应
* remove sensor area
*/
removeSensor(sensor: any): void;
}