Merge pull request #3156 from influxdata/polish/legend-hiding
Fix legend sticking around when opening CEOpull/10616/head
commit
0cf31351e5
|
@ -236,6 +236,7 @@ class Dygraph extends Component {
|
||||||
const newTime = this.eventToTimestamp(e)
|
const newTime = this.eventToTimestamp(e)
|
||||||
this.props.onSetHoverTime(newTime)
|
this.props.onSetHoverTime(newTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({isHoveringThisGraph: true})
|
this.setState({isHoveringThisGraph: true})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,22 +244,12 @@ class Dygraph extends Component {
|
||||||
if (this.props.onSetHoverTime) {
|
if (this.props.onSetHoverTime) {
|
||||||
this.props.onSetHoverTime(NULL_HOVER_TIME)
|
this.props.onSetHoverTime(NULL_HOVER_TIME)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({isHoveringThisGraph: false})
|
this.setState({isHoveringThisGraph: false})
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHideLegend = e => {
|
handleHideLegend = () => {
|
||||||
const {top, bottom, left, right} = this.graphRef.getBoundingClientRect()
|
this.setState({isHidden: true})
|
||||||
|
|
||||||
const mouseY = e.clientY
|
|
||||||
const mouseX = e.clientX
|
|
||||||
|
|
||||||
const mouseInGraphY = mouseY <= bottom && mouseY >= top
|
|
||||||
const mouseInGraphX = mouseX <= right && mouseX >= left
|
|
||||||
const isMouseHoveringGraph = mouseInGraphY && mouseInGraphX
|
|
||||||
|
|
||||||
if (!isMouseHoveringGraph) {
|
|
||||||
this.setState({isHidden: true})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getLineColors = () => {
|
getLineColors = () => {
|
||||||
|
|
Loading…
Reference in New Issue