Skip to content

Add labelPosition to the default marker icon and pick the marker drawn under the tap - #12

Merged
wf9a5m75 merged 1 commit into
developfrom
feature/marker-label-position
Oct 23, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
feature/marker-label-position

Conversation

@wf9a5m75

@wf9a5m75 wf9a5m75 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

概要

ColorDefaultIcon / ImageDefaultIcon に labelPosition を追加しました。ラベルをピンの横・上・下に置けます。あわせて、タップしたときに「指の下に描かれているマーカー」を選ぶようにしました。android-sdk / react-sdk と同じ規則です。

labelPosition

String で、CSS の background-position と同じ書き方です(例: "right center"。既定は defaultLabelPosition = "center center" で、従来どおりの表示)。

  • レイアウトの計算は DefaultIconLayout に集め、両方のアイコンで共有しています。
  • anchor / infoAnchor はそのレイアウトから求めます。指定された infoAnchor は、copy() と hashCode() 用に別に保持しています。

タップ判定

MarkerHitTest に、次の部品を @_spi(MapConductorDriver) で追加しました。

  • pickIndex / pick / screenRect / searchBounds / searchRadius

選び方は 2 段階です。

  1. アイコン(ラベル込み)の矩形に入っていれば最優先し、手前のものを選びます。
  2. 入っていなければ、許容範囲内でアンカーが一番近いものを選びます。

この規則を次の場所で使っています。

  • StrategyMarkerController.find
  • MarkerTileRenderer.hitTest
  • 各プロバイダ(別 PR)

hitsIcon も、ラベルの広がりを見るようにしました。

確認(develop 上)

  • シミュレータで xcodebuild test を実行し、240 件すべて成功しました(DefaultIconLabelPositionTests と MarkerHitTestPickTests を追加)。
  • API ベースラインについて:
    • develop のベースラインは、手元と別のツールチェーンで生成されています(表記が Swift.String)。
    • そのため全体を出し直すことはせず、今回の追加分(labelPosition 関係)だけを develop の表記に合わせて当てました。

マージ順

これがコアです。ios-for-* の PR は、この PR に依存します。

この PR に依存する PR

@wf9a5m75
wf9a5m75 merged commit da81af2 into develop Oct 23, 2026
2 checks passed
@wf9a5m75
wf9a5m75 deleted the feature/marker-label-position branch October 23, 2026 02:22
@wf9a5m75 wf9a5m75 mentioned this pull request Oct 23, 2026
wf9a5m75 added a commit that referenced this pull request Oct 23, 2026
* Make bearing a clockwise map rotation (#10)

bearing を「値を増やすと地図が時計回りに回る」向きに統一し、ネイティブ SDK との変換をコアの CameraBearing に集約する。

* fix: zoom 0 is a zoom, not a missing one (#11)

moveCameraTo(cameraPosition:) ran every camera through resolveCameraPosition,
which read `zoom == 0 && bearing == 0 && tilt == 0` as "the caller only gave me
a position" and replaced the requested camera with the stored one, keeping the
position alone. A camera that really does ask for zoom 0 — the whole world —
matches that test exactly, so it was the one camera the map would not move to.

It shows up as a feature that does nothing rather than as a wrong value: the
map stays where it was, so what that invites you to conclude is that zoom 0 is
unsupported.

Position-only already has a way to be said: the `moveCameraTo(position:)`
overload. Inferring the same intent a second time from the *value* costs a
legal zoom, and cannot tell `MapCameraPosition(position:)` from one written
with `zoom: 0` anyway — zoom defaults to 0, so by the time a camera arrives
the two are one value.

android-sdk never had this; MapViewState.kt hands the camera straight to the
controller. js-sdk-core carried the same code and loses it in the same change
(MapConductor/js-sdk-core#4), so all three platforms now agree.

* Add labelPosition to the default marker icon and pick the marker drawn under the tap (#12)

* Release 1.3.2
wf9a5m75 added a commit that referenced this pull request Oct 24, 2026
* Make bearing a clockwise map rotation (#10)

bearing を「値を増やすと地図が時計回りに回る」向きに統一し、ネイティブ SDK との変換をコアの CameraBearing に集約する。

* fix: zoom 0 is a zoom, not a missing one (#11)

moveCameraTo(cameraPosition:) ran every camera through resolveCameraPosition,
which read `zoom == 0 && bearing == 0 && tilt == 0` as "the caller only gave me
a position" and replaced the requested camera with the stored one, keeping the
position alone. A camera that really does ask for zoom 0 — the whole world —
matches that test exactly, so it was the one camera the map would not move to.

It shows up as a feature that does nothing rather than as a wrong value: the
map stays where it was, so what that invites you to conclude is that zoom 0 is
unsupported.

Position-only already has a way to be said: the `moveCameraTo(position:)`
overload. Inferring the same intent a second time from the *value* costs a
legal zoom, and cannot tell `MapCameraPosition(position:)` from one written
with `zoom: 0` anyway — zoom defaults to 0, so by the time a camera arrives
the two are one value.

android-sdk never had this; MapViewState.kt hands the camera straight to the
controller. js-sdk-core carried the same code and loses it in the same change
(MapConductor/js-sdk-core#4), so all three platforms now agree.

* Add labelPosition to the default marker icon and pick the marker drawn under the tap (#12)

* Release 1.3.2
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