Skip to content

Map selection callout: preset on line 1, name on line 2#10

Draft
tordans wants to merge 1 commit into
masterfrom
cursor/pushpin-preset-name-callout-b8c2
Draft

Map selection callout: preset on line 1, name on line 2#10
tordans wants to merge 1 commit into
masterfrom
cursor/pushpin-preset-name-callout-b8c2

Conversation

@tordans
Copy link
Copy Markdown
Owner

@tordans tordans commented May 31, 2026

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)

  • Added OsmBaseObject.pushpinCalloutLines() returning (primary, secondary?). Primary uses preset matching (friendlyName() when non-generic), then the same fallbacks as friendlyDescription() without preferring givenName() first. Secondary is givenName() when non-empty and not redundant with primary (case/whitespace-normalized compare).
  • Refactored friendlyDescription(withDetails:) to call shared pushpinCalloutPrimary(withDetails:) after the existing name-first branch — other call sites unchanged.
  • MapView.refreshPushpinText() now calls PushPinView.setCallout(primary:secondary:); new objects still get a single “(new object)” line.
  • PushPinView uses two CATextLayers (headline + subheadline), shared max width (300pt), wrapping/truncation, and balloon height includes both lines when secondary is set.
  • Unit tests in OsmBaseObject_PushpinCalloutTestCase.swift cover preset+name, preset-only, name-only, redundant secondary, and that friendlyDescription() still prefers name elsewhere.

Testing notes (by @tordans)

Manual

  1. Objects with only name → line 1 should still be useful (preset match or fallback); line 2 shows the name when distinct from line 1.
  2. Objects with preset + name (e.g. shop=convenience + name=Foo) → line 1 preset label, line 2 name; secondary typography visibly smaller.
  3. Long name / long preset string → truncation and balloon size; crosshair opacity behavior in PushPinView still sane.
  4. After tag edits in the POI editor, return to map → callout updates via refreshPushpinText().

Automated

  • Run GoMapTests target (app test host): OsmBaseObject_PushpinCalloutTestCase — redundancy helper, shop=convenience scenarios, name-only fallback, redundant name omitted.
Open in Web Open in Cursor 

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>
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.

2 participants