Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
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
17 changes: 15 additions & 2 deletions frontend/SplitPane.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,22 @@ class SplitPane extends React.Component {
onMove(x: number, y: number) {
var node = ReactDOM.findDOMNode(this);

// TODO: I don't understand what this is doing.
// It's probably related to margin and padding but it's necessary to avoid jumps:
// https://github.com/facebook/react-devtools/issues/611
// I can live with this for now but we should fix it.
// How I verify that it works:
// https://d2ppvlu71ri8gs.cloudfront.net/items/2R3J2I1S2N3s341i3c2R/Screen%20Recording%202017-04-21%20at%2004.43%20PM.gif?v=3410952d
// (it should be smooth without jumps)
const MAGIC = 10 + 3;

this.setState(prevState => ({
width: !this.props.isVertical ? prevState.width : (node.offsetLeft + node.offsetWidth) - x,
height: this.props.isVertical ? prevState.height : (node.offsetTop + node.offsetHeight) - y,
width: !this.props.isVertical ?
prevState.width :
(node.offsetLeft + node.offsetWidth - x - MAGIC),
height: this.props.isVertical ?
prevState.height :
(node.offsetTop + node.offsetHeight - y - MAGIC),
}));
}

Expand Down