aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/dumbymap.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/dumbymap.mjs')
-rw-r--r--src/dumbymap.mjs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index 92fe785..bb3737b 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -6,6 +6,7 @@ import MarkdownItInjectLinenumbers from 'markdown-it-inject-linenumbers'
6import * as mapclay from 'mapclay' 6import * as mapclay from 'mapclay'
7import { onRemove, animateRectTransition, throttle, debounce, shiftByWindow } from './utils' 7import { onRemove, animateRectTransition, throttle, debounce, shiftByWindow } from './utils'
8import { Layout, SideBySide, Overlay, Sticky } from './Layout' 8import { Layout, SideBySide, Overlay, Sticky } from './Layout'
9import { GeoLink, DocLink } from './Link.mjs'
9import * as utils from './dumbyUtils' 10import * as utils from './dumbyUtils'
10import * as menuItem from './MenuItem' 11import * as menuItem from './MenuItem'
11import PlainModal from 'plain-modal' 12import PlainModal from 'plain-modal'
@@ -209,7 +210,7 @@ export const generateMaps = (container, {
209 if (node.matches?.('.mapclay') || node.closest?.('.mapclay')) return 210 if (node.matches?.('.mapclay') || node.closest?.('.mapclay')) return
210 211
211 // Add GeoLinks from plain texts 212 // Add GeoLinks from plain texts
212 addGeoLinksByText(node) 213 utils.addGeoSchemeByText(node)
213 214
214 // Render Map 215 // Render Map
215 const mapTarget = node.parentElement?.closest(mapBlockSelector) 216 const mapTarget = node.parentElement?.closest(mapBlockSelector)
@@ -245,9 +246,9 @@ export const generateMaps = (container, {
245 246
246 // Add GeoLinks/DocLinks by pattern 247 // Add GeoLinks/DocLinks by pattern
247 target.querySelectorAll(geoLinkSelector) 248 target.querySelectorAll(geoLinkSelector)
248 .forEach(utils.createGeoLink) 249 .forEach(GeoLink.replaceWith)
249 target.querySelectorAll(docLinkSelector) 250 target.querySelectorAll(docLinkSelector)
250 .forEach(utils.createDocLink) 251 .forEach(DocLink.replaceWith)
251 252
252 // Add GeoLinks from text nodes 253 // Add GeoLinks from text nodes
253 // const addedNodes = Array.from(mutation.addedNodes) 254 // const addedNodes = Array.from(mutation.addedNodes)
@@ -318,7 +319,7 @@ export const generateMaps = (container, {
318 values.at(-1) 319 values.at(-1)
319 .map(utils.setGeoSchemeByCRS(crsString)) 320 .map(utils.setGeoSchemeByCRS(crsString))
320 .filter(link => link) 321 .filter(link => link)
321 .forEach(utils.createGeoLink) 322 .forEach(GeoLink.replaceWith)
322 }) 323 })
323 } 324 }
324 325
@@ -556,7 +557,7 @@ export const generateMaps = (container, {
556 menu.appendChild(new menuItem.Item({ 557 menu.appendChild(new menuItem.Item({
557 text: 'Delete', 558 text: 'Delete',
558 onclick: () => { 559 onclick: () => {
559 utils.getMarkersFromMaps(geoLink) 560 geoLink.getMarkersFromMaps()
560 .forEach(m => m.remove()) 561 .forEach(m => m.remove())
561 geoLink.replaceWith( 562 geoLink.replaceWith(
562 document.createTextNode(geoLink.textContent), 563 document.createTextNode(geoLink.textContent),
@@ -637,7 +638,7 @@ export const generateMaps = (container, {
637 container.appendChild(pointByArrow) 638 container.appendChild(pointByArrow)
638 639
639 const timer = setTimeout(() => { 640 const timer = setTimeout(() => {
640 utils.dragForAnchor(container, range, pointByArrow) 641 utils.addGeoLinkByDrag(container, range, pointByArrow)
641 }, 300) 642 }, 300)
642 643
643 // Update leader-line with mouse move 644 // Update leader-line with mouse move