Skip to content

Release 1.4.0 - #49

Merged
wf9a5m75 merged 137 commits into
mainfrom
develop
Nov 13, 2026
Merged

wf9a5m75 merged 137 commits into
mainfrom
develop

Conversation

@wf9a5m75

Copy link
Copy Markdown
Contributor

Merges develop into main for the 1.4.0 release.

masashi and others added 30 commits September 1, 2026 11:39
bearing を「値を増やすと地図が時計回りに回る」向きに統一し、ネイティブ SDK との変換をコアの CameraBearing に集約する。
The destination rectangle came straight out of the projection, so it landed on
a fraction of a pixel almost every time, and a filtered blit to a non-integer
rectangle costs about twenty times an aligned one. Rounding it moves a pin by at
most half a pixel — invisible at icon scale — and when the icon is drawn at its
natural size it also turns the blit into a straight copy. Measured in isolation
on a Pixel 5a, 20k markers: 4270 ms unaligned, 203 ms aligned. Turning the
filter off instead only reaches 2172 ms, so alignment is what matters, not the
filtering.

Also stop the second query+prepare pass from firing on every single tile. The
32dp assumption it started from was smaller than the real icons on every tile
measured, so the "conservative first pass" never paid off and simply doubled
the work. Starting from the largest extent a tile has actually needed costs one
extra pass in total rather than one per tile.

Per tile on a Pixel 5a, before -> after:

  z12   2000 markers   226 ms ->  177 ms
  z6    2000 markers  1152 ms ->  269 ms
  z12  20000 markers   696 ms ->  257 ms
  z6   20000 markers  9745 ms ->  944 ms

The tiles also compress better now that the pixels are not resampled: the dense
z12 tile drops from 965 KB to 377 KB.
Bitmap.compress is what a marker tile spends its time on once the drawing is
aligned: 133-165 ms against 7-14 ms for the same tile in Rust. Per tile on a
Pixel 5a, this and the whole-pixel draw together:

  z12   2000 markers   226 ms ->   50 ms
  z6    2000 markers  1152 ms ->  156 ms
  z12  20000 markers   696 ms ->  112 ms
  z6   20000 markers  9745 ms ->  833 ms

Every failure returns null and lets Bitmap.compress take over: an ABI the
library was not built for, a bitmap in an unexpected config, a panic in Rust.
A failed optimisation should cost a slow tile, never a crash.

The scratch buffer is per-thread because renderTile runs concurrently and a
tile at these densities is about 7 MB of RGBA — allocating that per call would
cost more than the encoding it exists to speed up.

The files come out 2.3-3.3x larger. That is not free: the tile cache is
budgeted in bytes, so it will hold proportionally fewer of them.
Renamed from NativePngEncoder and moved next to the tile server, which is what
consumes what it produces. "Native" described how it works rather than what it
is for, and the modules that draw tiles need to reach it: keeping a second copy
of the same encoder in each of them was the alternative.

The buffer overload exists for the GPU paths, which have raw RGBA from a
glReadPixels or Metal readback and no Bitmap to wrap it in.
Zoom out far enough and a whole city collapses onto a few hundred pixels: at z6
a dataset of 20k markers resolves to a couple of thousand distinct positions,
and the rest are drawn underneath copies of themselves. Keeping the last of
each group is what would have been visible anyway, since drawing is in
painters order.

Only exact agreement counts — same rounded rectangle, same icon — so nothing
that could peek out from behind another is dropped. Where markers share a
rectangle but not an icon, none are dropped: a different icon may be
transparent where the one above it is not, and then the one underneath does
show through.

This is deliberately not the decluttering the docs describe. That thins markers
that are merely close, which changes what the map shows and is a product
decision; this only removes drawing that has no effect. A test renders fifty
stacked copies and one marker and asserts the two tiles are identical.

Per tile at z6 with 20k markers: 414 ms -> 261 ms on an iPad Pro, 852 ms ->
617 ms on a Pixel 5a. The Android gain is smaller because its tile is 1344px
against 512px, so fewer markers land on the same pixel.

