fix(gps): подписи Старт/Финиш не обрезаются; data-gps-marker-id на маркерах — надёжная доставка кликов (панель точки, плейхед)
This commit is contained in:
@@ -59,8 +59,10 @@ export function gpsMarkerHtml(marker: GpsMapMarker): string {
|
|||||||
const opacity = marker.offline ? 'opacity:0.5;' : marker.approximate ? 'opacity:0.55;' : '';
|
const opacity = marker.offline ? 'opacity:0.5;' : marker.approximate ? 'opacity:0.55;' : '';
|
||||||
const layout = gpsMarkerLayout(marker);
|
const layout = gpsMarkerLayout(marker);
|
||||||
const title = escapeHtml(marker.label || '');
|
const title = escapeHtml(marker.label || '');
|
||||||
|
// Подпись выходит за ширину маркера (для dot 24px) — overflow виден по умолчанию,
|
||||||
|
// max-width не ставим, иначе «Старт»/«Финиш» обрезались до «С…»/«Ф…»
|
||||||
const label = marker.label
|
const label = marker.label
|
||||||
? `<div style="margin-top:2px;padding:0 4px;border-radius:4px;font-size:10px;line-height:16px;font-weight:500;background:rgba(255,255,255,0.9);border:1px solid #d4d4d8;white-space:nowrap;max-width:100%;overflow:hidden;text-overflow:ellipsis;color:#18181b;">${title}</div>`
|
? `<div style="margin-top:2px;padding:0 4px;border-radius:4px;font-size:10px;line-height:16px;font-weight:500;background:rgba(255,255,255,0.92);border:1px solid #d4d4d8;white-space:nowrap;color:#18181b;">${title}</div>`
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
let body: string;
|
let body: string;
|
||||||
@@ -82,7 +84,9 @@ export function gpsMarkerHtml(marker: GpsMapMarker): string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return `<div style="display:flex;flex-direction:column;align-items:center;width:${layout.width}px;user-select:none;cursor:pointer;${opacity}">${body}${label}</div>`;
|
// data-gps-marker-id: делегированный обработчик контейнера карты ловит клики
|
||||||
|
// по любому маркеру (надёжнее нативных событий placemark/divIcon)
|
||||||
|
return `<div data-gps-marker-id="${escapeHtml(String(marker.id))}" style="display:flex;flex-direction:column;align-items:center;width:${layout.width}px;user-select:none;cursor:pointer;${opacity}">${body}${label}</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user