Repository navigation
Unify marker draw order (zIndex, then screen position) - #39
Merged
Merged
Conversation
Within the marker band, zIndex (null = 0) is the primary key and a south-then-west tiebreak in [0, 0.5) breaks ties, so the key never crosses an explicit zIndex. It replaces calculateZIndex for markers, whose -latitude * 10^6 value made Google Maps draw an explicit zIndex 1 behind an unspecified marker (north) and let unspecified markers beat explicit ones in the southern hemisphere. Marker tiles now draw in the same order instead of the spatial index enumeration order.
Measured on device: the tip-to-anchor gap is the same proportion of the bitmap with scale 0.6, scale 2, iconSize 28dp and the default, so scale does not shift the anchor.
MarkerDrawOrder now takes the camera heading (and the center longitude for the antimeridian). With equal zIndex the marker lower on screen is in front and, on the same row, the one further left, matching Google Maps JS. At heading 0 the order is unchanged (south, then west). BaseMapViewController tracks the heading and, once rotation settles, asks every marker controller to reorder through MarkerOverlayRendererInterface.onDrawOrderFrameChanged. Compose-drawn markers use rememberMarkerDrawOrderFrame. Markers drawn into tiles stay north-up.
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