aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Link.mjs3
-rw-r--r--src/MenuItem.mjs19
-rw-r--r--src/dumbymap.mjs5
3 files changed, 26 insertions, 1 deletions
diff --git a/src/Link.mjs b/src/Link.mjs
index 031b125..590942c 100644
--- a/src/Link.mjs
+++ b/src/Link.mjs
@@ -64,6 +64,7 @@ export const GeoLink = (link) => {
64 hide: true, 64 hide: true,
65 middleLabel: labelText, 65 middleLabel: labelText,
66 path: 'magnet', 66 path: 'magnet',
67 path: link.dataset.linePath ?? 'magnet',
67 }) 68 })
68 line.show('draw', { duration: 300 }) 69 line.show('draw', { duration: 300 })
69 70
@@ -181,7 +182,7 @@ export const DocLink = (link) => {
181 fontWeight: 'bold', 182 fontWeight: 'bold',
182 }), 183 }),
183 hide: true, 184 hide: true,
184 path: 'magnet', 185 path: link.dataset.linePath ?? 'magnet',
185 }) 186 })
186 link.lines.push(line) 187 link.lines.push(line)
187 line.show('draw', { duration: 300 }) 188 line.show('draw', { duration: 300 })
diff --git a/src/MenuItem.mjs b/src/MenuItem.mjs
index 4769817..7c617cc 100644
--- a/src/MenuItem.mjs
+++ b/src/MenuItem.mjs
@@ -474,3 +474,22 @@ export const setGeoLinkType = (link) => new Folder({
474 }) 474 })
475 }), 475 }),
476}) 476})
477
478/**
479 * set type of leader-line
480 *
481 * @param {GeoLink | DocLink} link
482 */
483export const setLeaderLineType = (link) => new Folder({
484 text: 'Line Type',
485 items: ['magnet', 'straight', 'grid', 'fluid']
486 .map(path => new Item({
487 text: path,
488 className: ['keep-menu'],
489 onclick: () => {
490 link.dataset.linePath = path
491 removeLeaderLines(link)
492 link.onmouseover()
493 },
494 })),
495})
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index f1e971b..3315a03 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -532,6 +532,7 @@ export const generateMaps = (container, {
532 const map = e.target.closest('.mapclay') 532 const map = e.target.closest('.mapclay')
533 const block = e.target.closest('.dumby-block') 533 const block = e.target.closest('.dumby-block')
534 const geoLink = e.target.closest('.geolink') 534 const geoLink = e.target.closest('.geolink')
535 const linkWithLine = e.target.closest('.with-leader-line')
535 if (!block && !map && !geoLink) return 536 if (!block && !map && !geoLink) return
536 e.preventDefault() 537 e.preventDefault()
537 538
@@ -551,6 +552,10 @@ export const generateMaps = (container, {
551 }).observe(menu, { childList: true }) 552 }).observe(menu, { childList: true })
552 menu.timer = setTimeout(() => menu.remove(), 100) 553 menu.timer = setTimeout(() => menu.remove(), 100)
553 554
555 if (linkWithLine) {
556 menu.appendChild(menuItem.setLeaderLineType(linkWithLine))
557 }
558
554 // Menu Items for GeoLink 559 // Menu Items for GeoLink
555 if (geoLink) { 560 if (geoLink) {
556 if (geoLink.classList.contains('from-text')) { 561 if (geoLink.classList.contains('from-text')) {