The placement is packed into a Long rather than an object, to avoid 20k
short-lived allocations per tile. Its origin is sign-extended on the way out:
a marker overhanging the tile top or left edge has a negative origin, and
masking it back to 16 bits unsigned would move it to the far side of the tile.
The conservative first pass assumed 32dp and every tile then discovered the
real icons were larger, so query and prepare both ran twice — every time, on
every tile. The field that remembers the observed extent did not help: a
renderer is rebuilt on every marker sync, so the assumption reset to 32dp along
with it.

The renderer already knows its default icon, so it can start from that icon's
own extent instead. Markers with larger custom icons still widen it on their
first tile, which is what the field was for; it just no longer fires for the
common case where nobody has one.

Per tile on a Pixel 5a, before -> after:

  z12   2000 markers   50.1 ms ->  48.1 ms
  z6    2000 markers  153.2 ms -> 127.9 ms
  z12  20000 markers  129.4 ms -> 102.7 ms
  z6   20000 markers  617.2 ms -> 506.4 ms
findMarkersInBounds asks the cell registry for everything within a radius and
then uses only the cells, but the search sorted its results by distance first.
A cell carries a String, so sorting 20k of them moves 20k refcounted values
through some 286k comparisons. Measured on an iPad Pro at 20k markers:

  sorted search    41.7 ms
  unsorted search   1.8 ms
  whole query      64.5 ms -> 12.4 ms

The sorted variant stays for callers that do want the nearest first. Flattening
also happens in one pass now, instead of building an array of id sets, then a
flat array of ids, then an array of entities.

KDTreeRadiusTest pins the two traversals against each other over a spread of
radii, including ones that select nothing and everything. The unordered
traversal was written out separately rather than derived, and a pruning bug
that only shows at the boundary would survive a single radius.

Per tile on a Pixel 5a at z6 with 20k markers: 506.4 ms -> 477.4 ms.
The renderer already dropped markers hidden exactly behind another — same
rectangle, same icon, invisible either way. This is the other kind: markers a
few pixels apart overlap almost completely but are not invisible, so thinning
them changes what the map shows and is a judgement about the map rather than a
free optimisation. Hence opt-in, through MarkerTilingOptions.declutterPx.

It shares the pass the exact-overlap check already makes rather than adding
one. The first attempt did add a pass, and on 144k markers that cost more than
the drawing it saved: z12 went from 325 ms to 361 ms with decluttering on.

What it buys, measured on Tokyo's 144,183 street trees at 14 px:

  z9    536 KB -> 321 KB
  z11  1070 KB -> 626 KB
  z12   829 KB -> 506 KB

Render time is unchanged, which is worth knowing before reaching for this to go
faster: after the earlier fixes the drawing is no longer the cost, and the
query and prepare passes run over every marker whatever this is set to. The
tiles being half the size is the real gain, since the caches holding them are
budgeted in bytes.
The hex registry was built at a fixed zoom of 20. With a base side of 100 km
that puts a cell at about 12 cm, and street trees are metres apart — so every
marker landed in its own cell and the index grouped nothing. It cost a HexCell
object and a String id per marker, two concurrent maps and a kd-tree node each,
and on 144,183 markers building it aborted the process.

MarkerGridIndex holds one Long per marker: its cell key above its position in a
snapshot. Building it is an arithmetic pass and a primitive sort — 41 ms and
1.15 MB for those same 144,183 on a Pixel 5a, against not fitting at all.

Numbers rather than round figures decided the two constants. A tile-sized query
on 144k markers costs 0.06 ms at 0.005 degrees, 0.03 ms at 0.001 and 2.31 ms at
0.02 — the last no better than scanning, because a cell that size returns five
times what a tile needs. And a query wide enough to touch thousands of cells is
slower through the index than scanning (2.27 ms against 1.98 ms over all of
Tokyo), so past MAX_CELLS_PER_QUERY it scans.

The index owns no markers: it is handed the manager's collection and snapshots
it on rebuild. An earlier draft kept its own id-to-slot map, which duplicated
the map the manager already has and cost several megabytes at this size.

findByIdPrefix still uses the hex registry, which is now built the first time
that is called. Nothing inside the SDK calls it, so nothing pays for it.

