-
Notifications
You must be signed in to change notification settings - Fork 2.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
line labels with 0 "collision circles" still get placed #6919
Comments
Err... it's not the tile boundary itself that's the problem, it's just that the label in the test case ends up close enough to the end of the line that There is a separate but closely related problem with mapbox-gl-js/src/symbol/collision_feature.js Line 112 in 01f0857
There I think the right behavior is to always have at least one collision circle as long as the label length is non-zero. |
symbol-placement: line-center
doesn't generate collision circles outside tile boundary
@ansis we actually introduced this relatively recently with #6164 -- we were aiming to make it so that 0-length text wouldn't prevent an associated icon from being placed... but ended up treating "no collision boxes because they don't fit on the line" the same as "no collision boxes because the string is empty". We could keep the fix for issue #6160 by following gl-native's approach. Instead of doing it based on whether the bucket has text/icon data: mapbox-gl-js/src/symbol/placement.js Lines 189 to 190 in 01f0857
We could do it based on whether the symbolInstance has glyphs/quads: |
- Don't place features that _have_ text but don't have collision boxes - Create a single collision box even when the length of a label is less than half the box size Test updates: - Add debug collision circles to line-center and line-center-buffer to verify collision behavior - Add regression test that exercises case where a line label is almost exactly the same length as its line
- Don't place features that _have_ text but don't have collision boxes - Create a single collision box even when the length of a label is less than half the box size Test updates: - Add debug collision circles to line-center to verify collision behavior - Add regression test that exercises case where a line label is almost exactly the same length as its line
- Don't place features that _have_ text but don't have collision boxes - Create a single collision box even when the length of a label is less than half the box size Test updates: - Add debug collision circles to line-center to verify collision behavior - Add regression test that exercises case where a line label is almost exactly the same length as its line
…tive - Don't place features that _have_ text but don't have collision boxes - Create a single collision box even when the length of a label is less than half the box size Test updates: - Add debug collision circles to line-center to verify collision behavior - Add regression test that exercises case where a line label is almost exactly the same length as its line
Discovered in the native port: the
symbol-placement/line-center-buffer
test case actually doesn't generate any collision circles because the logic inCollisionFeature
aborts for line features that cross tile boundaries. The test case didn't notice on gl-js because there's nothing to collide against and gl-js treats "no collision circles" as "ok to place", while gl-native treats that as "not placeable"./cc @nickidlugash
The text was updated successfully, but these errors were encountered: