Repository navigation
Unify marker draw order (zIndex, then screen position) - #37
Merged
Merged
Conversation
Within the marker band a larger zIndex (nil = 0) is in front; at the same zIndex the more southerly marker is in front, then the more westerly. key() gives a small Double for engines that sort by floating point (symbol-sort-key, MKAnnotationView.zPriority); integerKey() packs the same order into an integer for engines that only take integers (GMSMarker.zIndex). Driver SPI, so the public API is unchanged.
Google Maps JS puts the marker lower on screen in front and re-sorts when the map rotates. MarkerDrawOrder now does the same: the tiebreak is the marker's position in the rotated screen frame (lower first, then left), from a Frame carrying the camera heading and the longitude used for antimeridian wrapping. North-up gives the same order as before. Exact screen-row ties stay left-first instead of Google's add order, so the order still never depends on add order. AbstractMarkerController and StrategyMarkerController hand a new Frame to renderers adopting MarkerDrawOrderFrameReceiver when the heading moves by 0.5 degrees or more. Tile-rasterised markers keep north-up. All new API is driver SPI.
Same name as js-sdk-core / android-sdk-core. It is the camera heading (clockwise, as Google reports), converted from MapConductor's bearing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Markers stacked differently on every provider: some used raw zIndex, some add order, some
-latitude * 1e6(which put a null-zIndex marker in the southern hemisphere above an explicit zIndex 1). This adds one shared draw-order helper,MarkerDrawOrder, that every provider's marker renderer feeds its native sort key from.Rule (matches Google Maps JS, measured):
zIndex ?? 0decides first; larger is in front.The heading parameter is the native camera heading (clockwise), not MapConductor's
bearing, which has the opposite sign. Markers rasterized into tiles stay north-up.Tests
Unit tests cover heading 0 keeping the previous order, lower-on-screen at 0/90/180/270, zIndex dominating at every heading, and an antimeridian pair.
Provider PRs that use this helper depend on this one.
Commits