Pan to selected store with padding


The title pretty much says it all. Automatically pan to selected store is great! But why not take the padding set in the mapView instance into account when doing so?

If I activate paddedStoreCenter it WILL pan using padding options ! but only if the store was out of padded bounds.

One solution would be to turn off automatic padding to selected store and doing it ourselves but I was wondering it there was another way ! :smiley:

Thank you in advance.

Hi @Tucsky, thanks for joining the Woosmap Community.

Yes you’re right.
The solution would have been to use the gentleCenter property (define if the view will center on the selectedStore only if it’s not already in the padded zone). But this property is not applied as soon as you set a custom padding.

However, you can use the TiledView.PanTo() method which take into account your padding option and can be forced to Pan (using the force parameter), regardless if the store is already in your padded bounds.

const padding = {left: 150, top: 50}
        lat: geometry.coordinates[1],
        lng: geometry.coordinates[0]
    padding, true);

The API Reference (here) does not mention this parameter but it’s a mistake. We will add it shortly - thanks for your feedback.

Please let me know if this help or if you require further information.

1 Like

Thank you sir for the super fast answer! That’s amazing. Sorry I didn’t know about that second parameter, it’s actually very easy.

This is all we needed for now.

Thank you again.

1 Like