Fixed so items from the inventory tab of the Party sheet can be dragged out

This commit is contained in:
WBHarry 2025-11-20 19:17:26 +01:00
parent e77f538ab7
commit e701786f45
2 changed files with 10 additions and 11 deletions

View file

@ -2650,7 +2650,7 @@
"cardTooHighLevel": "The card is too high level!", "cardTooHighLevel": "The card is too high level!",
"duplicateCard": "You cannot select the same card more than once.", "duplicateCard": "You cannot select the same card more than once.",
"duplicateCharacter": "This actor is already registered in the party members list.", "duplicateCharacter": "This actor is already registered in the party members list.",
"onlyCharactersInPartySheet": "You can only drag characters, companions and adverasries to the party sheet.", "onlyCharactersInPartySheet": "You can only drag characters, companions and adversaries to the party sheet.",
"notPrimary": "The weapon is not a primary weapon!", "notPrimary": "The weapon is not a primary weapon!",
"notSecondary": "The weapon is not a secondary weapon!", "notSecondary": "The weapon is not a secondary weapon!",
"itemTooHighTier": "The item must be from Tier1", "itemTooHighTier": "The item must be from Tier1",

View file

@ -7,7 +7,6 @@ import { socketEvent } from '../../../systemRegistration/socket.mjs';
import GroupRollDialog from '../../dialogs/group-roll-dialog.mjs'; import GroupRollDialog from '../../dialogs/group-roll-dialog.mjs';
import DhpActor from '../../../documents/actor.mjs'; import DhpActor from '../../../documents/actor.mjs';
import DHItem from '../../../documents/item.mjs'; import DHItem from '../../../documents/item.mjs';
import DhParty from '../../../data/actor/party.mjs';
export default class Party extends DHBaseActorSheet { export default class Party extends DHBaseActorSheet {
constructor(options) { constructor(options) {
@ -21,7 +20,7 @@ export default class Party extends DHBaseActorSheet {
classes: ['party'], classes: ['party'],
position: { position: {
width: 550, width: 550,
height: 900, height: 900
}, },
window: { window: {
resizable: true resizable: true
@ -41,7 +40,7 @@ export default class Party extends DHBaseActorSheet {
selectRefreshable: DaggerheartMenu.selectRefreshable, selectRefreshable: DaggerheartMenu.selectRefreshable,
refreshActors: DaggerheartMenu.refreshActors refreshActors: DaggerheartMenu.refreshActors
}, },
dragDrop: [{ dragSelector: '.actors-section .inventory-item', dropSelector: null }] dragDrop: [{ dragSelector: '[data-item-id][draggable="true"]', dropSelector: null }]
}; };
/**@override */ /**@override */
@ -439,15 +438,15 @@ export default class Party extends DHBaseActorSheet {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async _onDragStart(event) { async _onDragStart(event) {
const item = event.currentTarget.closest('.inventory-item'); const item = await getDocFromElement(event.target);
const dragData = {
type: item.documentName,
uuid: item.uuid
};
if (item) { event.dataTransfer.setData('text/plain', JSON.stringify(dragData));
const adversaryData = { type: 'Actor', uuid: item.dataset.itemUuid }; super._onDragStart(event);
event.dataTransfer.setData('text/plain', JSON.stringify(adversaryData));
event.dataTransfer.setDragImage(item, 60, 0);
}
} }
async _onDrop(event) { async _onDrop(event) {