onResized callback

pull/21833/head
Bruno Windels 2018-10-16 18:42:56 +02:00
parent 1d2e1d4b6b
commit 28ec0f7462
1 changed files with 6 additions and 2 deletions

View File

@ -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;
}