Search adjustments
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -29,6 +29,9 @@ GIS.INIT_ZOOM = 14;
|
||||
GIS.MIN_ZOOM = 11;
|
||||
GIS.MAX_ZOOM = 24;
|
||||
|
||||
// Terrible... fix it!
|
||||
export const INIT_ZOOM = 14;
|
||||
|
||||
/**
|
||||
* Capitalize a text string
|
||||
* @todo Move to utils
|
||||
|
||||
@@ -59,6 +59,6 @@ Icons.reuse = L.icon(
|
||||
|
||||
Icons.camera = L.divIcon({className: 'fa fa-camera'});
|
||||
|
||||
Icons.techs = L.divIcon({className: 'fa fa-circle has-text-primary-25'});
|
||||
Icons.techs = L.divIcon({className: 'fa fa-circle has-text-link-45'});
|
||||
|
||||
export default Icons;
|
||||
Reference in New Issue
Block a user