@@ -104,6 +104,7 @@ export class GraticuleLayer {
104104 this . renderer = new GraticuleLayerRenderer ( this . map , this . options , {
105105 getMapStateByKey : this . getMapStateByKey ,
106106 getDefaultExtent : this . getDefaultExtent ,
107+ _updateGraticuleLayer : this . _updateGraticuleLayer . bind ( this ) ,
107108 setVisibility : this . setVisibility . bind ( this )
108109 } , {
109110 mapCanvas : this . map . getCanvas ( ) ,
@@ -132,7 +133,7 @@ export class GraticuleLayer {
132133 }
133134
134135 onRemove ( ) {
135- this . mapContainer . removeChild ( this . canvas ) ;
136+ this . renderer . onRemove ( ) ;
136137 this . _unbindEvent ( ) ;
137138 }
138139
@@ -152,7 +153,7 @@ export class GraticuleLayer {
152153 this . renderer . visible = this . visible ;
153154 }
154155 if ( this . map . getLayer ( this . sourceId ) ) {
155- this . map . setLayoutProperty ( this . sourceId , 'visibility' , this . renderer . visible ? 'visible' : 'none' ) ;
156+ this . map . setLayoutProperty ( this . sourceId , 'visibility' , this . visible ? 'visible' : 'none' ) ;
156157 }
157158 this . renderer && this . renderer . _drawLabel ( ) ;
158159 }
@@ -193,7 +194,7 @@ export class GraticuleLayer {
193194 * @param {maplibregl.LngLatBounds } extent - 经纬网渲染的边界范围。
194195 */
195196 setExtent ( extent ) {
196- this . options . extent = this . _getDefaultExtent ( extent , this . map ) ;
197+ this . options . extent = this . getDefaultExtent ( extent , this . map ) ;
197198 // this.features = this._getGraticuleFeatures();
198199 this . _updateGraticuleLayer ( ) ;
199200 this . renderer . _drawLabel ( ) ;
@@ -279,6 +280,10 @@ export class GraticuleLayer {
279280 }
280281 }
281282
283+ _getLatPoints ( lngRange , firstLng , lastLng , features ) {
284+ return this . renderer . _getLatPoints ( lngRange , firstLng , lastLng , features ) ;
285+ }
286+
282287 getDefaultExtent ( extent , map = this . map ) {
283288 const crs = ( map . getCRS && map . getCRS ( ) ) || { } ;
284289 let { extent : crsExtent } = crs ;
0 commit comments