-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Floating points are not honored when evaluating the symbolSortKey #16114
Comments
Whether the sort keys are integers or floats doesn't affect the cause of the behavior you're seeing, which is that symbols are not sorted by their sort keys during placement when overlap is disabled. It should also be fixed by #16023 just like the other ticket you opened and linked, which we're working towards getting into the next release. cc @ansis |
@johnnewman can you reproduce that reliably for sets of points at different locations in tiles? Based on previous testing we've done, I think this is just coincidence. There is some kind of deterministic order for which icons win in collision detection within a tile. |
@chloekraw So far I've only seen the feature with Hopefully this was a valid test: I was updating the |
Okay, thanks! We’ll take a look then @johnnewman. Appreciate the time you took to test. |
Yep, it looks like we should probably switch these from |
This makes sense and we can definitely work around it 👍. For context: we have millions of potential sort values and I was normalizing them to all be between 0 and 1 before passing them into the style layer. Oops! Thank you @ansis. |
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions. |
When
iconAllowsOverlap
isfalse
and the values for thesymbolSortKey
evaluate to doubles, the ordering of those values doesn't change the z-level of where the icons are drawn in a style layer. The same feature will always appear on top of the other whether you reverse the values for the sort (by multiplying by -1) or leave them as-is.Somewhat similar to #15964.
Steps to reproduce
textAllowsOverlap
andiconAllowsOverlap
tofalse
textOptional
totrue
symbolSortKey
0.99999896
and0.99999898
Expected behavior
I'm trying to get the feature with the higher sort of
0.99999898
to appear on top.Actual behavior
With the floating points above, the feature with the sort value of
0.99999896
will always be on top. This is also true if you reverse the order by multiplying the sort values by-1
.If I set
iconAllowsOverlap
totrue
, the sort order appears to be honored and the feature with the larger sort of0.99999898
is drawn on top.This gist replicates the issue: https://gist.github.com/johnnewman/d69b5c28c9f8d0895f9bb5e36eb1baeb.
Here is a working project with the code from the gist. Just supply an API key in AppDelegate.swift.
IconOrderingProject.zip
Configuration
Mapbox SDK versions: 5.6.1
iOS/macOS versions: iOS 13.3
Device/simulator models: iPhone 7
Xcode version: 11.3
The text was updated successfully, but these errors were encountered: