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

Make collision detection take into account "text-offset" and size changes #1196

Closed
peterqliu opened this issue May 1, 2015 · 4 comments
Closed

Comments

@peterqliu
Copy link
Contributor

In the Y direction, the symbol simply outruns its bounding box. Looking at France, going from [0,-10] to [0,0] to [0,10]:

offsety

In the X direction... it's bizarre. Looks like the box both scales and shifts. Going from [-10,0] to [0,0] to [10,0]:

offsetx

cc/ @ansis

@peterqliu
Copy link
Contributor Author

this case was found in https://www.mapbox.com/bites/00108, but reproducible anywhere.

@ansis ansis self-assigned this Feb 2, 2016
ansis added a commit that referenced this issue Feb 5, 2016
fix #1196

Symbols can size change within a single zoom level. When size changes
all the units that are relative to size, like text-offset, change.

Collision detection can't handle boxes that scale at different rates so
we try to create a collision box that will cover the symbol at all sizes
within that zoom level.

It used to just use the size at z+1 with the assumption that text always
increases and that the anchor is always within the collision box.

This commit makes it use both the size at z and z+1 so that symbol is
always within the collision box.
ansis added a commit that referenced this issue Feb 5, 2016
fix #1196

Symbols can size change within a single zoom level. When size changes
all the units that are relative to size, like text-offset, change.

Collision detection can't handle boxes that scale at different rates so
we try to create a collision box that will cover the symbol at all sizes
within that zoom level.

It used to just use the size at z+1 with the assumption that text always
increases and that the anchor is always within the collision box.

This commit makes it use both the size at z and z+1 so that symbol is
always within the collision box.
@lucaswoj lucaswoj added this to the Denver milestone Jul 28, 2016
@lucaswoj lucaswoj changed the title Bounding boxes don't track to symbols with text-offset Make collision detection take into account "text-offset" and size changes Jul 28, 2016
@lucaswoj lucaswoj modified the milestone: Denver Jul 29, 2016
@jfirebaugh
Copy link
Contributor

@ChrisLoer @ansis Is this fixed with recent text rendering changes?

@ChrisLoer
Copy link
Contributor

Plain offsets are handled correctly now (watch Washington DC offset in both X and Y directions):

offset dc 2

But for zoom-interpolated values the collision box can still end up looking different than the label:

zoom interpolation still off

@jfirebaugh
Copy link
Contributor

#4798

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

Successfully merging a pull request may close this issue.

5 participants