Army sheet : added ability to drag n drop a cohort on a map
Cohort sheet : added ability to drag n drop an actor and some css
This commit is contained in:
@@ -17,6 +17,7 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
|
||||
});
|
||||
}
|
||||
|
||||
/** @override */
|
||||
constructor(options = {}) {
|
||||
super(options);
|
||||
this._initialize();
|
||||
@@ -81,7 +82,9 @@ export class ArmySheetL5r5e extends BaseSheetL5r5e {
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete the linked Actor (warlod/commander)
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -114,6 +117,24 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user