Skip to content

Commit 2534864

Browse files
fix top/left positioning, closes #21 and closes #56
1 parent 367ff54 commit 2534864

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/PivotTableUI.jsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Draggable from 'react-draggable';
1212
export class DraggableAttribute extends React.Component {
1313
constructor(props) {
1414
super(props);
15-
this.state = {open: false, top: 0, left: 0, filterText: ''};
15+
this.state = {open: false, filterText: ''};
1616
}
1717

1818
toggleValue(value) {
@@ -54,9 +54,7 @@ export class DraggableAttribute extends React.Component {
5454
style={{
5555
display: 'block',
5656
cursor: 'initial',
57-
zIndex: this.props.zIndex,
58-
top: this.state.top + 'px',
59-
left: this.state.left + 'px',
57+
zIndex: this.props.zIndex
6058
}}
6159
onClick={() => this.props.moveFilterBoxToTop(this.props.name)}
6260
>
@@ -136,14 +134,8 @@ export class DraggableAttribute extends React.Component {
136134
);
137135
}
138136

139-
toggleFilterBox(event) {
140-
const bodyRect = document.body.getBoundingClientRect();
141-
const rect = event.nativeEvent.target.getBoundingClientRect();
142-
this.setState({
143-
open: !this.state.open,
144-
top: 10 + rect.top - bodyRect.top,
145-
left: 10 + rect.left - bodyRect.left,
146-
});
137+
toggleFilterBox() {
138+
this.setState({ open: !this.state.open});
147139
this.props.moveFilterBoxToTop(this.props.name);
148140
}
149141

0 commit comments

Comments
 (0)