Fix: drag and drop

This commit is contained in:
Thaum Rystra
2020-04-25 11:17:42 +02:00
parent 8b30c7b6d0
commit 3ab73f62bf
2 changed files with 27 additions and 27 deletions

View File

@@ -48,4 +48,30 @@ Template.characterSideList.events({
}
instance.openedParties.set(openedParties);
},
"dragover .characterRepresentative, dragenter .characterRepresentative":
function(event, instance){
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/items")){
event.preventDefault();
}
},
"drop .characterRepresentative": function(event, instance) {
if (_.contains(event.originalEvent.dataTransfer.types, "dicecloud-id/items")){
var itemId = event.originalEvent.dataTransfer.getData("dicecloud-id/items");
if (event.ctrlKey){
//split the stack to the container
pushDialogStack({
template: "splitStackDialog",
data: {
id: itemId,
parentCollection: "Characters",
parentId: this._id,
},
});
} else {
//move item to the character
Meteor.call("moveItemToCharacter", itemId, this._id);
}
Session.set("inventory.dragItemId", null);
}
},
});