Iterate the resizer
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
f72b1e0c7d
commit
1a45d18b94
5 changed files with 34 additions and 9 deletions
|
@ -39,10 +39,18 @@ export default class FixedDistributor<C extends IConfig, I extends ResizeItem<an
|
|||
|
||||
private readonly beforeOffset: number;
|
||||
|
||||
constructor(protected item: I) {
|
||||
constructor(public readonly item: I) {
|
||||
this.beforeOffset = item.offset();
|
||||
}
|
||||
|
||||
public get size() {
|
||||
return this.item.getSize();
|
||||
}
|
||||
|
||||
public set size(size: string) {
|
||||
this.item.setRawSize(size);
|
||||
}
|
||||
|
||||
public resize(size: number) {
|
||||
this.item.setSize(size);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ class PercentageSizer extends Sizer {
|
|||
|
||||
public finish(item: HTMLElement) {
|
||||
const parent = item.offsetParent as HTMLElement;
|
||||
if (!parent) return;
|
||||
if (this.vertical) {
|
||||
const p = ((item.offsetHeight / parent.offsetHeight) * 100).toFixed(2) + "%";
|
||||
item.style.minHeight = p;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue