Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#6744·maplibre-gl-js

Map.flyTo padding not being cleared -> fitBounds is summing it up with it's own padding argument.

Author: kamil-sienkiewicz-asiCreated Nov 20, 2025Updated Sep 28, 2026
LabelsbugenhancementPR is more than welcomed

maplibre-gl-js version: 5.13.0

browser: chrome 141.0.7390.77

I think there were few issues about this already, but I don't see any open one, yet still this bug exists so creating new one.

Related issues: https://github.com/mapbox/mapbox-gl-js/issues/11831 https://github.com/maplibre/maplibre-gl-js/issues/4095 - this was closed, but not resolved https://github.com/maplibre/maplibre-gl-js/discussions/2984 -> there is no solution to my knowledge, mapbox says that they fixed it somehow

Steps to Trigger Behavior

Steps to Trigger Behavior

  1. Call function map.FlyTo with padding ->
 map.flyTo({
   center: coordinates[0],
   padding: {
      top: 50,
      bottom: 0,
      left: 100,
      right: 0
   }
})
  1. Call function map.fitBounds ->
map.fitBounds(bounds, {
 padding: 200
});
  1. Call to fitBounds uses sum of padding from fitBounds and previous flyTo ->
padding = {
   top: 50 + 200,
   bottom: 200,
   left: 100 + 200,
   right 0 + 200,
}

Link to Demonstration

https://jsbin.com/xeseliyufe/edit?html,output

https://github.com/user-attachments/assets/5c240d19-9205-4c16-822c-e9f3c400eb92

Expected Behavior

Padding is not summed up

Actual Behavior

Padding is summed up which breaks UI of the app

Source: maplibre/maplibre-gl-js

View original on GitHubView discussion on GitHub