Skip to content
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

When ignoring collision boxes outside of visible screen map panning can get ugly #6489

Closed
watbywbarif opened this issue Apr 10, 2018 · 2 comments

Comments

@watbywbarif
Copy link

0.44.2 but then reproduced this with official streets-v9 and older 0.43.0:

Steps to Trigger Behavior

  1. Use https://api.mapbox.com/styles/v1/mapbox/streets-v9.html?title=true&access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4M29iazA2Z2gycXA4N2pmbDZmangifQ.-g_vE53SD2WrJ6tFX7QHmA#12.1/37.85635/-122.31402
  2. Pan map up and down between Oakland and Albany.
  3. You can get too many labels drawn that quickly disappear in fraction of second, but it looks ugly

Expected Behavior

I will not post images, as number of labels thins out obviously when tried.

Actual Behavior

image
image

I have achieved even worse results with my own data and style:
image

I guess this is example is overblown because data in .mvt contains too much data for that zoom level, but as this can be reproduced in streets-v9 i am posting it.

When used map.showCollisionBoxes = true it seams to me that collisions are ignored while labels are outside of visible rectangle, but then when panning occurs labels are drawn before collisions are reevaluated.

@anandthakker
Copy link
Contributor

This is due to an intentional tradeoff we made as part of this major overhaul of symbol placement:

// skipFade = outside viewport, but within CollisionIndex::viewportPadding px of the edge
// Because these symbols aren't onscreen yet, we can skip the "fade in" animation,
// and if a subsequent viewport change brings them into view, they'll be fully
// visible right away.

this.placements[symbolInstance.crossTileID] = new JointPlacement(placeText, placeIcon, offscreen || bucket.justReloaded);

@nickidlugash @ChrisLoer @ansis am I right in understanding that this behavior is essentially "works as intended"?

@ChrisLoer
Copy link
Contributor

@nickidlugash @ChrisLoer @ansis am I right in understanding that this behavior is essentially "works as intended"?

The "skip fade" logic is actually for items that have been placed/collided, just while they were offscreen. It looks like what @watbywbarif is seeing is features entirely outside the collision index range getting placed, and then sticking around until the next placement happens (it'll happen as they get pulled on screen, but it takes time for them to fade out so you can still see all the overlap for a bit). That's actually a known issue (#5654) that we hadn't gotten around to fixing yet just because it didn't seem like it was too big a problem. Getting this report is a good incentive to re-evaluate that. 😅

Closing as duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants