Skip to content

Commit

Permalink
🐛 (slope) give feedback when currently hidden entity is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Mar 21, 2024
1 parent b084385 commit eb77042
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -475,15 +475,18 @@ export class SlopeChart

componentDidMount() {
if (this.grapherElement) {
this.grapherElement.addEventListener("click", this.onGrapherClick)
this.grapherElement.addEventListener(
"mousedown",
this.onGrapherClick
)
}
exposeInstanceOnWindow(this)
}

componentWillUnmount(): void {
if (this.grapherElement) {
this.grapherElement.removeEventListener(
"click",
"mousedown",
this.onGrapherClick
)
}
Expand Down Expand Up @@ -713,8 +716,12 @@ class LabelledSlopes
// Then, a special "foreground" set of entities is rendered over the background
@computed private get isLayerMode() {
return (
this.hoveredSeriesNames.length > 0 ||
this.focusedSeriesNames.length > 0 ||
this.hoveredSeriesNames.length > 0
// if the user has selected entities that are not in the chart,
// we want to move all entities into the background
(this.props.focusKeys?.length > 0 &&
this.focusedSeriesNames.length === 0)
)
}

Expand Down

0 comments on commit eb77042

Please sign in to comment.