The web SDK has indexed this way all along — GeoGridIndex, uniform cells — so
this brings the platforms back together rather than inventing something.
MarkerGridIndex.swift is the Kotlin index line for line: one Int64 a marker,
its cell key above its position in a snapshot, sorted once and binary-searched
per cell. Same 0.005 degree cells, same scan-instead threshold, same reasons —
the hex registry it replaces was built at zoom 20, about 12 cm a cell, so it
grouped nothing while charging a HexCell and a String id per marker.

Writing the tests it deserved turned up two defects, both of which were in the
Android version as shipped an hour ago:

A box crossing the antimeridian has its east corner west of its west one. The
cell walk ran lonFrom..lonTo straight, which is an empty range in Kotlin — no
markers, silently — and a trap in Swift. It now walks to the unwrapped end and
folds each column back onto the globe, which also covers the ring search near
180 degrees.

findNearest stopped one ring after its first hit. A ring is a square, so a hit
in a corner sits about 1.4 cells further out than a hit on an edge, and the
marker it returned was simply not the nearest one — on 5,000 markers it was
wrong for two of three probe points. The rule is now a distance: having
finished ring r, everything unsearched is at least r cells away, so stop once
that exceeds the best found.

Neither would have thrown. Both would have quietly returned the wrong markers,
which is why the tests compare against a brute-force scan on every query rather
than checking that a query returns something.

Also fills the gaps left when the index changed hands. findByIdPrefix builds
the hex registry itself now — nothing else builds it any more, so it had been
returning nothing at all — and getMemoryStats counts the grid instead of
reporting no spatial index at all.
At zoom 9 every one of Tokyo's 144,183 street trees lands on one tile, and the
renderer read all 141,221 of them to keep 9,216 — what a 1344 px tile holds at a
14 px declutter. Reading a position off an entity costs 0.72 microseconds on a
Pixel 5a, so merely looking at that set was 101 ms before anything was done
with it, and the tile took 1,180 ms.

A caller that is about to keep one marker per cell has already said the markers
inside a cell are interchangeable. MarkerTileRenderer now says so, passing the
declutter distance in degrees, and MarkerGridIndex answers from its cells: a
binary search each, and where a cell lies wholly inside the box, one entry
taken off the end of its run without scanning it. The walk visits the roughly
5,000 cells that hold trees rather than the trees.

Per tile on a Pixel 5a, warmed, 14 px declutter:

  z9   1180ms -> 105ms     141,221 candidates
  z11   460ms -> 465ms      59,476   declined: cells too coarse to honour 14px
  z12   200ms -> 191ms      23,597   likewise

The index declines whenever its 0.005 degree cells are coarser than the
separation asked for, which is every zoom above 9 or so — and those are the
zooms that do not have this many candidates. Nothing changes there, and the
tiles come out byte-identical. At zoom 9 the PNG is 5.8% smaller because the
survivor of a cell is now chosen by the index rather than by the pass that
follows; the density is the same and the pass still applies the real rule.

Two things measured along the way did not survive:

Thinning before `prepareMarkers` rather than inside the index. It cut zoom 9 by
40% but cost 12% at zoom 11, where the projection pass runs over all 59,476 and
saves less prepare than it spends. The index does the same job by not reading
the markers at all, so the pre-pass was deleted rather than kept behind a
threshold.

Grouping on the marker's centre instead of its drawn rectangle. Two cell passes
against grids offset by the icon's anchor thin twice, and a street tree tile
came back 15% lighter than the caller had asked for.

The declutter key also gets its bits back. It was `(cx shl 32) xor cy` shifted
left by the index width, which kept the low 8 bits of `cx`: at the default 14 px
cell a tile spans about 100 columns and nothing showed, but at a 1 px cell on a
1344 px tile, columns 0 and 256 shared a key and markers 256 px apart
decluttered into one another.
Dragging the street tree map was heavy on a Pixel 5a long after the tile
rendering stopped being the reason. Frame stats put 270 to 380 ms of every
janky frame between AnimationStart and PerformTraversalsStart, with the GPU
at a 16 ms 90th percentile; simpleperf put three quarters of the main thread
in androidx.collection.ScatterSet.contains, under advanceGlobalSnapshot, under
a snapshotFlow's apply observer.

