Hide quick-search pills on low zoom levels
This commit is contained in:
@@ -15,6 +15,7 @@ export default class AppHeaderComponent extends Component {
|
|||||||
@service settings;
|
@service settings;
|
||||||
@service nostrAuth;
|
@service nostrAuth;
|
||||||
@service nostrData;
|
@service nostrData;
|
||||||
|
@service mapUi;
|
||||||
@tracked isUserMenuOpen = false;
|
@tracked isUserMenuOpen = false;
|
||||||
@tracked searchQuery = '';
|
@tracked searchQuery = '';
|
||||||
|
|
||||||
@@ -22,6 +23,11 @@ export default class AppHeaderComponent extends Component {
|
|||||||
return !!this.searchQuery;
|
return !!this.searchQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get showQuickSearch() {
|
||||||
|
const zoom = this.mapUi.currentZoom ?? 13;
|
||||||
|
return this.settings.showQuickSearchButtons && zoom >= 12;
|
||||||
|
}
|
||||||
|
|
||||||
@action
|
@action
|
||||||
toggleUserMenu() {
|
toggleUserMenu() {
|
||||||
this.isUserMenuOpen = !this.isUserMenuOpen;
|
this.isUserMenuOpen = !this.isUserMenuOpen;
|
||||||
@@ -54,7 +60,7 @@ export default class AppHeaderComponent extends Component {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if this.settings.showQuickSearchButtons}}
|
{{#if this.showQuickSearch}}
|
||||||
<div class="header-center {{if this.hasQuery 'searching'}}">
|
<div class="header-center {{if this.hasQuery 'searching'}}">
|
||||||
<CategoryChips @onSelect={{this.handleChipSelect}} />
|
<CategoryChips @onSelect={{this.handleChipSelect}} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -284,6 +284,7 @@ export default class MapComponent extends Component {
|
|||||||
// Initialize the UI service with the map center
|
// Initialize the UI service with the map center
|
||||||
const initialCenter = toLonLat(view.getCenter());
|
const initialCenter = toLonLat(view.getCenter());
|
||||||
this.mapUi.updateCenter(initialCenter[1], initialCenter[0]);
|
this.mapUi.updateCenter(initialCenter[1], initialCenter[0]);
|
||||||
|
this.mapUi.updateZoom(view.getZoom());
|
||||||
|
|
||||||
apply(this.mapInstance, 'https://tiles.openfreemap.org/styles/liberty', {
|
apply(this.mapInstance, 'https://tiles.openfreemap.org/styles/liberty', {
|
||||||
webfonts: 'data:text/css,',
|
webfonts: 'data:text/css,',
|
||||||
@@ -1046,6 +1047,7 @@ export default class MapComponent extends Component {
|
|||||||
const view = this.mapInstance.getView();
|
const view = this.mapInstance.getView();
|
||||||
const center = toLonLat(view.getCenter());
|
const center = toLonLat(view.getCenter());
|
||||||
this.mapUi.updateCenter(center[1], center[0]);
|
this.mapUi.updateCenter(center[1], center[0]);
|
||||||
|
this.mapUi.updateZoom(view.getZoom());
|
||||||
|
|
||||||
// If in creation mode, update the coordinates in the service AND the URL
|
// If in creation mode, update the coordinates in the service AND the URL
|
||||||
if (this.mapUi.isCreating) {
|
if (this.mapUi.isCreating) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export default class MapUiService extends Service {
|
|||||||
@tracked returnToSearch = false;
|
@tracked returnToSearch = false;
|
||||||
@tracked currentCenter = null;
|
@tracked currentCenter = null;
|
||||||
@tracked currentBounds = null;
|
@tracked currentBounds = null;
|
||||||
|
@tracked currentZoom = null;
|
||||||
@tracked searchBoxHasFocus = false;
|
@tracked searchBoxHasFocus = false;
|
||||||
@tracked selectionOptions = {};
|
@tracked selectionOptions = {};
|
||||||
@tracked preventNextZoom = false;
|
@tracked preventNextZoom = false;
|
||||||
@@ -81,6 +82,10 @@ export default class MapUiService extends Service {
|
|||||||
this.currentCenter = { lat, lon };
|
this.currentCenter = { lat, lon };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateZoom(zoom) {
|
||||||
|
this.currentZoom = zoom;
|
||||||
|
}
|
||||||
|
|
||||||
updateBounds(bounds) {
|
updateBounds(bounds) {
|
||||||
this.currentBounds = bounds;
|
this.currentBounds = bounds;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user