diff --git a/system/scripts/actors/army-sheet.js b/system/scripts/actors/army-sheet.js index e133777..2314329 100644 --- a/system/scripts/actors/army-sheet.js +++ b/system/scripts/actors/army-sheet.js @@ -82,8 +82,6 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e { return; } - html.find(".entity-link").on("dragstart", this._onDragEntityLink.bind(this)); - // Delete the linked Actor (warlord/commander) html.find(".actor-remove-control").on("click", this._removeLinkedActor.bind(this)); } @@ -117,24 +115,6 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e { return out; } - /** - * Callback actions which occur at the beginning of a drag start workflow. - * @param {DragEvent} event The originating DragEvent - */ - _onDragEntityLink(event) { - const actorId = $(event.currentTarget).data("actor-id"); - if (!actorId) { - return; - } - event.originalEvent.dataTransfer.setData( - "text/plain", - JSON.stringify({ - type: "Actor", - id: actorId, - }) - ); - } - /** * Handle dropped Item data on the Actor sheet (cohort, fortification) * @param {DragEvent} event diff --git a/system/scripts/helpers.js b/system/scripts/helpers.js index 743a772..afc307d 100644 --- a/system/scripts/helpers.js +++ b/system/scripts/helpers.js @@ -70,12 +70,10 @@ export class HelpersL5r5e { * @return {Promise} */ static async getDragnDropTargetObject(event) { - const json = event.dataTransfer?.getData("text/plain"); - if (!json) { - return null; - } - const data = JSON.parse(json); - if (!data) { + let data; + try { + data = JSON.parse(event.dataTransfer?.getData("text/plain")); + } catch (err) { return null; } return await HelpersL5r5e.getObjectGameOrPack(data); @@ -419,6 +417,21 @@ export class HelpersL5r5e { } }); + // Ability to drag n drop an actor + html.find(".dragndrop-actor-id").on("dragstart", (event) => { + const actorId = $(event.currentTarget).data("actor-id"); + if (!actorId) { + return; + } + event.originalEvent.dataTransfer.setData( + "text/plain", + JSON.stringify({ + type: "Actor", + id: actorId, + }) + ); + }); + // Item detail tooltips this.popupManager(html.find(".l5r5e-tooltip"), async (event) => { const item = await HelpersL5r5e.getEmbedItemByEvent(event, actor); diff --git a/system/templates/gm/gm-monitor.html b/system/templates/gm/gm-monitor.html index 0037eec..a52216d 100644 --- a/system/templates/gm/gm-monitor.html +++ b/system/templates/gm/gm-monitor.html @@ -21,7 +21,7 @@ {{#each data.actors as |actor|}} - + {{actor.name}} {{#if actor.data.data.attitude}}

({{actor.data.data.attitude}})

{{/if}} @@ -91,7 +91,7 @@ {{#each data.actors as |actor|}} - + {{actor.name}} {{#if actor.data.data.warlord_actor_id}} diff --git a/system/templates/items/army-cohort/army-cohort-entry.html b/system/templates/items/army-cohort/army-cohort-entry.html index 125db6a..558aaaa 100644 --- a/system/templates/items/army-cohort/army-cohort-entry.html +++ b/system/templates/items/army-cohort/army-cohort-entry.html @@ -1,6 +1,6 @@ -