Skip to content

Commit

Permalink
fix: 🐛 fix searchbox looking for dataset on span
Browse files Browse the repository at this point in the history
  • Loading branch information
thkruz committed Dec 29, 2023
1 parent 6b3ac89 commit 67261ac
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/hud/SearchBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,19 @@ function registerListeners () {
if (!searchResultsElem) {
return;
}
searchResultsElem.addEventListener('click', (event: any) => {
const target = event.target;
const satId = target.dataset.satId;
searchResultsElem.addEventListener('click', (event: Event) => {
let target = event.target as HTMLElement;
if (target.className !== 'search-result') {
target = target.closest('.search-result') as HTMLElement;
}
if (!target) {
return;
}

const satId = target?.dataset.satId as string;
clearHover();

viewer.setSelectedSatellite(satId);
viewer.setSelectedSatellite(parseInt(satId));
});

document.querySelector('#search')?.addEventListener('input', () => {
Expand Down

0 comments on commit 67261ac

Please sign in to comment.