Repository navigation
Add labelPosition to the default marker icon and pick the marker drawn under the tap - #6
Merged
Merged
Conversation
This was referenced Oct 23, 2026
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.
概要
既定マーカーアイコンに
labelPositionを追加し、ラベルをピンの横・上・下に置けるようにしました。あわせて、タップしたときに「指の下に描かれているマーカー」を選ぶようにしました。labelPositionCSS の
background-positionと同じ書き方です(例:"right center")。横はleft/center/right、縦はtop/center/bottomで、順序は問いません。片方だけ書いた場合、もう一方はcenterになります。left/right: ラベルをピンの外側に置きます。縦はピンの上端・頭の中心・先端のどれかに揃えます。center列のtop/bottom: ラベルをピンの上・下の外側に置きます。"center center"(既定): ラベルをピンの頭に重ねます。従来と同じ表示です。ラベルを片側に置くと、ビットマップはその側にだけ伸びます。そのため
anchor(ピン先端の位置)は、固定の (0.5, 1) ではなくレイアウトから計算します。infoAnchorは、指定値をピン本体に対する割合として扱います。タップ判定
候補は「先端が一番近い 1 つ」ではなく、タップ位置の周り(256px)から集めます。追加した部品はすべて
@internal(ドライバー実装点)で、アプリ向けの公開 API には載りません。pickMarkerHit/preferMarkerHit/pickMarkerIndex/markerSearchBounds/MARKER_HIT_SEARCH_RADIUS_PXmarkerIconExtentPx: 当たり判定と吹き出しで、アイコンの実寸を使うための部品です。MarkerTileRenderer.findHit: タイル化マーカーの判定に、「真下にあったか」の区別を付けて返します。android-sdk-core / ios-sdk-core にも、同じ規則で同じ変更を入れています(別 PR)。
確認(develop 上)
npm run buildとnpm testは 14 件すべて成功しました(DefaultIconLabelPosition.test.mjs/MarkerHitPick.test.mjsを追加)。resolveCameraPositionの記述も消えています(ベースラインが以前からずれていた分)。developの.gitignoreは*.mjsを無視するので、追加したテストは強制追加しています。マージ順
これがコアです。react-for-* と js-sdk-react の PR はこの PR に依存するので、先にこちらをマージしてください。
この PR に依存する PR