Use more descriptive name for state in parent component

pull/10616/head
Alex P 2017-09-28 14:55:24 -07:00
parent 9155af051c
commit 29b07be3be
1 changed files with 7 additions and 7 deletions

View File

@ -37,7 +37,7 @@ export default class Dygraph extends Component {
isAscending: true, isAscending: true,
isSnipped: false, isSnipped: false,
isFilterVisible: false, isFilterVisible: false,
arrowPosition: 'top', legendArrowPosition: 'top',
} }
} }
@ -374,11 +374,11 @@ export default class Dygraph extends Component {
const willLegendFitLeft = e.pageX - chronografChromeSize > legendWidth const willLegendFitLeft = e.pageX - chronografChromeSize > legendWidth
let legendTop = graphHeight + 8 let legendTop = graphHeight + 8
this.setState({arrowPosition: 'top'}) this.setState({legendArrowPosition: 'top'})
// If legend is only clipped on the bottom, position above graph // If legend is only clipped on the bottom, position above graph
if (isLegendBottomClipped && !isLegendTopClipped) { if (isLegendBottomClipped && !isLegendTopClipped) {
this.setState({arrowPosition: 'bottom'}) this.setState({legendArrowPosition: 'bottom'})
legendTop = -legendHeight legendTop = -legendHeight
} }
// If legend is clipped on top and bottom, posiition on either side of crosshair // If legend is clipped on top and bottom, posiition on either side of crosshair
@ -386,11 +386,11 @@ export default class Dygraph extends Component {
legendTop = 0 legendTop = 0
if (willLegendFitLeft) { if (willLegendFitLeft) {
this.setState({arrowPosition: 'right'}) this.setState({legendArrowPosition: 'right'})
legendLeft = trueGraphX - legendWidth / 2 legendLeft = trueGraphX - legendWidth / 2
legendLeft -= 8 legendLeft -= 8
} else { } else {
this.setState({arrowPosition: 'left'}) this.setState({legendArrowPosition: 'left'})
legendLeft = trueGraphX + legendWidth / 2 legendLeft = trueGraphX + legendWidth / 2
legendLeft += 32 legendLeft += 32
} }
@ -430,7 +430,7 @@ export default class Dygraph extends Component {
isSnipped, isSnipped,
filterText, filterText,
isAscending, isAscending,
arrowPosition, legendArrowPosition,
isFilterVisible, isFilterVisible,
} = this.state } = this.state
@ -450,7 +450,7 @@ export default class Dygraph extends Component {
legendRef={this.handleLegendRef} legendRef={this.handleLegendRef}
onToggleFilter={this.handleToggleFilter} onToggleFilter={this.handleToggleFilter}
onInputChange={this.handleLegendInputChange} onInputChange={this.handleLegendInputChange}
arrowPosition={arrowPosition} arrowPosition={legendArrowPosition}
/> />
<div <div
ref={r => { ref={r => {