diff --git a/module/applications/actor/api/base-actor-sheet.mjs b/module/applications/actor/api/base-actor-sheet.mjs index 79df33f1bd..08c3fe3771 100644 --- a/module/applications/actor/api/base-actor-sheet.mjs +++ b/module/applications/actor/api/base-actor-sheet.mjs @@ -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 } }; @@ -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; } @@ -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") ) {