File tree 3 files changed +13
-5
lines changed
3 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ module.exports = {
42
42
// a subset of node_modules/mapbox-gl/dist/mapbox-gl.css
43
43
styleRules : {
44
44
map : 'overflow:hidden;position:relative;' ,
45
- 'missing-css' : 'display:none' ,
45
+ 'missing-css' : 'display:none;' ,
46
+ 'canary' : 'background-color:salmon;'
46
47
}
47
48
} ;
Original file line number Diff line number Diff line change @@ -15,13 +15,10 @@ var getSubplotCalcData = require('../../plots/get_data').getSubplotCalcData;
15
15
var xmlnsNamespaces = require ( '../../constants/xmlns_namespaces' ) ;
16
16
17
17
var createMapbox = require ( './mapbox' ) ;
18
- var constants = require ( './constants' ) ;
19
18
20
19
var MAPBOX = 'mapbox' ;
21
20
22
- for ( var k in constants . styleRules ) {
23
- Lib . addStyleRule ( '.mapboxgl-' + k , constants . styleRules [ k ] ) ;
24
- }
21
+ var constants = exports . constants = require ( './constants' ) ;
25
22
26
23
exports . name = MAPBOX ;
27
24
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ var Loggers = require('./lib/loggers');
12
12
var noop = require ( './lib/noop' ) ;
13
13
var pushUnique = require ( './lib/push_unique' ) ;
14
14
var isPlainObject = require ( './lib/is_plain_object' ) ;
15
+ var addStyleRule = require ( './lib/dom' ) . addStyleRule ;
15
16
var ExtendModule = require ( './lib/extend' ) ;
16
17
17
18
var basePlotAttributes = require ( './plots/attributes' ) ;
@@ -267,6 +268,15 @@ function registerTraceModule(_module) {
267
268
if ( _module . layoutAttributes ) {
268
269
extendFlat ( exports . traceLayoutAttributes , _module . layoutAttributes ) ;
269
270
}
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
+ }
270
280
}
271
281
272
282
function registerSubplot ( _module ) {
You can’t perform that action at this time.
0 commit comments