diff --git a/src/panel-triggers/components/ProblemTimeline.tsx b/src/panel-triggers/components/ProblemTimeline.tsx index 2f1f1d1..4ce2731 100644 --- a/src/panel-triggers/components/ProblemTimeline.tsx +++ b/src/panel-triggers/components/ProblemTimeline.tsx @@ -257,28 +257,31 @@ interface TimelinePointsProps { interface TimelinePointsState { order: number[]; + highlighted: number | null; } class TimelinePoints extends PureComponent { constructor(props) { super(props); - this.state = { order: [] }; + this.state = { order: [], highlighted: null }; } - bringToFront = index => { + bringToFront = (index: number, highlight = false ) => { const { events } = this.props; const length = events.length; const order = events.map((v, i) => i); order.splice(index, 1); order.push(index); - this.setState({ order }); + const highlighted = highlight ? index : null; + this.setState({ order, highlighted }); } highlightPoint = index => () => { if (this.props.onPointHighlight) { this.props.onPointHighlight(this.props.events[index]); } - this.bringToFront(index); + this.bringToFront(index, true); + // this.setState({ highlighted: this.props.events.length - 1 }); } @@ -287,7 +290,7 @@ class TimelinePoints extends PureComponent i); - this.setState({ order }); + this.setState({ order, highlighted: null }); } render() { @@ -299,6 +302,7 @@ class TimelinePoints extends PureComponent @@ -323,6 +328,7 @@ interface TimelinePointProps { x: number; r: number; color: string; + highlighted?: boolean; className?: string; onPointHighlight?: () => void; onPointUnHighlight?: () => void; @@ -338,18 +344,23 @@ class TimelinePoint extends PureComponent { if (this.props.onPointHighlight) { this.props.onPointHighlight(); } - this.setState({ highlighted: true }); } handleMouseLeave = () => { if (this.props.onPointUnHighlight) { this.props.onPointUnHighlight(); } - this.setState({ highlighted: false }); } render() {