Iterate with new buttons and resize locking
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
d36fafd0c6
commit
a6c81a903c
8 changed files with 173 additions and 89 deletions
|
@ -163,16 +163,20 @@ export default class Resizer<C extends IConfig = IConfig> {
|
|||
};
|
||||
|
||||
private onResize = throttle(() => {
|
||||
const distributors = this.getResizeHandles().map(handle => {
|
||||
const {distributor} = this.createSizerAndDistributor(<HTMLDivElement>handle);
|
||||
return distributor;
|
||||
});
|
||||
const distributors = this.getDistributors();
|
||||
|
||||
// relax all items if they had any overconstrained flexboxes
|
||||
distributors.forEach(d => d.start());
|
||||
distributors.forEach(d => d.finish());
|
||||
}, 100, {trailing: true, leading: true});
|
||||
|
||||
public getDistributors = () => {
|
||||
return this.getResizeHandles().map(handle => {
|
||||
const {distributor} = this.createSizerAndDistributor(<HTMLDivElement>handle);
|
||||
return distributor;
|
||||
});
|
||||
};
|
||||
|
||||
private createSizerAndDistributor(
|
||||
resizeHandle: HTMLDivElement,
|
||||
): {sizer: Sizer, distributor: FixedDistributor<any>} {
|
||||
|
@ -186,6 +190,7 @@ export default class Resizer<C extends IConfig = IConfig> {
|
|||
}
|
||||
|
||||
private getResizeHandles() {
|
||||
if (!this.container.children) return [];
|
||||
return Array.from(this.container.children).filter(el => {
|
||||
return this.isResizeHandle(<HTMLElement>el);
|
||||
}) as HTMLElement[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue