@@ -131,7 +131,7 @@ function isVisible(opts) {
131131
132132 return opts . visible && (
133133 Lib . isPlainObject ( source ) ||
134- ( typeof source === 'string' && source . length > 0 )
134+ ( ( typeof source === 'string' || Array . isArray ( source ) ) && source . length > 0 )
135135 ) ;
136136}
137137
@@ -193,29 +193,42 @@ function convertOpts(opts) {
193193 break ;
194194 }
195195
196- return { layout : layout , paint : paint } ;
196+ return {
197+ layout : layout ,
198+ paint : paint
199+ } ;
197200}
198201
199202function convertSourceOpts ( opts ) {
200203 var sourceType = opts . sourcetype ;
201204 var source = opts . source ;
202- var sourceOpts = { type : sourceType } ;
205+ var sourceOpts = {
206+ type : sourceType
207+ } ;
203208 var field ;
204-
205- if ( sourceType === 'geojson' ) {
209+ if ( sourceType === 'geojson' ) {
206210 field = 'data' ;
207- } else if ( sourceType === 'vector' ) {
211+ } else if ( sourceType === 'vector' ) {
208212 field = typeof source === 'string' ? 'url' : 'tiles' ;
213+ } else if ( sourceType === 'raster' ) {
214+ field = 'tiles' ;
215+ sourceOpts [ 'tileSize' ] = 256 ;
216+ for ( let index = 0 ; index < source . length ; index ++ ) {
217+ const url = source [ index ] ;
218+ source [ index ] = decodeURIComponent ( url ) ;
219+
220+ }
209221 }
210222
211223 sourceOpts [ field ] = source ;
224+
212225 return sourceOpts ;
213226}
214227
215228module . exports = function createMapboxLayer ( mapbox , index , opts ) {
216229 var mapboxLayer = new MapboxLayer ( mapbox , index ) ;
217230
218231 mapboxLayer . update ( opts ) ;
219-
232+
220233 return mapboxLayer ;
221234} ;
0 commit comments