Skip to content

Commit

Permalink
fix top/left positioning, closes plotly#21 and closes plotly#56
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaskruchten committed Oct 29, 2018
1 parent 367ff54 commit 2534864
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions src/PivotTableUI.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Draggable from 'react-draggable';
export class DraggableAttribute extends React.Component {
constructor(props) {
super(props);
this.state = {open: false, top: 0, left: 0, filterText: ''};
this.state = {open: false, filterText: ''};
}

toggleValue(value) {
Expand Down Expand Up @@ -54,9 +54,7 @@ export class DraggableAttribute extends React.Component {
style={{
display: 'block',
cursor: 'initial',
zIndex: this.props.zIndex,
top: this.state.top + 'px',
left: this.state.left + 'px',
zIndex: this.props.zIndex
}}
onClick={() => this.props.moveFilterBoxToTop(this.props.name)}
>
Expand Down Expand Up @@ -136,14 +134,8 @@ export class DraggableAttribute extends React.Component {
);
}

toggleFilterBox(event) {
const bodyRect = document.body.getBoundingClientRect();
const rect = event.nativeEvent.target.getBoundingClientRect();
this.setState({
open: !this.state.open,
top: 10 + rect.top - bodyRect.top,
left: 10 + rect.left - bodyRect.left,
});
toggleFilterBox() {
this.setState({ open: !this.state.open});
this.props.moveFilterBoxToTop(this.props.name);
}

Expand Down

0 comments on commit 2534864

Please sign in to comment.