army sheet : added ability to drop a actor for commander & warlord, and some fixes

This commit is contained in:
Vlyan
2021-12-02 10:09:47 +01:00
parent 1b1dbbdb2d
commit c265e741b9
12 changed files with 261 additions and 70 deletions

View File

@@ -70,7 +70,7 @@ export class HelpersL5r5e {
* @return {Promise<null>}
*/
static async getDragnDropTargetObject(event) {
const json = event.dataTransfer.getData("text/plain");
const json = event.dataTransfer?.getData("text/plain");
if (!json) {
return null;
}
@@ -427,6 +427,18 @@ export class HelpersL5r5e {
}
return await item.renderTextTemplate();
});
// Open actor sheet
html.find(".open-sheet-actor-id").on("click", (event) => {
event.preventDefault();
event.stopPropagation();
const id = $(event.currentTarget).data("actor-id");
if (!id) {
return;
}
game.actors.get(id)?.sheet?.render(true);
});
}
/**