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