File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -37,14 +37,6 @@ function plotGeo(gd) {
37
37
var calcData = gd . calcdata ;
38
38
var geoIds = fullLayout . _subplots [ GEO ] ;
39
39
40
- /**
41
- * If 'plotly-geo-assets.js' is not included,
42
- * initialize object to keep reference to every loaded topojson
43
- */
44
- if ( window . PlotlyGeoAssets === undefined ) {
45
- window . PlotlyGeoAssets = { topojson : { } } ;
46
- }
47
-
48
40
for ( var i = 0 ; i < geoIds . length ; i ++ ) {
49
41
var geoId = geoIds [ i ] ;
50
42
var geoCalcData = getSubplotCalcData ( calcData , GEO , geoId ) ;
Original file line number Diff line number Diff line change @@ -269,14 +269,25 @@ function registerTraceModule(_module) {
269
269
extendFlat ( exports . traceLayoutAttributes , _module . layoutAttributes ) ;
270
270
}
271
271
272
- // add mapbox-gl CSS here to avoid console warning on instantiation
273
272
var basePlotModule = _module . basePlotModule ;
274
- if ( basePlotModule . name === 'mapbox' ) {
273
+ var bpmName = basePlotModule . name ;
274
+
275
+ // add mapbox-gl CSS here to avoid console warning on instantiation
276
+ if ( bpmName === 'mapbox' ) {
275
277
var styleRules = basePlotModule . constants . styleRules ;
276
278
for ( var k in styleRules ) {
277
279
addStyleRule ( '.mapboxgl-' + k , styleRules [ k ] ) ;
278
280
}
279
281
}
282
+
283
+ // if `plotly-geo-assets.js` is not included,
284
+ // add `PlotlyGeoAssets` global to stash references to all fetched
285
+ // topojson / geojson data
286
+ if ( ( bpmName === 'geo' || bpmName === 'mapbox' ) &&
287
+ ( typeof window !== undefined && window . PlotlyGeoAssets === undefined )
288
+ ) {
289
+ window . PlotlyGeoAssets = { topojson : { } } ;
290
+ }
280
291
}
281
292
282
293
function registerSubplot ( _module ) {
You can’t perform that action at this time.
0 commit comments