@@ -244,15 +244,13 @@ export class GraticuleLayer {
244
244
245
245
_initialize ( map = this . map , options = this . options ) {
246
246
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 , {
253
251
extent : this . _getDefaultExtent ( options . extent , map ) ,
254
252
wrapX : typeof options . wrapX === 'boolean' ? options . wrapX : map . getRenderWorldCopies ( )
255
- } ;
253
+ } ) ;
256
254
this . oldExtent = this . options . extent ;
257
255
this . _calcInterval ( ) ;
258
256
this . isRotate = false ;
@@ -711,12 +709,11 @@ export class GraticuleLayer {
711
709
}
712
710
713
711
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 ) ;
720
717
}
721
718
}
722
719
@@ -793,7 +790,11 @@ export class GraticuleLayer {
793
790
const intNumber = Math . floor ( extent [ 2 ] / this . _currLngInterval ) ;
794
791
extent [ 2 ] = intNumber * this . _currLngInterval ;
795
792
}
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 ;
797
798
}
798
799
799
800
_makeLineCoords ( fixedDegree , range = [ - 90 , 90 ] , first , last , type = 'lng' ) {
0 commit comments