diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-10-11 15:17:25 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-10-11 15:17:26 +0800 |
commit | 2a7a840c25fcdb1653538514fb6609b0dea61b66 (patch) | |
tree | 80ae0c0a3e5b204de5d98090de61ace31979f0c0 /src/dumbyUtils.mjs | |
parent | 184b3004d82806f1b31c94701e75585fb8f2721b (diff) |
feat: add handler for invlid coordinates
* prvent default onmouseover/onclick handler
* set bg-color of GeoLink as gray
* add title to suggest another CRS
Diffstat (limited to 'src/dumbyUtils.mjs')
-rw-r--r-- | src/dumbyUtils.mjs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/dumbyUtils.mjs b/src/dumbyUtils.mjs index 2e71ee6..2f92c18 100644 --- a/src/dumbyUtils.mjs +++ b/src/dumbyUtils.mjs | |||
@@ -165,6 +165,8 @@ export const createGeoLink = (link) => { | |||
165 | 165 | ||
166 | // LeaderLine | 166 | // LeaderLine |
167 | link.onmouseover = () => { | 167 | link.onmouseover = () => { |
168 | if (link.dataset.valid === 'false') return | ||
169 | |||
168 | const anchors = getMarkersFromMaps(link) | 170 | const anchors = getMarkersFromMaps(link) |
169 | anchors | 171 | anchors |
170 | .filter(isAnchorVisible) | 172 | .filter(isAnchorVisible) |
@@ -176,11 +178,13 @@ export const createGeoLink = (link) => { | |||
176 | link.onmouseout = () => removeLeaderLines(link) | 178 | link.onmouseout = () => removeLeaderLines(link) |
177 | link.onclick = (event) => { | 179 | link.onclick = (event) => { |
178 | event.preventDefault() | 180 | event.preventDefault() |
181 | if (link.dataset.valid === 'false') return | ||
182 | |||
179 | removeLeaderLines(link) | 183 | removeLeaderLines(link) |
180 | getMarkersFromMaps(link) | 184 | getMarkersFromMaps(link) |
181 | .forEach(updateMapCameraByMarker([ | 185 | .forEach(updateMapCameraByMarker([ |
182 | Number(link.dataset.lon), | 186 | Number(link.dataset.lon), |
183 | Number(link.dataset.lat) | 187 | Number(link.dataset.lat), |
184 | ])) | 188 | ])) |
185 | } | 189 | } |
186 | return true | 190 | return true |