Support drag-drop vers conteneur

This commit is contained in:
Vincent Vandemeulebrouck
2021-12-05 16:48:18 +01:00
parent 009ec47709
commit 9de1e7dae5
10 changed files with 126 additions and 65 deletions

View File

@ -26,7 +26,6 @@ export class RdDActorSheet extends ActorSheet {
classes: ["rdd", "sheet", "actor"],
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
width: 640,
//height: 720,
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: null }],
editCaracComp: false,
@ -132,13 +131,15 @@ export class RdDActorSheet extends ActorSheet {
/* -------------------------------------------- */
async _onDropActor(event, dragData) {
console.log("DRAG", this.actor.id, dragData);
console.log("_onDropActor", this.actor.id, dragData);
this.actor.addSubacteur(dragData.id || dragData.data._id);
super._onDropActor(event, dragData);
}
/* -------------------------------------------- */
async _onDropItem(event, dragData) {
const callSuper = await this.actor.processDropItem(RdDSheetUtility.extractItemDropParameters(event, dragData, this.actor, this.objetVersConteneur));
const destItemId = RdDSheetUtility.getItemId(event);
const dropParams = RdDSheetUtility.prepareItemDropParameters(destItemId, this.actor.id, dragData, this.objetVersConteneur);
const callSuper = await this.actor.processDropItem(dropParams);
if (callSuper) {
await super._onDropItem(event, dragData)
}