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({
79
79
*/
80
80
onAdd : function ( map ) {
81
81
this . _map = map ;
82
+ this . _crs = map . options . crs ;
82
83
this . defaultStyle = this . _getDefaultStyle ( this . options ) ;
83
84
this . _renderer = this . _createRenderer ( ) ;
84
85
this . _container = this . _renderer . _container ;
@@ -274,8 +275,9 @@ export var GraphicLayer = L.Path.extend({
274
275
let center = map . getCenter ( ) ;
275
276
let longitude = center . lng ;
276
277
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 ;
279
281
280
282
let mapViewport = {
281
283
longitude : longitude ,
Original file line number Diff line number Diff line change @@ -169,6 +169,8 @@ export var GraphicWebGLRenderer = L.Class.extend({
169
169
radiusMinPixels : radiusMinPixels ,
170
170
radiusMaxPixels : radiusMaxPixels ,
171
171
strokeWidth : strokeWidth ,
172
+ coordinateSystem :this . _isWGS84 ( ) ?window . DeckGL . COORDINATE_SYSTEM . LNGLAT_OFFSETS :window . DeckGL . COORDINATE_SYSTEM . LNGLAT ,
173
+ isGeographicCoordinateSystem : this . _isWGS84 ( ) ,
172
174
outline : outline ,
173
175
getPosition : function ( point ) {
174
176
if ( ! point ) {
@@ -258,6 +260,8 @@ export var GraphicWebGLRenderer = L.Class.extend({
258
260
deckOptions . canvas = this . _container ;
259
261
deckOptions . onBeforeRender = this . _onBeforeRender . bind ( this ) ;
260
262
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 ( ) ;
261
265
if ( ! this . deckGL ) {
262
266
this . deckGL = new window . DeckGL . experimental . DeckGLJS ( deckOptions ) ;
263
267
} else {
@@ -304,6 +308,9 @@ export var GraphicWebGLRenderer = L.Class.extend({
304
308
} ,
305
309
_initPath : emptyFunc ,
306
310
_addPath : emptyFunc ,
307
- containsPoint : emptyFunc
311
+ containsPoint : emptyFunc ,
312
+ _isWGS84 ( ) {
313
+ return this . layer . _map . options . crs . code === "EPSG:4326" ;
314
+ }
308
315
309
316
} ) ;
Original file line number Diff line number Diff line change @@ -329,5 +329,22 @@ describe('leaflet_GraphicLayer', () => {
329
329
map . remove ( ) ;
330
330
window . document . body . removeChild ( testDiv ) ;
331
331
} ) ;
332
+ it ( 'CRS_4326_ICL_1042' , ( 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
+ } ) ;
332
349
} ) ;
333
350
} ) ;
You can’t perform that action at this time.
0 commit comments