Repository navigation
Draw marker labels into tiles as text, and add vertical labels - #23
Merged
Merged
Conversation
Tiles drew a labelled marker as one baked bitmap per text and position, so relabelling many markers (street trees named by species and side) built a bitmap per combination on the main thread and the map stalled. - Tiles now put only the body (dot, pin) in the atlas and draw the text after all bodies, on both the GPU and CPU paths. Bodies are shared between icons that differ only in their label. A labelled marker wins its declutter cell. - ImageIcon gains the label options ColorDefaultIcon has. Both compute their layout up front and bake the bitmap only when used as a native marker. - labelWritingMode (CSS writing-mode: horizontal-tb, vertical-rl) sets text vertically with CoreText's vertical glyph forms, so labels on markers packed along a horizontal street fit one character wide. - A tile used to search its surroundings by the largest overhang it had seen; right after relabelling, a tile with no markers of its own returned empty and the label reaching in from the next tile was cut at the seam. Labelled icons now record their overhang when created, and tiles search by that.
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.
Why
Tiles drew a labelled marker as one baked bitmap per text and position. The street-tree sample labels trees by species and side, so every relabel built a bitmap per combination on the main thread, and the map stalled while panning.
What
Labels are drawn into tiles as text
ColorDefaultIconandImageIconcompute their layout up front. The full bitmap is baked only when the icon is used as a native marker.DefaultIconLayouthas a general form that takes the body's rectangle. The pin andImageIconboth use it. develop's "center a side label on the pin" fix is preserved as the pin's side centre.ImageIconlabelsImageIconnow has the same label options asColorDefaultIcon:label,labelTextColor,labelTextSize,labelTypeFace,labelStrokeColor,labelPosition. They are appended with defaults, so existing calls are unchanged.Vertical labels:
labelWritingModewriting-mode:horizontal-tb(default) andvertical-rl/vertical-lr.LabelTypesetter).Labels no longer cut at a tile seam right after relabelling
@Publishedstate for 144k markers cost 0.7–1.4 s per pass, even in a Release build.API
Additions only, all with defaults (see
api/MapConductorCore.api.swift):ColorDefaultIcon.labelWritingMode,defaultLabelWritingMode, and the matchinginit/copyparameters.ImageIcon's label properties andlabelWritingMode, plus the matchinginit/copyparameters.Checked
On an iPad, with the street-tree sample (144k markers):
Not yet:
minMarkerCount) with horizontal and vertical labels has not been checked on a device.ImageDefaultIcon: it still bakes as before.The same design is to follow on Android and JS.