Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ui/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,8 @@ class Camera extends Evented {
if (!calculatedOptions) return this;

options = extend(calculatedOptions, options);
// Explictly remove the padding field because, calculatedOptions already accounts for padding by setting zoom and center accordingly.
delete options.padding;

return options.linear ?
this.easeTo(options, eventData) :
Expand Down
15 changes: 15 additions & 0 deletions test/unit/ui/camera.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1889,6 +1889,21 @@ test('camera', (t) => {
t.end();
});

t.test('padding does not get propagated to transform.padding', (t) => {
const camera = createCamera();
const bb = [[-133, 16], [-68, 50]];

camera.fitBounds(bb, {padding: {top: 10, right: 75, bottom: 50, left: 25}, duration:0});
const padding = camera.transform.padding;
t.deepEqual(padding, {
left: 0,
right: 0,
top: 0,
bottom: 0
});
t.end();
});

t.end();
});

Expand Down