Implement Token UI adjustments

Implement the sub-module moving the attribute bars and nameplate
to work well with our dynamic borders.

The attribute bars are moved below the token, one on
top of the other, and the nameplate is moved above.

This is done by monkey patching the `_drawBar()` and
`_refreshNameplate()` functions from the Token class.
This is vulnerable to compatibility issues with other
modules, but is the only way I found for the changes
to be shown without further input.

Indeed, those functions are called after the `drawToken`
hook, which makes it impossible to move those UI elements
there.
We can do it in the `refreshToken` hook, which works *but*
requires the canvas view to be moved at least once for
the position change to be reflected, which looks a bit
broken.

So we monkey patch the functions, but bind them
beforehand to be able to call them within our custom
function as we don't want to duplicate what they do.

Update README and translations for the added setting.
This commit is contained in:
trotFunky 2025-06-01 18:37:18 +01:00
parent ab02dd139a
commit 22dc500801
4 changed files with 80 additions and 0 deletions

View file

@ -17,6 +17,14 @@
"Hint": "L'image à utiliser comme bordure pour les jetons joueurs qui ont joué leur tour."
}
}
},
"TokenUiAdjust": {
"Settings": {
"Enabled": {
"Name": "Ajustements d'interface des tokens",
"Hint": "Déplace les barres d'attributs sous le token et le nom au dessus."
}
}
}
}
}