-
Notifications
You must be signed in to change notification settings - Fork 251
/
dnd.config.ts
42 lines (35 loc) · 1.43 KB
/
dnd.config.ts
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
// Copyright (C) 2016-2020 Sergey Akopkokhyants
// This project is licensed under the terms of the MIT license.
// https://github.com/akserg/ng2-dnd
import {isString} from './dnd.utils';
export class DataTransferEffect {
static COPY = new DataTransferEffect('copy');
static LINK = new DataTransferEffect('link');
static MOVE = new DataTransferEffect('move');
static NONE = new DataTransferEffect('none');
constructor(public name: string) { }
}
export class DragImage {
constructor(
public imageElement: any,
public x_offset: number = 0,
public y_offset: number = 0) {
if (isString(this.imageElement)) {
// Create real image from string source
let imgScr: string = <string>this.imageElement;
this.imageElement = new HTMLImageElement();
(<HTMLImageElement>this.imageElement).src = imgScr;
}
}
}
export class DragDropConfig {
public onDragStartClass: string = "dnd-drag-start";
public onDragEnterClass: string = "dnd-drag-enter";
public onDragOverClass: string = "dnd-drag-over";
public onSortableDragClass: string = "dnd-sortable-drag";
public dragEffect: DataTransferEffect = DataTransferEffect.MOVE;
public dropEffect: DataTransferEffect = DataTransferEffect.MOVE;
public dragCursor: string = "move";
public dragImage: DragImage;
public defaultCursor: string = "pointer";
}