File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ export var GraphicLayer = L.Path.extend({
7979 */
8080 onAdd : function ( map ) {
8181 this . _map = map ;
82+ this . _crs = map . options . crs ;
8283 this . defaultStyle = this . _getDefaultStyle ( this . options ) ;
8384 this . _renderer = this . _createRenderer ( ) ;
8485 this . _container = this . _renderer . _container ;
@@ -274,8 +275,9 @@ export var GraphicLayer = L.Path.extend({
274275 let center = map . getCenter ( ) ;
275276 let longitude = center . lng ;
276277 let latitude = center . lat ;
277- let zoom = map . getZoom ( ) ;
278- let maxZoom = map . getMaxZoom ( ) ;
278+ const zoomOffset = this . _crs . code === "EPSG:4326" ?1 :0 ;
279+ let zoom = map . getZoom ( ) + zoomOffset ;
280+ let maxZoom = map . getMaxZoom ( ) + zoomOffset ;
279281
280282 let mapViewport = {
281283 longitude : longitude ,
Original file line number Diff line number Diff line change @@ -169,6 +169,8 @@ export var GraphicWebGLRenderer = L.Class.extend({
169169 radiusMinPixels : radiusMinPixels ,
170170 radiusMaxPixels : radiusMaxPixels ,
171171 strokeWidth : strokeWidth ,
172+ coordinateSystem :this . _isWGS84 ( ) ?window . DeckGL . COORDINATE_SYSTEM . LNGLAT_OFFSETS :window . DeckGL . COORDINATE_SYSTEM . LNGLAT ,
173+ isGeographicCoordinateSystem : this . _isWGS84 ( ) ,
172174 outline : outline ,
173175 getPosition : function ( point ) {
174176 if ( ! point ) {
@@ -258,6 +260,8 @@ export var GraphicWebGLRenderer = L.Class.extend({
258260 deckOptions . canvas = this . _container ;
259261 deckOptions . onBeforeRender = this . _onBeforeRender . bind ( this ) ;
260262 deckOptions . onAfterRender = this . _onAfterRender . bind ( this ) ;
263+ deckOptions . coordinateSystem = this . _isWGS84 ( ) ? window . DeckGL . COORDINATE_SYSTEM . LNGLAT_OFFSETS :window . DeckGL . COORDINATE_SYSTEM . LNGLAT ;
264+ deckOptions . isGeographicCoordinateSystem = this . _isWGS84 ( ) ;
261265 if ( ! this . deckGL ) {
262266 this . deckGL = new window . DeckGL . experimental . DeckGLJS ( deckOptions ) ;
263267 } else {
@@ -304,6 +308,9 @@ export var GraphicWebGLRenderer = L.Class.extend({
304308 } ,
305309 _initPath : emptyFunc ,
306310 _addPath : emptyFunc ,
307- containsPoint : emptyFunc
311+ containsPoint : emptyFunc ,
312+ _isWGS84 ( ) {
313+ return this . layer . _map . options . crs . code === "EPSG:4326" ;
314+ }
308315
309316} ) ;
Original file line number Diff line number Diff line change @@ -329,5 +329,22 @@ describe('leaflet_GraphicLayer', () => {
329329 map . remove ( ) ;
330330 window . document . body . removeChild ( testDiv ) ;
331331 } ) ;
332+ it ( 'CRS_4326_ICL_1134' , ( done ) => {
333+ let { map, testDiv } = createMap ( ) ;
334+ let layer = graphicLayer ( graphics , { render : 'webgl' } ) . addTo ( map ) ;
335+ setTimeout ( ( ) => {
336+ expect ( layer . _crs ) . toEqual ( map . options . crs ) ;
337+ const state = layer . getState ( ) ;
338+ expect ( state . maxZoom ) . toEqual ( map . getMaxZoom ( ) + 1 ) ;
339+ expect ( state . zoom ) . toEqual ( map . getZoom ( ) + 1 ) ;
340+ const webglRenderLayer = layer . _renderer . _renderLayer ;
341+ expect ( webglRenderLayer ) . not . toBeNull ( ) ;
342+ expect ( webglRenderLayer . props . coordinateSystem ) . toEqual ( window . DeckGL . COORDINATE_SYSTEM . LNGLAT_OFFSETS ) ;
343+ expect ( webglRenderLayer . props . isGeographicCoordinateSystem ) . toBeTrue ( ) ;
344+ map . remove ( ) ;
345+ window . document . body . removeChild ( testDiv ) ;
346+ done ( ) ;
347+ } , 4000 ) ;
348+ } ) ;
332349 } ) ;
333350} ) ;
You can’t perform that action at this time.
0 commit comments