mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-06-07 21:34:16 +02:00
Fix an error that can break the canvas when importing or resetting a character
This commit is contained in:
parent
829a6161ff
commit
bc45702f20
1 changed files with 3 additions and 3 deletions
|
|
@ -262,10 +262,10 @@ export default class DhTokenPlaceable extends foundry.canvas.placeables.Token {
|
||||||
const fillColor =
|
const fillColor =
|
||||||
number === 0 ? foundry.utils.Color.fromRGB([1, 0, 0]) : foundry.utils.Color.fromString('#0032b1');
|
number === 0 ? foundry.utils.Color.fromRGB([1, 0, 0]) : foundry.utils.Color.fromString('#0032b1');
|
||||||
|
|
||||||
// Draw the bar
|
// Draw the bar (accounting for possible floating point numbers)
|
||||||
const widthUnit = bw / data.max;
|
const widthUnit = bw / Math.ceil(data.max);
|
||||||
bar.clear().lineStyle(s, 0x000000, 1.0);
|
bar.clear().lineStyle(s, 0x000000, 1.0);
|
||||||
const sections = [...Array(data.max).keys()];
|
const sections = [...Array(Math.ceil(data.max)).keys()];
|
||||||
for (let mark of sections) {
|
for (let mark of sections) {
|
||||||
const x = mark * widthUnit;
|
const x = mark * widthUnit;
|
||||||
const marked = mark + 1 <= data.value;
|
const marked = mark + 1 <= data.value;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue