mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-17 23:49:02 +01:00
deduplicate and simplify
This commit is contained in:
parent
598bf733f8
commit
b269e58585
4 changed files with 37 additions and 44 deletions
|
|
@ -656,31 +656,14 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
}
|
||||
|
||||
async _onDragStart(event) {
|
||||
const target = event.target || event.currentTarget;
|
||||
const itemElement = target.closest('[data-item-id]');
|
||||
const item = this.getItem(event);
|
||||
|
||||
if (itemElement) {
|
||||
const itemId = itemElement.dataset.itemId;
|
||||
const itemType = itemElement.dataset.type;
|
||||
|
||||
let item;
|
||||
if (itemType === 'effect') {
|
||||
item = this.document.effects.get(itemId);
|
||||
} else {
|
||||
item = this.document.items.get(itemId);
|
||||
}
|
||||
|
||||
if (item) {
|
||||
const dragData = {
|
||||
type: item.documentName,
|
||||
uuid: item.uuid
|
||||
};
|
||||
|
||||
event.dataTransfer.setData('text/plain', JSON.stringify(dragData));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
const dragData = {
|
||||
type: item.documentName,
|
||||
uuid: item.uuid
|
||||
};
|
||||
|
||||
event.dataTransfer.setData('text/plain', JSON.stringify(dragData));
|
||||
|
||||
super._onDragStart(event);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue