fix(gps): iconShape задан от точки привязки маркера (anchor), а не от угла — активная область перекрывает маркер

This commit is contained in:
2026-09-23 13:41:07 +03:00
parent 345c34730f
commit a231f64837

View File

@@ -269,12 +269,14 @@ export function Yandex21Map({
iconLayout: ymaps.templateLayoutFactory.createClass(gpsMarkerHtml(m)),
iconOffset: [-layout.anchorX, -layout.anchorY],
// Активная область клика: без iconShape у кастомного iconLayout
// hit-test Яндекса не находит метку — клики уходят в events-pane
// hit-test Яндекса не находит метку — клики уходят в events-pane.
// Координаты iconShape — ОТ ТОЧКИ ПРИВЯЗКИ (anchor), а не от угла:
// прямоугольник [-anchor .. width-anchor] покрывает весь маркер.
iconShape: {
type: 'Rectangle',
coordinates: [
[0, 0],
[layout.width, layout.height],
[-layout.anchorX, -layout.anchorY],
[layout.width - layout.anchorX, layout.height - layout.anchorY],
],
} as unknown as ymaps.IGeometryJson,
...(m.zIndex !== undefined ? { zIndex: m.zIndex } : {}),