From 65680175fc04e71b362458745727974af73f711c Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 28 Oct 2024 10:42:46 +0800 Subject: feat: set marker title by textContent or option --- src/dumbyUtils.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/dumbyUtils.mjs') diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs index 1993b02..c4f8d74 100644 --- a/src/dumbyUtils.mjs +++ b/src/dumbyUtils.mjs @@ -92,7 +92,7 @@ export function removeBlockFocus () { * @param {Number[]} options.point - page XY * @param {HTMLElement} options.map */ -export const addMarkerByPoint = ({ point, map }) => { +export const addMarkerByPoint = ({ point, map, title }) => { const rect = map.getBoundingClientRect() const [lon, lat] = map.renderer .unproject([point[0] - rect.left, point[1] - rect.top]) @@ -102,6 +102,7 @@ export const addMarkerByPoint = ({ point, map }) => { xy: [lon, lat], }) marker.dataset.xy = `${lon},${lat}` + if (title) marker.title = title return marker } -- cgit v1.2.3-70-g09d2