Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 1338: Suche anpassen #1401

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions ui/src/components/search/search-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ export class SearchInput extends LitElementI18n {
}

private selectItem(item: SearchItem, options: { keepFocus?: boolean } = {}): void {
console.log('select', item);
const categorized = categorizeSearchItem(item);
switch (categorized.category) {
case SearchItemCategory.Location:
Expand Down Expand Up @@ -243,10 +242,12 @@ export class SearchInput extends LitElementI18n {
// rectangle is too small
const center = Rectangle.center(rectangle);
center.height = 5000;
this.viewer.camera.cancelFlight();
this.viewer.camera.flyTo({
destination: Cartographic.toCartesian(center),
});
} else {
this.viewer.camera.cancelFlight();
this.viewer.camera.flyTo({
destination: rectangle,
});
Expand Down Expand Up @@ -290,11 +291,15 @@ export class SearchInput extends LitElementI18n {
}
case 'ArrowUp':
case 'ArrowDown': {
const target = this.findActiveResult();
if (target != null) {
const [item, _element] = target;
this.selectItem(item, {keepFocus: true});
}
// Wait for a short interval before attempting to detect the currently selected item
// so the search has time to update the DOM.
setTimeout(() => {
const target = this.findActiveResult();
if (target != null) {
const [item, _element] = target;
this.selectItem(item, {keepFocus: true});
}
});
break;
}
default:
Expand Down Expand Up @@ -333,6 +338,7 @@ export class SearchInput extends LitElementI18n {
const child = results.children[i];
if (child.ariaSelected === 'true') {
const item = this.resultItems[i];
console.log(item, child);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

return [item, child as HTMLLIElement];
}
}
Expand Down