Skip to content

Commit

Permalink
Make icons a consistent size across all tokens, fixes #30
Browse files Browse the repository at this point in the history
  • Loading branch information
illandril committed Mar 12, 2022
1 parent 6474d02 commit b8be4d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions module/lang/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"illandril-token-hud-scale.setting.effectIconsPerRow.label": "Effect Icons per Row / Col",
"illandril-token-hud-scale.setting.effectIconsPerRow.hint": "Adjusts the scale of Effect icons so that this many icons appear per row (column if Horizontal Effect Icons is uncheck) of icons (as shown on the token).",
"illandril-token-hud-scale.setting.effectIconsPerRow.label": "Effect Icons per Grid Size",
"illandril-token-hud-scale.setting.effectIconsPerRow.hint": "Adjusts the scale of Effect icons so that this many icons will fit in a single row or column on a 1x1 token (more will fit on larger tokens, and fewer on smaller tokens).",

"illandril-token-hud-scale.setting.effectIconsHorizontal.label": "Horizontal Effect Icons",
"illandril-token-hud-scale.setting.effectIconsHorizontal.hint": "Show the Effect icons horizontally. Uncheck to show the Effect icons vertically.",
Expand Down
5 changes: 3 additions & 2 deletions module/scripts/effect-scaler.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ function countEffects(token) {
}

function updateEffectScales(token) {
const iconsPerRow = Settings.EffectIconsPerRow.get();
const numEffects = countEffects(token);
const effectsHUD = token.hud && token.hud.effects || token.effects;
if (numEffects > 0 && effectsHUD.children.length > 0) {
const horizontal = Settings.EffectIconsHorizontal.get();
const w = Math.floor((horizontal ? token.w : token.h) / iconsPerRow);
const iconsPerRow = Math.ceil(Settings.EffectIconsPerRow.get() * (horizontal ? token.data.width : token.data.height));

const w = (horizontal ? token.w : token.h) / iconsPerRow;
const bg = effectsHUD.children[0];
bg.clear();
bg.beginFill(0x000000, 0.6).lineStyle(1.0, 0x000000);
Expand Down

0 comments on commit b8be4d9

Please sign in to comment.