@@ -244,15 +244,13 @@ export class GraticuleLayer {
244244
245245 _initialize ( map = this . map , options = this . options ) {
246246 options = options || { } ;
247- options . strokeStyle = { ...defaultStrokeStyle , ...( options . strokeStyle || { } ) } ;
248- options . lngLabelStyle = { ...defaultTextStyle , ...( options . lngLabelStyle || { } ) } ;
249- options . latLabelStyle = { ...defaultTextStyle , ...( options . latLabelStyle || { } ) } ;
250- this . options = {
251- ...defaultOptions ,
252- ...options ,
247+ options . strokeStyle = Object . assign ( { } , defaultStrokeStyle , options . strokeStyle || { } ) ;
248+ options . lngLabelStyle = Object . assign ( { } , defaultTextStyle , options . lngLabelStyle || { } ) ;
249+ options . latLabelStyle = Object . assign ( { } , defaultTextStyle , options . latLabelStyle || { } ) ;
250+ this . options = Object . assign ( { } , defaultOptions , options , {
253251 extent : this . _getDefaultExtent ( options . extent , map ) ,
254252 wrapX : typeof options . wrapX === 'boolean' ? options . wrapX : map . getRenderWorldCopies ( )
255- } ;
253+ } ) ;
256254 this . oldExtent = this . options . extent ;
257255 this . _calcInterval ( ) ;
258256 this . isRotate = false ;
@@ -711,12 +709,11 @@ export class GraticuleLayer {
711709 }
712710
713711 if ( ! this . map . getLayer ( this . sourceId ) ) {
714- this . map . addLayer ( {
715- id : this . sourceId ,
716- type : 'line' ,
717- source : this . sourceId ,
718- ...this . _transformStrokeStyle ( )
719- } ) ;
712+ const layer = Object . assign (
713+ { id : this . sourceId , type : 'line' , source : this . sourceId } ,
714+ this . _transformStrokeStyle ( )
715+ ) ;
716+ this . map . addLayer ( layer ) ;
720717 }
721718 }
722719
@@ -793,7 +790,11 @@ export class GraticuleLayer {
793790 const intNumber = Math . floor ( extent [ 2 ] / this . _currLngInterval ) ;
794791 extent [ 2 ] = intNumber * this . _currLngInterval ;
795792 }
796- return { latRange : [ extent [ 1 ] , extent [ 3 ] ] , lngRange : [ extent [ 0 ] , extent [ 2 ] ] , extent, ...realExtent } ;
793+ const result = Object . assign (
794+ { latRange : [ extent [ 1 ] , extent [ 3 ] ] , lngRange : [ extent [ 0 ] , extent [ 2 ] ] , extent } ,
795+ realExtent
796+ ) ;
797+ return result ;
797798 }
798799
799800 _makeLineCoords ( fixedDegree , range = [ - 90 , 90 ] , first , last , type = 'lng' ) {
0 commit comments