Skip to content

fix: drag jumps to the right due to the failed merge #1564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/react-data-grid/src/HeaderCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class HeaderCell extends React.Component {

state = { resizing: false };

headerCellRef = (node) => this.headerCell = node;
headerCell = React.createRef();

onDragStart = (e) => {
this.setState({ resizing: true });
Expand All @@ -59,7 +59,7 @@ export default class HeaderCell extends React.Component {

getWidthFromMouseEvent = (e) => {
const right = e.pageX || (e.touches && e.touches[0] && e.touches[0].pageX) || (e.changedTouches && e.changedTouches[e.changedTouches.length - 1].pageX);
const left = ReactDOM.findDOMNode(this).getBoundingClientRect().left;
const left = this.headerCell.current ? this.headerCell.current.getBoundingClientRect().left : 0;
return right - left;
};

Expand Down Expand Up @@ -120,7 +120,7 @@ export default class HeaderCell extends React.Component {
'react-grid-HeaderCell--frozen': isFrozen(column)
}, this.props.className, column.cellClass);
const cell = (
<div ref={this.headerCellRef} className={className} style={this.getStyle()}>
<div ref={this.headerCell} className={className} style={this.getStyle()}>
{this.getCell()}
{resizeHandle}
</div>
Expand Down