Search adjustments

This commit is contained in:
2026-05-25 14:31:15 +02:00
parent cb39695e6c
commit c7c6ff2224
4 changed files with 13 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
import { Controller } from "@hotwired/stimulus";
import { GisState } from "../state.js";
import UI from "../ui.js";
import { INIT_ZOOM } from "../gis.js";
const html = String.raw;
@@ -41,6 +42,8 @@ export default class extends Controller {
this.containerTarget.classList.remove('is-hidden');
this.#injectResults(results);
if (results.length) {
// Reset zoom level after successful search
map.setZoom(INIT_ZOOM);
this.#filterMap(results);
// Should technique always be shown after a search?
for (const key of Object.keys(techsMarkers)) {
@@ -61,6 +64,8 @@ export default class extends Controller {
// Empty result set
this.resultsTarget.innerHTML = '';
this.containerTarget.classList.add('is-hidden');
// Reset map zoom
map.setZoom(INIT_ZOOM);
}
#injectResults(results) {
@@ -98,7 +103,7 @@ export default class extends Controller {
data-action="marker#go"
data-marker-coords-value="${coordinates}"
data-marker-group-value="sites">
Vai al sito
Vai
<span class="ml-1 icon">
<i class="fa fa-chevron-right"></i>
</span>