Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions module/applications/actor/api/base-actor-sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,6 @@ export default class BaseActorSheet extends PrimarySheetMixin(
submitOnChange: true
},
window: {
controls: [
{
action: "restoreTransformation",
icon: "fa-solid fa-backward",
label: "DND5E.TRANSFORM.Action.Restore",
ownership: "OWNER",
visible: BaseActorSheet.#canRestoreTransformation
}
],
resizable: true
}
};
Expand Down Expand Up @@ -731,6 +722,17 @@ export default class BaseActorSheet extends PrimarySheetMixin(
warnings.setAttribute("aria-label", _loc("Warnings"));
this.window.subtitle.after(warnings);

// Restore transformation
const restore = document.createElement("button");
restore.type = "button";
restore.classList.add("header-control", "restore-transformation", "icon", "fa-solid", "fa-backward");
const restoreLabel = _loc("DND5E.TRANSFORM.Action.Restore");
Object.assign(restore.dataset, {
action: "restoreTransformation", tooltip: restoreLabel, tooltipDirection: "DOWN"
});
restore.setAttribute("aria-label", restoreLabel);
this.window.subtitle.after(restore);

return html;
}

Expand Down Expand Up @@ -1157,6 +1159,10 @@ export default class BaseActorSheet extends PrimarySheetMixin(
const warnings = this.element.querySelector(".window-header .preparation-warnings");
warnings?.toggleAttribute("hidden", (!game.user.isGM && this.actor.limited) || !context.warnings?.length);

// Display the restore transformation button only while a transformation is active
const restore = this.element.querySelector(".window-header .restore-transformation");
restore?.toggleAttribute("hidden", !BaseActorSheet.#canRestoreTransformation.call(this));

if ( this.isEditable ) {
// Class level changes
for ( const element of this.element.querySelectorAll(".level-selector") ) {
Expand Down