forked from minewhat/draggable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnappableEvent.js
53 lines (48 loc) · 949 Bytes
/
SnappableEvent.js
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
import AbstractEvent from 'shared/AbstractEvent';
/**
* Base snap event
* @class SnapEvent
* @module SnapEvent
* @extends AbstractEvent
*/
export class SnapEvent extends AbstractEvent {
static type = 'snap';
/**
* Drag event that triggered this snap event
* @property dragEvent
* @type {DragEvent}
* @readonly
*/
get dragEvent() {
return this.data.dragEvent;
}
/**
* Snappable element
* @property snappable
* @type {HTMLElement}
* @readonly
*/
get snappable() {
return this.data.snappable;
}
}
/**
* Snap in event
* @class SnapInEvent
* @module SnapInEvent
* @extends SnapEvent
*/
export class SnapInEvent extends SnapEvent {
static type = 'snap:in';
static cancelable = true;
}
/**
* Snap out event
* @class SnapOutEvent
* @module SnapOutEvent
* @extends SnapEvent
*/
export class SnapOutEvent extends SnapEvent {
static type = 'snap:out';
static cancelable = true;
}