Skip to content

Center a side label on the pin, not on its head - #18

Merged
wf9a5m75 merged 1 commit into
developfrom
fix/label-side-center
Oct 27, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
fix/label-side-center

Conversation

@wf9a5m75

Copy link
Copy Markdown
Contributor

React 版の MapConductor/js-sdk-core#11 と同じ変更です。

不具合

labelPosition が left center / right center のとき、ラベルがピンの中央に見えない(上に寄る)。

原因

横に置いたときの center は、ピンの頭(丸い部分)の中心(アイコンの高さの 0.35)に揃えていた。ピン全体(上端〜先端)の中間より、48 px のピンで約 7 px 上になる。

修正

横に置くときの center を、ピンの上端と先端の中間にした。top(上端に揃える)と bottom(先端に揃える)の、ちょうど中間になる。ドキュメントコメントも合わせた。

ピンの頭に重ねる center center(既定)と、上下に置く center top / center bottom は変えていない。

確認

  • xcodebuild test(シミュレータ、316 件すべて通過)
  • 新しいテスト testSideCenterIsHalfwayDownThePin(横に置いた center は、ピンの上端と先端の中間)。修正を外すと失敗することを確認した。

With the label beside the pin (left / right), center lined it up with the
head's center, 0.35 of the icon down, so it sat well above the middle of
the pin and did not look centered. It is now halfway between the pin's top
and its tip, midway between top and bottom. center center and the labels
above or below are unchanged. Same change as js-sdk-core#11.
@wf9a5m75
wf9a5m75 merged commit 8fbf53b into develop Oct 27, 2026
2 checks passed
@wf9a5m75
wf9a5m75 deleted the fix/label-side-center branch October 27, 2026 09:13
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