From 0c742cee4da6f1552e1eaef6710e14fcf2cd6b42 Mon Sep 17 00:00:00 2001 From: Katsuhisa Yuasa Date: Sat, 21 Sep 2024 11:09:32 +0900 Subject: [PATCH 1/2] update view.Graph.active --- source/view.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/view.js b/source/view.js index 17943fdf26..cfdd284ab6 100644 --- a/source/view.js +++ b/source/view.js @@ -1984,10 +1984,15 @@ view.Graph = class extends grapher.Graph { activate(value) { if (this._table.has(value)) { - this.select(null); const element = this._table.get(value); - element.activate(); - return this.select([value]); + // If the element is already selected, skip running reselection. + if (this._selection.size === 1 && this._selection.has(element)) { + return [element]; + } else { + this.select(null); + element.activate(); + return this.select([value]); + } } return []; } From 54869fb4753bfd72c81bb97c1c2cc243397c3157 Mon Sep 17 00:00:00 2001 From: katsuhisa yuasa Date: Sat, 21 Sep 2024 04:13:58 +0900 Subject: [PATCH 2/2] fix an error reported by eslint --- source/view.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source/view.js b/source/view.js index cfdd284ab6..155078cecc 100644 --- a/source/view.js +++ b/source/view.js @@ -1988,11 +1988,10 @@ view.Graph = class extends grapher.Graph { // If the element is already selected, skip running reselection. if (this._selection.size === 1 && this._selection.has(element)) { return [element]; - } else { - this.select(null); - element.activate(); - return this.select([value]); } + this.select(null); + element.activate(); + return this.select([value]); } return []; }