From 296b65be00c72fbd25333e1b0f7000cdfce9b939 Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Tue, 28 May 2024 17:52:48 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20(slope)=20only=20enable=20dismis?= =?UTF-8?q?s=20by=20click=20after=20interaction?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx b/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx index 843c307b7b8..8e8695c7a19 100644 --- a/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx +++ b/packages/@ourworldindata/grapher/src/slopeCharts/SlopeChart.tsx @@ -95,6 +95,8 @@ export class SlopeChart // currently hovered legend color @observable hoverColor?: string + private hasInteractedWithChart = false + transformTable(table: OwidTable) { if (!table.has(this.yColumnSlug)) return table @@ -164,7 +166,7 @@ export class SlopeChart if (!isEntitySelectionEnabled || hoverKey === undefined) { return } - + this.hasInteractedWithChart = true this.selectionArray.toggleSelection(hoverKey) } @@ -201,6 +203,8 @@ export class SlopeChart const { hoverColor, isEntitySelectionEnabled } = this if (!isEntitySelectionEnabled || hoverColor === undefined) return + this.hasInteractedWithChart = true + const seriesNamesToToggle = this.series .filter((g) => g.color === hoverColor) .map((g) => g.seriesName) @@ -545,6 +549,7 @@ export class SlopeChart if ( this.isEntitySelectionEnabled && + this.hasInteractedWithChart && !this.hoverKey && !this.hoverColor && !this.manager.isModalOpen &&