File tree Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Expand file tree Collapse file tree 3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ module.exports = {
4242 // a subset of node_modules/mapbox-gl/dist/mapbox-gl.css
4343 styleRules : {
4444 map : 'overflow:hidden;position:relative;' ,
45- 'missing-css' : 'display:none' ,
45+ 'missing-css' : 'display:none;' ,
46+ 'canary' : 'background-color:salmon;'
4647 }
4748} ;
Original file line number Diff line number Diff line change @@ -15,13 +15,10 @@ var getSubplotCalcData = require('../../plots/get_data').getSubplotCalcData;
1515var xmlnsNamespaces = require ( '../../constants/xmlns_namespaces' ) ;
1616
1717var createMapbox = require ( './mapbox' ) ;
18- var constants = require ( './constants' ) ;
1918
2019var MAPBOX = 'mapbox' ;
2120
22- for ( var k in constants . styleRules ) {
23- Lib . addStyleRule ( '.mapboxgl-' + k , constants . styleRules [ k ] ) ;
24- }
21+ var constants = exports . constants = require ( './constants' ) ;
2522
2623exports . name = MAPBOX ;
2724
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ var Loggers = require('./lib/loggers');
1212var noop = require ( './lib/noop' ) ;
1313var pushUnique = require ( './lib/push_unique' ) ;
1414var isPlainObject = require ( './lib/is_plain_object' ) ;
15+ var addStyleRule = require ( './lib/dom' ) . addStyleRule ;
1516var ExtendModule = require ( './lib/extend' ) ;
1617
1718var basePlotAttributes = require ( './plots/attributes' ) ;
@@ -267,6 +268,15 @@ function registerTraceModule(_module) {
267268 if ( _module . layoutAttributes ) {
268269 extendFlat ( exports . traceLayoutAttributes , _module . layoutAttributes ) ;
269270 }
271+
272+ // add mapbox-gl CSS here to avoid console warning on instantiation
273+ var basePlotModule = _module . basePlotModule ;
274+ if ( basePlotModule . name === 'mapbox' ) {
275+ var styleRules = basePlotModule . constants . styleRules ;
276+ for ( var k in styleRules ) {
277+ addStyleRule ( '.mapboxgl-' + k , styleRules [ k ] ) ;
278+ }
279+ }
270280}
271281
272282function registerSubplot ( _module ) {
You can’t perform that action at this time.
0 commit comments