Skip to content

Commit

Permalink
Add margins when calculating data
Browse files Browse the repository at this point in the history
  • Loading branch information
Drafteed committed Aug 17, 2022
1 parent a52c6ee commit 50de58e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/module/Filler.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export default class Filler extends Base {
? this.container.querySelector(this.options.wrapper)
: this.options.wrapper || this.options.container;

/** @type Array.<HTMLElement> **/
this.item = [];
this.refresh(false);

if (this.options.autoUpdate) {
Expand Down Expand Up @@ -125,7 +127,8 @@ export default class Filler extends Base {

this.item.map((el) => {
const rect = el.getBoundingClientRect();
const width = rect.width;
const style = window.getComputedStyle(el);
const width = rect.width + parseInt(style.marginLeft) + parseInt(style.marginRight);
data.itemWidth.push(width);
data.itemsWidth += width;
});
Expand Down

0 comments on commit 50de58e

Please sign in to comment.