# Pan to selected store with padding

**URL:** <https://forum.woosmap.com/t/pan-to-selected-store-with-padding/113>\
**Category:** Ask the community\
**Tags:** store-locator, map-api\
**Created:** [December 17, 2021, 1:14pm UTC](https://forum.woosmap.com/t/pan-to-selected-store-with-padding/113 "2021-12-17T13:14:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tucsky](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Tucsky](https://forum.woosmap.com/u/Tucsky)\
**Post date:** [December 17, 2021, 1:14pm UTC](https://forum.woosmap.com/t/pan-to-selected-store-with-padding/113/1 "2021-12-17T13:14:06Z")

</div>

Hi,

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 ! 😃

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![gael](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.woosmap.com/gael/32/3_2.png) [@gael](https://forum.woosmap.com/u/gael)\
**Post date:** [December 17, 2021, 3:18pm UTC](https://forum.woosmap.com/t/pan-to-selected-store-with-padding/113/2 "2021-12-17T15:18:44Z")

</div>

> **This topic is archived.** `TiledView`, `gentleCenter` and `paddedStoreCenter` belong to the Store Locator JS API, which has been retired. In the current library, [`woosmap.map.Map.panTo(latLng, padding?)`](https://developers.woosmap.com/products/map-api/reference/1.4/#woosmap.map.Map__panTo) takes the padding directly, and `panToBounds(latLngBounds, padding)` does the same for a bounding box. There is no automatic pan to a selected store in Map JS: you decide when to call it.

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.

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

```

The API Reference ([here](https://developers.woosmap.com/products/js-api/reference/1.4/#woosmap.BaseView)) 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.

---

<div class="post-metadata">

**Author:** ![Tucsky](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Tucsky](https://forum.woosmap.com/u/Tucsky)\
**Post date:** [December 17, 2021, 3:57pm UTC](https://forum.woosmap.com/t/pan-to-selected-store-with-padding/113/3 "2021-12-17T15:57:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![gael](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.woosmap.com/gael/32/3_2.png) [@gael](https://forum.woosmap.com/u/gael)\
**Post date:** [September 18, 2026, 4:02pm UTC](https://forum.woosmap.com/t/pan-to-selected-store-with-padding/113/4 "2026-09-18T16:02:25Z")

</div>


