forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2792a6a
commit 8da9be6
Showing
4 changed files
with
28 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Helper to configure datatransfer for drag & drop operations | ||
*/ | ||
import { useEventStore } from "@/stores/eventStore"; | ||
|
||
export function setDrag(evt: DragEvent, data = null, multiple = false) { | ||
const eventStore = useEventStore(); | ||
if (data) { | ||
evt.dataTransfer?.setData("text", JSON.stringify([data])); | ||
// data submitted through datatransfer is only available upon drop, | ||
// in order to access the drop data immediately this event store is used. | ||
eventStore.setDragData(data, multiple); | ||
} | ||
if (evt.dataTransfer) { | ||
evt.dataTransfer.dropEffect = "move"; | ||
evt.dataTransfer.effectAllowed = "move"; | ||
const elem = document.getElementById("drag-ghost"); | ||
if (elem) { | ||
evt.dataTransfer.setDragImage(elem, 0, 0); | ||
} | ||
} | ||
} | ||
|
||
export function clearDrag() { | ||
const eventStore = useEventStore(); | ||
eventStore.clearDragData(); | ||
} |