sylvainjule / kirby-locator

A simple map & geolocation field, built on top of open-source services and Mapbox. Kirby 3 and 4.
99 stars 15 forks source link

Save zoom factor #18

Closed distantnative closed 5 years ago

distantnative commented 5 years ago

I would love if the zoom factor gets stored as well, so I can choose the right one in the Panel that I want to replicate on the front-end.

sylvainjule commented 5 years ago

That can indeed be handy! I'm adding it now.

distantnative commented 5 years ago

💛

distantnative commented 5 years ago

I just tried it and it isn't working for me so far.

distantnative commented 5 years ago

To specify it further: It seems so far you only tried to save zoom when something is find via geocoding lookup. It is not set when dragging the marker and it is not updated and saved when zooming in and out

sylvainjule commented 5 years ago

@distantnative, I have added a saveZoom and autoSaveZoom option, to fine tune the behavior of this zoom saving feature. I have set them both to false by default to keep the default past behavior of the field, you can turn them on either in your config.php or blueprint 😉

outline4 commented 5 months ago

Hi, I also ran in this issue. I've added this to the config.php

'sylvainjule.locator.saveZoom'     => true,
'sylvainjule.locator.autoSaveZoom' => true,     

I want to display the zoom level in a template like this:

<?php $location = $entry->cf_map()->yaml(); ?>
<a href="#map" data-id="<?= $entry->id() ?>" data-index="0" data-zoom="<?= $location['zoom']; ?>" class="show-marker">Show on map</a>

So far, this doesn't work. data-zoom is always empty.

Am I missing something?