That observer belonged to the collector. To find in-place changes it read every
state's fingerprint inside one snapshotFlow, and Compose asks such an observer,
on every snapshot commit anywhere in the app, whether any object it read is
among the changed ones — one contains per object read. 144,183 markers of a
dozen fields each is about 1.7 million probes, and a drag commits a snapshot
every frame.

The loop ran the wrong way round. Asking "of everything I read, did any of it
change?" costs the size of the collection whether or not anything changed;
being told "this one changed" costs one call per actual change, and during a
drag markers do not change at all. So the states push: every mutable field
goes through StateMutationSignal.notifying, which writes through to the same
mutableStateOf — the field stays readable from a composition exactly as before
— and reports the write.

On a Pixel 5a, same 144k markers, same drag:

  janky frames   17.7%  ->  1.4%
  90th            350ms ->   21ms
  99th            700ms ->   24ms
  slow UI thread     19 ->      2

which is where an empty map already was (0.2%, 16ms, 19ms). Quartering the
markers had quartered the cost, so this was never about what was drawn.

The collector keeps its own id-to-state map of who is reporting. Membership
reaches `flow` through a debounce, so a state added and removed inside one
window is not in that map when the removal arrives; clearing by id there found
nothing and left the state reporting for the rest of the collector's life,
which the removal test caught.

Two things go with it. The FingerPrint type parameter, which existed only for
the diff — fingerPrint() stays, several providers do their own diffing with it.
And asFlow() on all six state types plus CollectAndUpdateEach, the per-state
watcher this replaced twice over: nothing called either, and they are the shape
that must not come back.

The failure mode of the swap is silent — a setter that forgets to report leaves
the renderer drawing the old value, with nothing logged and nothing thrown — so
OverlayCollectorMutationTest states the contract: a write arrives, an equal
write does not, repeats inside a window collapse to the latest, a removed state
goes quiet, and two states changing together both arrive.
There was no cancellation at all: a request was rendered to completion and
the client's absence was discovered at the write, which is what the
"Write failed (client canceled?)" lines were. In one 41-second session,
337 of the 370 responses the map had abandoned had been rendered from
scratch first -- and because the render slots and the GL thread are shared,
each of those was drawn *instead of* a tile still on screen.

TileProviderInterface gains a renderTile that takes an isCancelled probe,
defaulting to the old one so existing providers need no changes. The
server checks before it starts and hands the probe down, so a provider can
bail at its own checkpoints.

Detecting the peer needs a trick: there is no portable "is it still there",
but a byte of urgent data fails on a dead connection and is discarded by
any client that never asks for it.
A request the map abandoned mid-render came back as 404, because "we gave
up" and "there is no such tile" were the same return value. The difference
matters: 404 is a permanent answer, and a map that believes it leaves that
square showing whatever other zoom level it still has -- which is what a
screen carrying two zoom levels at once looks like, and it appeared after
a few zooms in and out, which is exactly when requests get abandoned.
Nothing is answered now; the connection simply ends, which a map reads as
a failure it may retry.

The liveness check no longer sends urgent data either. That works -- it
fails on a dead connection and every HTTP client discards it -- but it is
still a byte pushed into a live connection whose stream we also have to
parse, and this session's evidence for what went wrong was circumstantial
enough not to want the exotic mechanism in the middle of it. It now reads
instead: a closed connection reads end-of-stream at once, a live idle one
times out, and anything read is pushed back for the parser.

Two tests. One holds a render open, drops the connection, and checks the
provider is told to stop and the next request still gets its tile; it
fails if the check is disabled. The other runs two requests down one
connection, because a liveness check that reads from the stream the parser
reads is exactly the kind of thing that breaks keep-alive.

The androidTest manifest is new: the tile server binds a loopback socket
and the test process could not, so these tests could not have run before.
The template's `useAppContext` had never passed either -- a library
module's instrumentation runs in a `.test` package.
One line per connection with the worker pool's state, behind the debug
flag. Diagnosing the serialisation questions kept needing it.
bearing を「値を増やすと地図が時計回りに回る」向きに統一し、ネイティブ SDK との変換をコアの CameraBearing に集約する。
A tiled marker whose look has not changed skipped the manager — correct, since
re-registering would bust the tile cache and redraw every visible tile for a
no-op — but it also left the entity pointing at the *previous* MarkerState.
Taps are dispatched from the entity's state, so the handler that runs is the
one from the composition before last.

