aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/dumbyUtils.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/dumbyUtils.mjs')
-rw-r--r--src/dumbyUtils.mjs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs
index be45139..b6b63d8 100644
--- a/src/dumbyUtils.mjs
+++ b/src/dumbyUtils.mjs
@@ -244,14 +244,14 @@ const isAnchorVisible = anchor => {
244 return insideWindow(anchor) && insideParent(anchor, mapContainer) 244 return insideWindow(anchor) && insideParent(anchor, mapContainer)
245} 245}
246 246
247export const addAnchorByEvent = ({ 247export const addAnchorByPoint = ({
248 event, 248 point,
249 map, 249 map,
250 validateAnchorName = () => true 250 validateAnchorName = () => true
251}) => { 251}) => {
252 const rect = map.getBoundingClientRect() 252 const rect = map.getBoundingClientRect()
253 const [x, y] = map.renderer 253 const [x, y] = map.renderer
254 .unproject([event.x - rect.left, event.y - rect.top]) 254 .unproject([point.x - rect.left, point.y - rect.top])
255 .map(coord => Number(coord.toFixed(7))) 255 .map(coord => Number(coord.toFixed(7)))
256 256
257 let prompt 257 let prompt
@@ -264,7 +264,7 @@ export const addAnchorByEvent = ({
264 while (anchorName !== null && !validateAnchorName(anchorName)) 264 while (anchorName !== null && !validateAnchorName(anchorName))
265 if (anchorName === null) return 265 if (anchorName === null) return
266 266
267 const link = `geo:${y},${x}?xy=${x},${y}&id=${map.id} "${anchorName}"` 267 const link = `geo:${y},${x}?xy=${x},${y}&id=${map.id}&text=${anchorName}`
268 map.renderer.addMarker({ 268 map.renderer.addMarker({
269 xy: [x, y], 269 xy: [x, y],
270 title: `${map.id}@${x}, ${y}`, 270 title: `${map.id}@${x}, ${y}`,