Skip to content

Commit a807435

Browse files
committed
Raster: Fix issue where rasters appear behind tiles by default
The default zIndex for TileLayer and GridLayer is now 1. In Leaflet 0.7 it was null. In our R code, the default was NULL, which we pass to the Leaflet code. Therefore, in Leaflet 1.x we actually override the default zIndex of 1 and change it to "auto". However, for addRaster, we've never allowed the zIndex to be set, so we don't override the new default zIndex of 1. So we end up with a tile layer with zIndex "auto" and a grid layer with a zIndex of 1. For "stacking context" reasons that I do not understand, auto always renders in front of non-auto. Setting the default for tiles to 1 fixes the problem.
1 parent 83bee11 commit a807435

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/layers.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ tileOptions <- function(
306306
zoomOffset = 0,
307307
zoomReverse = FALSE,
308308
opacity = 1.0,
309-
zIndex = NULL,
309+
zIndex = 1,
310310
unloadInvisibleTiles = NULL,
311311
updateWhenIdle = NULL,
312312
detectRetina = FALSE,

0 commit comments

Comments
 (0)