tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.21k stars 290 forks source link

lines re-render on zooming in #738

Closed AnandSrini closed 4 years ago

AnandSrini commented 4 years ago

TANGRAM VERSION: 0.19.1

ENVIRONMENT:

Windows 10, Chrome (79.0.3945.79 (Official Build) (64-bit))

TO REPRODUCE THE ISSUE, FOLLOW THESE STEPS:

yaml configuration for line width:

                width: |
                    function() { 
                        return $zoom / 12 * $meters_per_pixel; 
                    }

RESULT:

EXPECTED RESULT: It would be really nice if the the lines were re-rendered to a smaller size based on the zoom level (while the tiles are being loaded). Like how it happens for circle/polygons.

bcamper commented 4 years ago

Thanks - this is overall intentional behavior, but your example shows the worst-case scenario. Tangram's lines are meant to smoothly interpolate width from one zoom level to the next. When you go +/-1 zoom levels out from the current tiles, it has to "guess" how big they will be at the new zoom (since that data is not loaded yet, as you mentioned), and it caps how much the lines are scaled relative to the current zoom. In the past, we had the opposite problem and the lines were sometimes very thin when scaled up several zooms like this. In any case, I do agree that we could revisit these parameters to see if a better balance is possible.

AnandSrini commented 4 years ago

But, shapes drawn on points seem to re-draw smoothly even before the data is being loaded.

They are small, but you can notice small squares at the end of the lines. They are re-sized before the tiles are loaded, but lines are not.

Is there something that I am missing?

image

image

image

bcamper commented 4 years ago

Sorry, can you explain more what you mean about the shapes drawn on the points? Are those other geometries you are generating in your scene file? Or are you only drawing lines, and observing those "extra" lines when changing zooms? If the latter, it's possible you are seeing the old and new tiles rendering simultaneously for some time, as the old tiles will continue to draw to cover the space until all necessary new tiles have loaded (and one old tile from a lower zoom could cover many tiles from a new higher zoom). Does that make sense?

bcamper commented 4 years ago

Working as expected.