doublesecretagency / craft-googlemaps

Google Maps plugin for Craft CMS - Maps in minutes. Powered by the Google Maps API.
https://plugins.doublesecretagency.com/google-maps/
Other
10 stars 9 forks source link

Zoom always resetting to default #53

Closed idawgik closed 2 years ago

idawgik commented 2 years ago

I am trying to add a map with a specific zoom level set in the template (using the twig code). However, no matter how I set the zoom, it's always reset and loaded at the default value of 11.

Doing a bit of tracing through the dynamicmap.js file and adding some console logs to output, it initially applies the zoom I have set, but then resets it to the default. The reset is happening in the this._preventGreyBox function. For some reason, that function isn't able to get the zoom value I have set.

Here is my template code:

{% set address = contactInformation.location %}
{{ googleMaps.map(address, {
    'height': 500
}).zoom(17).tag() }}

I also tried it with the zoom as part of the options with no different result:

{% set address = contactInformation.location %}
{{ googleMaps.map(address, {
    'height': 500,
    'zoom': 17
}).tag() }}

I'm very likely missing something obvious, but it's definitely not working for me.

I am on Craft CMS 3.7.38 and Google Maps 4.1.9.

lindseydiloreto commented 2 years ago

Hi @idawgik,

Sorry about that, I think I know where the problem is! I can get it patched up, though it might take a few weeks because of my upcoming schedule.

In the meantime, simply roll the Google Maps plugin back to an earlier version. I'm not sure how far back you need to go, maybe only one or two releases back. At worst, you can lock the plugin version to 4.1.4, which was a very stable version (before I made some changes to the info windows).

Depending on circumstance, the patch might only get applied to a version of the plugin which is compatible with Craft 4.

What is your estimated timeline for updating to Craft 4?

idawgik commented 2 years ago

I downgraded to 4.1.4 and it's working great.

This is a site still early in development, so we will probably be moving it to Craft 4 right away when that's released.

lindseydiloreto commented 2 years ago

Excellent, thanks for reporting back!

idawgik commented 2 years ago

As an FYI, I updated this dev site up to Craft 4 yesterday, and this issue came back with the plugin version compatible with Craft 4. This is on Google Maps v4.2.1

lindseydiloreto commented 2 years ago

This is now fixed! Update to v4.2.2 whenever you get a chance.

idawgik commented 2 years ago

Just updated. Works great. Thank you!

lindseydiloreto commented 2 years ago

Awesome, thanks for reporting back! 👍