Map selection callout: preset on line 1, name on line 2#10
Draft
tordans wants to merge 1 commit into
Draft
Conversation
Add pushpinCalloutLines() on OsmBaseObject so the selection balloon always shows the matched preset type first and the display name second when present. Update PushPinView for two-line layout with a smaller subheadline for the name. Add unit tests for callout line selection and redundancy handling. Co-authored-by: Tobias <t@tobiasjordans.de>
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.
Problem
As a mapper selecting a feature on the map, I want the pushpin callout to always show the feature type (preset) on the first line and the object's display name on a second line when it exists, so that I can scan the map quickly and consistently understand what it is before what it's called.
Today the callout sometimes shows
name=*and sometimes the preset label on line one, depending on context, which makes quick scanning inconsistent.Implementation notes (by Cursor)
OsmBaseObject.pushpinCalloutLines()returning(primary, secondary?). Primary uses preset matching (friendlyName()when non-generic), then the same fallbacks asfriendlyDescription()without preferringgivenName()first. Secondary isgivenName()when non-empty and not redundant with primary (case/whitespace-normalized compare).friendlyDescription(withDetails:)to call sharedpushpinCalloutPrimary(withDetails:)after the existing name-first branch — other call sites unchanged.MapView.refreshPushpinText()now callsPushPinView.setCallout(primary:secondary:); new objects still get a single “(new object)” line.PushPinViewuses twoCATextLayers (headline + subheadline), shared max width (300pt), wrapping/truncation, and balloon height includes both lines when secondary is set.OsmBaseObject_PushpinCalloutTestCase.swiftcover preset+name, preset-only, name-only, redundant secondary, and thatfriendlyDescription()still prefers name elsewhere.Testing notes (by @tordans)
Manual
name→ line 1 should still be useful (preset match or fallback); line 2 shows the name when distinct from line 1.shop=convenience+name=Foo) → line 1 preset label, line 2 name; secondary typography visibly smaller.PushPinViewstill sane.refreshPushpinText().Automated
OsmBaseObject_PushpinCalloutTestCase— redundancy helper,shop=conveniencescenarios, name-only fallback, redundant name omitted.