Skip to content

Commit

Permalink
Merge pull request #57 from thkruz/searchbox-fix
Browse files Browse the repository at this point in the history
fix: 🐛 fix searchbox looking for dataset on span
  • Loading branch information
ajmas committed Jan 5, 2024
2 parents 527d63c + 67261ac commit 991da68
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 991da68

Please sign in to comment.