Support room-defined height as well

Much like widget widths, it is acceptable for us to forget what everyone's height was previously at.
This commit is contained in:
Travis Ralston 2021-01-18 19:27:11 -07:00
parent cfb583d193
commit 0d29d15a46
4 changed files with 98 additions and 14 deletions

View file

@ -32,3 +32,11 @@ export function clamp(i: number, min: number, max: number): number {
export function sum(...i: number[]): number {
return [...i].reduce((p, c) => c + p, 0);
}
export function percentageWithin(pct: number, min: number, max: number): number {
return (pct * (max - min)) + min;
}
export function percentageOf(val: number, min: number, max: number): number {
return (val - min) / max;
}