From 6bf9751560a51724dfb84d32011bc9d4130969ab Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Mon, 19 Mar 2018 17:10:27 -0700 Subject: [PATCH] fix hover/crosshair bug Co-authored-by: Deniz Kusefoglu --- ui/src/shared/components/TableGraph.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index d2a60016e..8ac5960d7 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -57,10 +57,10 @@ class TableGraph extends Component { } handleHover = (columnIndex, rowIndex) => () => { - const {onSetHoverTime, tableOptions} = this.props - const {data} = this.state + const {onSetHoverTime, tableOptions: {verticalTimeAxis}} = this.props + const data = verticalTimeAxis ? this.state.data : this.state.unzippedData if (onSetHoverTime) { - const hoverTime = tableOptions.verticalTimeAxis + const hoverTime = verticalTimeAxis ? data[rowIndex][0] : data[0][columnIndex] onSetHoverTime(hoverTime.toString()) @@ -181,6 +181,11 @@ class TableGraph extends Component { ? this.calcHoverTimeIndex(data, hoverTime, verticalTimeAxis) : hoveredRowIndex const fixedColumnCount = tableOptions.fixFirstColumn ? 1 : undefined + const hoveringThisTable = hoveredColumnIndex !== NULL_COLUMN_INDEX + const scrollToRow = + !hoveringThisTable && verticalTimeAxis ? hoverTimeIndex : undefined + const scrollToColumn = + !hoveringThisTable && !verticalTimeAxis ? hoverTimeIndex : undefined return (