Iterate the resizer

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-10-13 12:28:23 +01:00
parent f72b1e0c7d
commit 1a45d18b94
5 changed files with 34 additions and 9 deletions

View file

@ -68,11 +68,19 @@ export default class Sizer {
return offset;
}
public setItemSize(item: HTMLElement, size: number) {
public getDesiredItemSize(item: HTMLElement) {
if (this.vertical) {
item.style.height = `${Math.round(size)}px`;
return item.style.height;
} else {
item.style.width = `${Math.round(size)}px`;
return item.style.width;
}
}
public setItemSize(item: HTMLElement, size: string) {
if (this.vertical) {
item.style.height = size;
} else {
item.style.width = size;
}
}