From da0615a5f829b991fd9f6723eb99b1cd775f7d5f Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Tue, 27 Oct 2026 02:07:28 -0700 Subject: [PATCH] Center a side label on the pin, not on its head 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. --- .../com/mapconductor/core/marker/AbstractDefaultIcon.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/mapconductor/core/marker/AbstractDefaultIcon.kt b/src/main/java/com/mapconductor/core/marker/AbstractDefaultIcon.kt index 7c45506..c4bf259 100644 --- a/src/main/java/com/mapconductor/core/marker/AbstractDefaultIcon.kt +++ b/src/main/java/com/mapconductor/core/marker/AbstractDefaultIcon.kt @@ -204,11 +204,12 @@ abstract class AbstractDefaultIcon( } val cy = if (h != 0) { - // 横に置くときは、縦はピンの上端・頭の中心・先端に揃える。 + // 横に置くときは、縦はピンの上端・上端と先端の中間・先端に揃える。 + // center を頭の中心にすると、ピン全体の中央より上に見える。 when { v < 0 -> pin.top + labelHeight / 2f v > 0 -> pin.bottom - labelHeight / 2f - else -> headCenterY + else -> (pin.top + pin.bottom) / 2f } } else { // 中央列の top / bottom はピンと重ならないよう上下の外側に置く。 @@ -535,7 +536,7 @@ abstract class AbstractDefaultIcon( * `labelPosition` は CSS の `background-position` と同じ書き方で、横 * (left / center / right)と縦(top / center / bottom)のキーワードを空白区切りで * 並べる。順序は問わず、片方だけなら残りは center。 - * - left / right はピンの外側に置き、縦はピンの上端・頭の中心・先端に揃える。 + * - left / right はピンの外側に置き、縦はピンの上端・上端と先端の中間・先端に揃える。 * - center 列の top / bottom はピンの上・下の外側に置く。 */ const val DEFAULT_LABEL_POSITION: String = "center center"