carbonplan / minimaps

small maps for figures
MIT License
4 stars 0 forks source link

thin lines #7

Open freeman-lab opened 2 years ago

freeman-lab commented 2 years ago

A minor rendering issue seems to appear on mobile and, occasionally, on desktop while resizing. Here's an example of how it looks.

IMG_1687

I believe what's happening is that the SVG layer (containing the spherical global mask) rendered on top of the WebGL layer (containing the raster) is one (or less than one) pixel off on the left and right edges, so the mask fails to completely cover the raster layer, and as a result, the edges peek out.

One strategy to fix would be to prevent the raster layer from rendering anything in those locations in the first place, i.e. build into the inverse projection shader code to not render anything outside the globe, but I'm not 100% how easy that is to do in general. The other option is to futz with the sizing to somehow expand or pad the SVG layer so as to "cover up" the edges. But that feels hacky, and might risk creating an issue with the spatial alignment of the two layers (which is otherwise perfect).

katamartin commented 2 years ago

This was fixed in a quick, one-off way for naturalEarth1 in the seaweed farming explainer (https://github.com/carbonplan/research/commit/317cf35ec2f1dace0458cc86c585826e81da3b49). The right fix here may involve doing something similar but with a better-defined "out of range" return value. We should also consistently handle "out of range" lat and lon values.