Skip to content

Commit fd7650b

Browse files
committed
Handle view reset with 'Reset view' button
1 parent a888c2f commit fd7650b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/plots/map/map.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,18 @@ proto.createMap = function (calcData, fullLayout, resolve, reject) {
170170

171171
Promise.all(promises)
172172
.then(function () {
173-
// Capture the auto-framed view onto `_input` so
174-
// subsequent updateLayout calls don't reset to the schema defaults
173+
// Capture the auto-framed view so subsequent updateLayout/resetView
174+
// calls don't reset to the schema defaults
175175
if (fitBounds) {
176176
const { center, zoom } = self.getView();
177177
opts._input.center = opts.center = center;
178178
opts._input.zoom = opts.zoom = zoom;
179+
self.viewInitial = {
180+
center: Lib.extendFlat({}, center),
181+
bearing: opts.bearing,
182+
pitch: opts.pitch,
183+
zoom
184+
};
179185
}
180186
self.fillBelowLookup(calcData, fullLayout);
181187
self.updateData(calcData);

0 commit comments

Comments
 (0)