Skip to content

Commit

Permalink
Use offsetWidth instead of getBoundingClientRect() on calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Drafteed committed Oct 9, 2023
1 parent b018e59 commit 6378099
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/module/Filler.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,8 @@ export default class Filler extends Base {
};

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

0 comments on commit 6378099

Please sign in to comment.