aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-10-12 16:38:22 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-10-13 11:06:46 +0800
commit2694a56eb896ec4564630e36647d0b53a2278591 (patch)
tree09b91e3e23c686ac74e7803c858b459346c09f3d
parenteb93a18859247e5033c7bff58a4961837e748911 (diff)
fix: remove leader lines anyway
in case content refresh when link is hovered
-rw-r--r--src/dumbyUtils.mjs2
-rw-r--r--src/dumbymap.mjs5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs
index a350ee3..e8fb982 100644
--- a/src/dumbyUtils.mjs
+++ b/src/dumbyUtils.mjs
@@ -250,7 +250,7 @@ export const createDocLink = link => {
250 * 250 *
251 * @param {HTMLAnchorElement} link 251 * @param {HTMLAnchorElement} link
252 */ 252 */
253const removeLeaderLines = link => { 253export const removeLeaderLines = link => {
254 if (!link.lines) return 254 if (!link.lines) return
255 link.lines.forEach(line => line.remove()) 255 link.lines.forEach(line => line.remove())
256 link.lines = [] 256 link.lines = []
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index 4a11bcb..34b0e32 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -224,6 +224,11 @@ export const generateMaps = (container, {
224 .forEach(utils.createGeoLink) 224 .forEach(utils.createGeoLink)
225 }) 225 })
226 226
227 /** LINK: remove all leaderline when onRemove() */
228 onRemove(htmlHolder, () =>
229 htmlHolder.querySelectorAll('.with-leader-line')
230 .forEach(utils.removeLeaderLines),
231 )
227 /** 232 /**
228 * mapFocusObserver. observe for map focus 233 * mapFocusObserver. observe for map focus
229 * @return {MutationObserver} observer 234 * @return {MutationObserver} observer