-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix visible grid around tiles #10594
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm… Nice idea, but there are still corner cases where it does not work: To reproduce on Chrome 129 on Ubuntu, set browser zoom to 110%:
And, more importantly, now even non-transparent tile layers show the seam under the above mentioned conditions (this works fine on the development branch):
I think the +epsilon workaround is still needed to account for rounding errors associated with fractional browser zoom settings.
To improve the rendering of the small overlap for tile layers with transparency, I tried to play around with a few other combinations of CSS blend modes, background values, etc. but could unfortunately not find a solution that preserves the rendering of the non transparent tiles. 😒
As transparent imagery layers are a rather rare occurence1, I'm leaning towards closing this as an unfortunate wontfix / known bug. Except if you or someone is able to find a better solution?!
Footnotes
-
some overlays use an alpha channel, but as long as it is only used as a mask ("1 bit transparency"), these also work fine with the current solution. ↩
It is unfortunate that it doesn't work for 110% zoom in Chrome but it's fine with 125%, 150%, 175%, 200%. The current solution with +epsilon to scale up by 1px and create an overlap is fundamentally flawed because it messes with tiles sharpness and will never work for transparent layers. Value 90% and 80% are also problematic with both epsilon or plus-lighter, but 75% is fine.
The solution I found that not applying plus-lighter at 110% improves the situation, as well as 80% and 67%. |
I tried to compile in a comprehensive way everything I've tested to remove the grid: Firefox
Chrome
TLDR: This PR with 3 CSS exceptions is a clear improvement over the current solution, the only annoying regression is 110% in Chrome but it's minor. We could go further with more logic in JS to keep epsilon in some cases but I don't like it. |
addressed in follow-up comments (see above)
Thanks for the in-depth analysis and detailed tests!
Good point about the loss in sharpness with the existing workaround. I'm tending towards accepting the |
I did my initial test with all the logic in the This is a better implementation, but maybe you have an even better idea. |
This comment was marked as resolved.
This comment was marked as resolved.
While testing for Leaflet here, I found that plus-lighter can introduce some blur on Chrome, but it's nothing to worry about because iD is already blurry all the time due to sub-pixel translations. Again, this is only an issue on Chrome, Firefox handles both sub-pixel translations and plus-lighter just fine. |
After further testing with non-standard pixel ratios, I found that the plus-lighter trick only works with zoom levels that are multiples of 25 (75%, 100%, 125%...). So instead of a few exceptions, I changed it to be applied only at those specific pixel ratios where it’s been confirmed to work well. |
Just to put this out there: We could also decide to not support zoomed in UIs and leave it at that. |
I originally made this PR to support transparent tiles and improve zoom transitions (which are currently awful for everyone), and fix the thin black lines visible with light backgrounds on Chrome. The situation seems complex due to all the incremental improvements, but I think the final solution isn't that hard to understand. If you ignore all other pixel ratios, simply remove epsilon and apply plus-lighter with no condition. That would improve things for the majority, but it would certainly be a regression for some. There are many valid reasons to not have your zoom set to 100%, especially with high DPI screens, which are much more common now. This mess is entirely caused by poor rendering in Chrome, and the only maintenance I foresee is removing all this when the bug is fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again! This seems to be the best we can do for now.
Below, I've added a few inline links to this PR for future reference.
This properly fixes #10589 by removing the tile overlap that was causing white borders with transparent tiles.
The tile overlap was added as a dirty fix to #3053, it doesn't even fully resolved the issue anyway.
This fix uses the CSS rule
mix-blend-mode: plus-lighter
, applied only to the background layer and is only needed to fix this bug in Chrome.A future version of Chrome might make this CSS rule unnecessary (but leaving it shouldn't cause the borders to reappear).
Tested on Chrome and Firefox with normal and fractional zoom levels, with regular and transparent layers.
Not tested on macOS Safari or mobile.