From 5ccb88a801d816ddc68c7565c7308ab9641bf667 Mon Sep 17 00:00:00 2001 From: SpacialCircumstances Date: Mon, 8 Jul 2024 02:25:52 +0200 Subject: [PATCH] Fix stars being not selectable in object menu --- client/src/game/star.js | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/client/src/game/star.js b/client/src/game/star.js index d48a15161..3b30d5820 100644 --- a/client/src/game/star.js +++ b/client/src/game/star.js @@ -784,6 +784,23 @@ class Star extends EventEmitter { onClicked(e, tryMultiSelect = true) { const eventData = e ? e.data : null + const click = () => { + this.emit('onStarClicked', { + starData: this.data, + tryMultiSelect, + eventData, + permitCallback: () => { + // Need to do this otherwise sometimes text gets highlighted. + this.deselectAllText() + + if (this._getStarPlayer()) { + this.updateVisibility() + // this.setScale() + } + } + }) + }; + if (e?.data?.originalEvent) { const button = e.data.originalEvent.button; @@ -798,21 +815,10 @@ class Star extends EventEmitter { eventData }); } else { - this.emit('onStarClicked', { - starData: this.data, - tryMultiSelect, - eventData, - permitCallback: () => { - // Need to do this otherwise sometimes text gets highlighted. - this.deselectAllText() - - if (this._getStarPlayer()) { - this.updateVisibility() - // this.setScale() - } - } - }) + click(); } + } else { + click(); } }