@@ -53,7 +53,7 @@ exports.supplyLayoutDefaults = require('./layout_defaults');
5353var firstPlot = true ;
5454
5555exports . plot = function plot ( gd ) {
56- if ( firstPlot ) {
56+ if ( firstPlot ) {
5757 firstPlot = false ;
5858 Lib . warn ( deprecationWarning ) ;
5959 }
@@ -62,25 +62,25 @@ exports.plot = function plot(gd) {
6262 var calcData = gd . calcdata ;
6363 var mapboxIds = fullLayout . _subplots [ MAPBOX ] ;
6464
65- if ( mapboxgl . version !== constants . requiredVersion ) {
65+ if ( mapboxgl . version !== constants . requiredVersion ) {
6666 throw new Error ( constants . wrongVersionErrorMsg ) ;
6767 }
6868
6969 var accessToken = findAccessToken ( gd , mapboxIds ) ;
7070 mapboxgl . accessToken = accessToken ;
7171
72- for ( var i = 0 ; i < mapboxIds . length ; i ++ ) {
72+ for ( var i = 0 ; i < mapboxIds . length ; i ++ ) {
7373 var id = mapboxIds [ i ] ;
7474 var subplotCalcData = getSubplotCalcData ( calcData , MAPBOX , id ) ;
7575 var opts = fullLayout [ id ] ;
7676 var mapbox = opts . _subplot ;
7777
78- if ( ! mapbox ) {
78+ if ( ! mapbox ) {
7979 mapbox = new Mapbox ( gd , id ) ;
8080 fullLayout [ id ] . _subplot = mapbox ;
8181 }
8282
83- if ( ! mapbox . viewInitial ) {
83+ if ( ! mapbox . viewInitial ) {
8484 mapbox . viewInitial = {
8585 center : Lib . extendFlat ( { } , opts . center ) ,
8686 zoom : opts . zoom ,
@@ -93,24 +93,24 @@ exports.plot = function plot(gd) {
9393 }
9494} ;
9595
96- exports . clean = function ( newFullData , newFullLayout , oldFullData , oldFullLayout ) {
96+ exports . clean = function ( newFullData , newFullLayout , oldFullData , oldFullLayout ) {
9797 var oldMapboxKeys = oldFullLayout . _subplots [ MAPBOX ] || [ ] ;
9898
99- for ( var i = 0 ; i < oldMapboxKeys . length ; i ++ ) {
99+ for ( var i = 0 ; i < oldMapboxKeys . length ; i ++ ) {
100100 var oldMapboxKey = oldMapboxKeys [ i ] ;
101101
102- if ( ! newFullLayout [ oldMapboxKey ] && ! ! oldFullLayout [ oldMapboxKey ] . _subplot ) {
102+ if ( ! newFullLayout [ oldMapboxKey ] && ! ! oldFullLayout [ oldMapboxKey ] . _subplot ) {
103103 oldFullLayout [ oldMapboxKey ] . _subplot . destroy ( ) ;
104104 }
105105 }
106106} ;
107107
108- exports . toSVG = function ( gd ) {
108+ exports . toSVG = function ( gd ) {
109109 var fullLayout = gd . _fullLayout ;
110110 var subplotIds = fullLayout . _subplots [ MAPBOX ] ;
111111 var size = fullLayout . _size ;
112112
113- for ( var i = 0 ; i < subplotIds . length ; i ++ ) {
113+ for ( var i = 0 ; i < subplotIds . length ; i ++ ) {
114114 var opts = fullLayout [ subplotIds [ i ] ] ;
115115 var domain = opts . domain ;
116116 var mapbox = opts . _subplot ;
@@ -132,7 +132,7 @@ exports.toSVG = function (gd) {
132132
133133 // Append logo if visible
134134 var hidden = subplotDiv . select ( '.mapboxgl-ctrl-logo' ) . node ( ) . offsetParent === null ;
135- if ( ! hidden ) {
135+ if ( ! hidden ) {
136136 var logo = fullLayout . _glimages . append ( 'g' ) ;
137137 logo . attr ( 'transform' , strTranslate ( size . l + size . w * domain . x [ 0 ] + 10 , size . t + size . h * ( 1 - domain . y [ 0 ] ) - 31 ) ) ;
138138 logo . append ( 'path' )
@@ -185,7 +185,7 @@ exports.toSVG = function (gd) {
185185
186186 // Break into multiple lines twice larger than domain
187187 var maxWidth = size . w * ( domain . x [ 1 ] - domain . x [ 0 ] ) ;
188- if ( ( bBox . width > maxWidth / 2 ) ) {
188+ if ( ( bBox . width > maxWidth / 2 ) ) {
189189 var multilineAttributions = attributions . split ( '|' ) . join ( '<br>' ) ;
190190 attributionText
191191 . text ( multilineAttributions )
@@ -209,7 +209,7 @@ exports.toSVG = function (gd) {
209209
210210 // Scale down if larger than domain
211211 var scaleRatio = 1 ;
212- if ( ( bBox . width + 6 ) > maxWidth ) scaleRatio = maxWidth / ( bBox . width + 6 ) ;
212+ if ( ( bBox . width + 6 ) > maxWidth ) scaleRatio = maxWidth / ( bBox . width + 6 ) ;
213213
214214 var offset = [ ( size . l + size . w * domain . x [ 1 ] ) , ( size . t + size . h * ( 1 - domain . y [ 0 ] ) ) ] ;
215215 attributionGroup . attr ( 'transform' , strTranslate ( offset [ 0 ] , offset [ 1 ] ) + strScale ( scaleRatio ) ) ;
@@ -223,7 +223,7 @@ function findAccessToken(gd, mapboxIds) {
223223 var context = gd . _context ;
224224
225225 // special case for Mapbox Atlas users
226- if ( context . mapboxAccessToken === '' ) return '' ;
226+ if ( context . mapboxAccessToken === '' ) return '' ;
227227
228228 var tokensUseful = [ ] ;
229229 var tokensListed = [ ] ;
@@ -232,42 +232,42 @@ function findAccessToken(gd, mapboxIds) {
232232
233233 // Take the first token we find in a mapbox subplot.
234234 // These default to the context value but may be overridden.
235- for ( var i = 0 ; i < mapboxIds . length ; i ++ ) {
235+ for ( var i = 0 ; i < mapboxIds . length ; i ++ ) {
236236 var opts = fullLayout [ mapboxIds [ i ] ] ;
237237 var token = opts . accesstoken ;
238238
239- if ( isStyleRequireAccessToken ( opts . style ) ) {
240- if ( token ) {
239+ if ( isStyleRequireAccessToken ( opts . style ) ) {
240+ if ( token ) {
241241 Lib . pushUnique ( tokensUseful , token ) ;
242242 } else {
243- if ( isStyleRequireAccessToken ( opts . _input . style ) ) {
243+ if ( isStyleRequireAccessToken ( opts . _input . style ) ) {
244244 Lib . error ( 'Uses Mapbox map style, but did not set an access token.' ) ;
245245 hasOneSetMapboxStyle = true ;
246246 }
247247 wontWork = true ;
248248 }
249249 }
250250
251- if ( token ) {
251+ if ( token ) {
252252 Lib . pushUnique ( tokensListed , token ) ;
253253 }
254254 }
255255
256- if ( wontWork ) {
256+ if ( wontWork ) {
257257 var msg = hasOneSetMapboxStyle ?
258258 constants . noAccessTokenErrorMsg :
259259 constants . missingStyleErrorMsg ;
260260 Lib . error ( msg ) ;
261261 throw new Error ( msg ) ;
262262 }
263263
264- if ( tokensUseful . length ) {
265- if ( tokensUseful . length > 1 ) {
264+ if ( tokensUseful . length ) {
265+ if ( tokensUseful . length > 1 ) {
266266 Lib . warn ( constants . multipleTokensErrorMsg ) ;
267267 }
268268 return tokensUseful [ 0 ] ;
269269 } else {
270- if ( tokensListed . length ) {
270+ if ( tokensListed . length ) {
271271 Lib . log ( [
272272 'Listed mapbox access token(s)' , tokensListed . join ( ',' ) ,
273273 'but did not use a Mapbox map style, ignoring token(s).'
@@ -285,11 +285,11 @@ function isStyleRequireAccessToken(s) {
285285 ) ;
286286}
287287
288- exports . updateFx = function ( gd ) {
288+ exports . updateFx = function ( gd ) {
289289 var fullLayout = gd . _fullLayout ;
290290 var subplotIds = fullLayout . _subplots [ MAPBOX ] ;
291291
292- for ( var i = 0 ; i < subplotIds . length ; i ++ ) {
292+ for ( var i = 0 ; i < subplotIds . length ; i ++ ) {
293293 var subplotObj = fullLayout [ subplotIds [ i ] ] . _subplot ;
294294 subplotObj . updateFx ( fullLayout ) ;
295295 }
0 commit comments