Skip to content

Commit

Permalink
Scroller: Fix setSpacerSize after merge of master
Browse files Browse the repository at this point in the history
  • Loading branch information
Max0nyshchenko committed Oct 27, 2024
1 parent 5bc00ca commit c14c216
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/app/components/scroller/scroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,14 +888,15 @@ export class Scroller implements OnInit, AfterContentInit, AfterViewChecked, OnD

setSpacerSize() {
if (this._items) {
const setProp = (_name, _count, _size) => (this.spacerStyle = { ...this.spacerStyle, ...{ [`${_name}`]: _count * _size + 'px' } });
const setProp = (_name, _size) => (this.spacerStyle = { ...this.spacerStyle, ...{ [`${_name}`]: _size + 'px' } });

const numItems = this._items.length;
if (this.both) {
setProp('height', numItems, this._itemSize[0]);
setProp('width', this._columns?.length || this._items[1]?.length, this._itemSize[1]);
if (this.isBoth(this._items)) {
const lastItemSize = this._getItemSize(this._items.at(-1).at(-1), this._items.length - 1, this._items.at(-1).length - 1);
setProp('height', this._itemsPositions.mainAxis.at(-1) + lastItemSize.mainAxis);
setProp('width', this._itemsPositions.crossAxis.at(-1) + lastItemSize.crossAxis);
} else {
this.horizontal ? setProp('width', this._columns.length || this._items.length, this._itemSize) : setProp('height', numItems, this._itemSize);
const spacerSize = this._getItemSize(this._items.at(-1), this._items.length - 1, 0).mainAxis + this._itemsPositions.mainAxis.at(-1);
setProp(this.horizontal ? 'width' : 'height', spacerSize);
}
}
}
Expand Down

0 comments on commit c14c216

Please sign in to comment.