Skip to content

Commit

Permalink
fix for gregnb#1164
Browse files Browse the repository at this point in the history
  • Loading branch information
domind committed Feb 4, 2020
1 parent 12b2d2b commit 7c312ff
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/components/TableResize.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class TableResize extends React.Component {
setDividers = () => {
const tableEl = findDOMNode(this.tableRef);
const { width: tableWidth, height: tableHeight } = tableEl.getBoundingClientRect();
const { priorPosition, resizeCoords } = this.state;
const { resizeCoords } = this.state;

let finalCells = Object.entries(this.cellsRef);

Expand All @@ -67,17 +67,10 @@ class TableResize extends React.Component {

const elRect = item.getBoundingClientRect();
const elStyle = window.getComputedStyle(item, null);
const left = resizeCoords[key] !== undefined ? resizeCoords[key].left : undefined;
const oldLeft = priorPosition[key] || 0;
let newLeft = elRect.left + item.offsetWidth - parseInt(elStyle.paddingLeft) / 2;

if (left === oldLeft) return;

resizeCoords[key] = { left: newLeft };
priorPosition[key] = newLeft;
resizeCoords[key] = { left: elRect.left + item.offsetWidth - parseInt(elStyle.paddingLeft) / 2 };
});

this.setState({ tableWidth, tableHeight, resizeCoords, priorPosition }, this.updateWidths);
this.setState({ tableWidth, tableHeight, resizeCoords }, this.updateWidths);
};

updateWidths = () => {
Expand Down

0 comments on commit 7c312ff

Please sign in to comment.