It matters because the generated id is a hash of the look — position, extra,
icon, clickable, draggable, animation — and does not include the handlers. A
MarkerState rebuilt on recomposition with new callbacks therefore arrives with
the same id and an equal fingerprint, and its onClick never reaches the map.

The non-tiled path was never affected: it always goes through `updated` and
re-registers. This brings the tiled path in line with it, and with
js-sdk-core, which had the same hole in both paths (MapConductor/js-sdk-core#3).
ios-sdk-core re-registers unconditionally and never had it.

Nothing is redrawn: the renderer is not called and the tile cache is not
busted. Only the state reference the entity holds changes.
The branch carried the Rust PNG encoder, the marker grid index, the
decluttering option, tile cancellation, and the collector redesign that
has states report their own writes instead of being read for them.
android-sdk's other modules were already written against it — the parent
repo pinned this submodule at 39bace9 — so develop was the odd one out,
and android-sdk-compose did not compile against it.

Conflict: CameraBearing.kt, a single blank line. Took the branch's.

develop's own #11, adopting the newest marker state when nothing is
redrawn, survives the merge; MarkerIngestionEngine still carries it.
OverlayCollectorMutationTest arrived with the collector redesign but its
dependency never did, so the whole test source set failed to compile on
the branch too — not something the merge introduced. The version catalog
already had the alias; only the wiring was missing.
Kotlin's `internal` is public on the JVM, so OverlayCollector,
StateMutationSignal, NotifyingState and MarkerGridIndex were all sitting
in the frozen surface despite being wiring nobody outside the SDK calls.
The collector redesign then changed OverlayCollector's type parameters
and apiCheck reported a breaking change to an API that was never meant
to be one — exactly what @InternalMapConductorApi exists to prevent.

The gate matches per class file, so MarkerGridIndex's companion needs the
annotation of its own: without it an empty entry for the companion stays
behind. For the same reason the annotation stays off ComponentState and
off every state class — one on MarkerState.mutations would drop the whole
of MarkerState out of the freeze, which is the opposite of the intent.

Opting in per module, as android-for-* already does: core because its own
states each hold a StateMutationSignal, compose because it is the overlay
collection wiring.

Also records this dump's other changes. asFlow() and CollectAndUpdateEach
are gone with the redesign and are not coming back; nothing called them.
Instrumented rather than local, because the thing most likely to be wrong
is not the Kotlin: it is whether libtile_png_jni.so is packaged for the
device's ABI at all. Every failure path in TilePngEncoder returns null on
purpose, so a JVM test would pass with no native library present and the
platform fallback would quietly cover for it.

Opaque pixels have to round trip exactly, which is what catches a swapped
R and B — the way a fast encoder produces a plausible wrong image.
Translucent pixels are compared against Bitmap.compress, the encoder this
one replaces: alpha exactly, colour within one step of integer
un-premultiplication. On a Pixel 5a the worst step measured was 0.

The cost report runs on noise and says why in a comment. A flat colour
under an alpha ramp compresses to a couple of kilobytes, which flatters
compress on size and starves it of the work this encoder saves; the
honest comparison, on tiles the marker renderer actually produced, is
MarkerTileCostTest in android-vectortile.
`ProjectionInterface` returned Compose's `Offset`, which packs two
Floats. That is right for screen coordinates and wrong for Web Mercator
metres, which reach 2e7 -- past seven significant digits the fraction is
simply gone:

  Tokyo        15558805.184640 -> 15558805.000000   0.18 m
  longitude 180 20037508.342789 -> 20037508.000000   0.34 m

ios-sdk uses CGPoint and js-sdk-core uses number; android was the only
one dropping the digits. `ProjectedPoint` carries doubles and is a
separate type from `Offset` on purpose, so the two coordinate spaces
stop sharing a name.

Two more places were doing the same thing: WebMercatorScreenProjection
packed metres into an `Offset` before unprojecting, and KDTree's
distances returned `Float` -- squared metres reach 1.6e15, which Float32
cannot hold either. `toScreenOffset`/`fromScreenOffset` keep `Offset`,
because those really are screen pixels.

Also clamps latitude to ±85.05112878 and wraps, matching ios-sdk. Before
this, `lat=90` returned 238107693 and `lat=-90` returned `-Infinity`:
the same expression breaking differently depending on sign, with the
infinity reaching callers.

ProjectionConformanceTest runs vectors shared byte-for-byte with ios-sdk
and react-sdk and requires an exact match against the same expected
file. Three of thirty-four rows agreed before this; all thirty-four do
now.

The API baseline changes because `Offset` is a value class -- the old
surface carried mangled names and `long` parameters
(`getCenterXY-F1C5BW0`). Breaking, and accepted deliberately.
…hole

Same change as ios-sdk-core: the key is a Morton hierarchy over two
square root cells, queries walk the level their box calls for, thinned
queries pick winners without looking at the box, and the renderer's
declutter grid anchors to the world with a canonical winner so
neighbouring tiles agree about shared cells. The geocell conformance
fixtures are byte-identical across the three SDKs; iOS generated the
canonical file and this side matches it independently.

MarkerTileSeamTest mirrors the iOS/react test: what tile A draws in
the overlap, tile B must draw too.
…ames

A provider returning null used to come back as 404, and map SDKs take
404 as permanent: a tile that was empty for a moment -- data still
loading, a layer mid-switch -- became a hole that was never requested
again, with the neighbouring tiles' overhang cut off at its edge. The
iOS LocalTileServer already answers by meaning; this brings the Android
server to the same semantics, in one place rather than per renderer,
since every provider here (markers, heatmap, geojson, kml, ground
image) uses null to mean an empty spot:

- null from a provider: 200 with a transparent PNG at the density the
  path asked for. An empty spot is a real answer, cacheable, replaced
  when a data change moves the tile URL's version.
- a provider that throws: 503 with Retry-After, no-store. Previously
  the exception silently killed the connection.
- 404 only for requests that name nothing: a bad path, an unregistered
  route.
- abandoned mid-render stays unanswered, as before.

The transparent tile is hand-encoded (a deflate of zero rows) rather
than drawn through Bitmap, so it costs no bitmap and plain JVM tests
can decode it. On-device tests pin all four answers; the transparent
body is decoded with BitmapFactory to prove a map SDK would accept it.
Logged ms/tile for a 144k-marker viewport, decluttered and not. Not a
gate: the point is a number instead of a guess when a device feels
slow. On an SO-02L it put the missing-declutter regression at 538ms vs
79ms per z10 tile.
… seam

The JVM seam test checks that the index hands both tiles the same
candidates; this one renders the actual pixels on device, declutter on,
across z12-17 -- z15+ exercises the fallback path where the declutter
separation drops below the grid's bottom level and the index declines
the thinned query. A broken seam leaves one side of the boundary opaque
and the other transparent for about an icon's height; a merely tangent
icon differs for a short run, so only long runs count. 360 seams, all
clean -- which is how the OpenMobileMaps 'cut icons' report was traced
to the provider's layer rather than to this renderer.
Tile size is the app's choice and 512 is the cheaper default -- the
per-tile costs (an HTTP round trip through the local server, a render,
a PNG encode, a decode) scale with the count, so fewer, bigger tiles
win for the same screen. But some SDKs have an opinion the layer
supplying the tiles cannot see.

ArcGIS's 3D SceneView is one: it picks the level as though every tile
were 256 pixels, so 512-pixel tiles make it fetch one level deeper and
cover the screen four times over. The picture is right, which is what
makes it easy to miss, and the cost lands on the slowest devices.

A provider can now register RasterTilePreference and be answered;
saying nothing means it has no opinion and the supplier's default
stands. An explicit tile size from the app always wins over both.
A provider that cannot answer a projection yet returns NaN, and
BigDecimal throws on it: formatting a visible region on ArcGIS took the
app down in toFixed. A number formatter is the wrong place to end a
process -- NaN and the infinities now come through as words, which
shows which value is wrong instead of hiding it behind a crash.
…lation

Fix polygon tile ordering and cancelled transitions
coordinateSystem / toProjectedPoint / fromProjectedPoint convert between
latitude/longitude and the coordinate system the map engine lays the map
out in (not screen coordinates). The default is EPSG:3857 meters, which
fits Mercator-only engines and globe display; engines with their own
coordinate systems override it.

Also records CircleTiler's tap constants in the API baseline, which the
circle tap fix left out.
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.
Add projected-coordinate conversion to the map view holder
Unify marker draw order (zIndex, then screen position)
fov is the vertical field of view, in degrees, of the camera the
provider actually renders with, for the current map size. 0 means the
tilt is drawn without perspective; null means unknown or the map cannot
tilt. Like visibleRegion it is filled when the camera is read and
ignored on moves; copy keeps it and equals ignores it. Core holds no
fov value: each provider reports its own.

CameraPaddingEmulation (driver API) lets a provider without a usable
padding API honour MapCameraPosition.paddings by moving the camera
center instead: the screen offset of the padded-area center, (L-R)/2
and (T-B)/2 dp, is solved on the ground with a pinhole camera for the
provider's fov (orthographic for fov 0, flat for null), and inverted
when the camera is read back. Unit tests check the result against an
independent pinhole projection at tilt 0-60, three headings and three
fovs.
Add MapCameraPosition.fov and padding emulation
MapPaddings(top = 300.0) now sets only the top. A side left out reads 0 but is remembered as unset, and MapCameraPosition.resolvedOnto (so moveCameraTo) fills it from the same side of the current camera's paddings. An explicit 0 is kept, and leaving paddings out altogether still means Zeros. The four-Double constructor keeps its old JVM signature.
Let each side of camera paddings be left out
WebMercatorScreenProjection gains toScreenOffset/fromScreenOffset overloads taking the camera's vertical fov. With a fov and a tilt they use the MapLibre GL JS pinhole model (camera (H/2)/tan(fov/2) from the centre, pitched by the tilt) instead of the flat similarity, which drifted further the deeper a point was: 34 px at tilt 30 and 114 px at tilt 60 near the centre, 247 px at a padded centre. A ray above the horizon gives null. The existing overloads are unchanged. Tests check the projection against an independent 3D camera at tilt 0/30/60 and several bearings, round trips, and the horizon.
Project tilted cameras with the engine's field of view
On a Pixel 5a and a Lenovo TB520FU, Skia drew polygon and polyline tiles as fast or faster than the GPU path, while circle tiles were twice as fast on the GPU. ShapeTileRenderer.gpuPolygonsAndLines turns their GPU path on; the comparison tests do.
OverlayAddedListeners passes each batch OverlayAddedTracker finds on the map to a
listener before the onAdded calls, so that the Compose collections can count how
many of their states are on the map.
Brings in GlShapeRasterizer and CircleTileFileStorage.RecordAction from the GPU
tiles change, which reached develop without a dump.
Let the framework layer hear when overlays reach the map
…blocks round it

The circle file kept its records in list order, 512 to a block with 48 blocks
cached, so a tile's circles lay in most of the file: on the national antenna set a
z12 tile over New York needed 436 of 1,414 blocks.

CircleTileSet now writes the file in Z-order of each circle's z12 cell (a stable
radix sort of 24-bit keys, the same key as js-sdk-core). Indices stay the list's:
the storage translates them, and the grid index, its box checks and forEachRecord
walk the storage order. The GPU recording keeps the drawn-last circle per dot
pixel and adds the circles in list order.
Store large circle sets by place, so a zoomed-in tile reads only the blocks round it
The marker hit test measures the screen scale round the tap from points 1e-4°
north and east of it. ArcGIS's 3D SceneView returns whole-pixel screen points, and
zoomed out 1e-4° is under a pixel: both points landed on the tap, the scale came out
0, no search area was made, and a tap on a marker did nothing (the marker-animation
sample on ArcGIS: tapping Bounce did not bounce it). The step now widens tenfold
until both points are at least 4 px away, up to 1°.
…tion

Find tapped markers when the projection rounds to whole pixels
@wf9a5m75
wf9a5m75 merged commit f59e1ca into main Nov 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant