Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c9de98d

Browse files
committed
handle add/remove mapbox layers
1 parent 0eb0459 commit c9de98d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/plot_api/plot_api.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,19 @@ Plotly.relayout = function relayout(gd, astr, val) {
22982298
Images.supplyLayoutDefaults(gd.layout, gd._fullLayout);
22992299
Images.draw(gd);
23002300
}
2301+
else if(p.parts[0] === 'mapbox' && p.parts[1] === 'layers') {
2302+
Lib.extendDeepAll(gd.layout, Lib.objectFromPath(ai, vi));
2303+
2304+
// append empty container to mapbox.layers
2305+
// so that relinkPrivateKeys does not complain
2306+
2307+
var fullLayers = (gd._fullLayout.mapbox || {}).layers || [];
2308+
var diff = (p.parts[2] + 1) - fullLayers.length;
2309+
2310+
for(i = 0; i < diff; i++) fullLayers.push({});
2311+
2312+
doplot = true;
2313+
}
23012314
// alter gd.layout
23022315
else {
23032316
// check whether we can short-circuit a full redraw

0 commit comments

Comments
 (0)