From 28ec0f7462a379063d03e321be3000c231fac60e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 16 Oct 2018 18:42:56 +0200 Subject: [PATCH] onResized callback --- src/resizer/distributors.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/resizer/distributors.js b/src/resizer/distributors.js index bd0b122103..8b33ccabba 100644 --- a/src/resizer/distributors.js +++ b/src/resizer/distributors.js @@ -1,13 +1,17 @@ class FixedDistributor { - constructor(sizer, item) { + constructor(sizer, item, config) { this.sizer = sizer; this.item = item; this.beforeOffset = sizer.getItemOffset(this.item); + this.onResized = config.onResized; } resize(offset) { const itemSize = offset - this.beforeOffset; this.sizer.setItemSize(this.item, itemSize); + if (this.onResized) { + this.onResized(itemSize, this.item); + } return itemSize; } @@ -19,7 +23,7 @@ class FixedDistributor { class CollapseDistributor extends FixedDistributor { constructor(sizer, item, config) { - super(sizer, item); + super(sizer, item, config); this.toggleSize = config && config.toggleSize; this.onCollapsed = config && config.onCollapsed; }