|
4852 | 4852 | container.classList.add('mapml-link-preview'); |
4853 | 4853 | container.appendChild(p); |
4854 | 4854 | elem.classList.add('map-a'); |
| 4855 | + if (link.visited) elem.classList.add("map-a-visited"); |
4855 | 4856 | L.DomEvent.on(elem, 'mousedown', e => dragStart = {x:e.clientX, y:e.clientY}, this); |
4856 | 4857 | L.DomEvent.on(elem, "mouseup", (e) => { |
4857 | 4858 | let onTop = true, nextLayer = this.options._leafletLayer._layerEl.nextElementSibling; |
|
4863 | 4864 | if(onTop && dragStart) { |
4864 | 4865 | L.DomEvent.stop(e); |
4865 | 4866 | let dist = Math.sqrt(Math.pow(dragStart.x - e.clientX, 2) + Math.pow(dragStart.y - e.clientY, 2)); |
4866 | | - if (dist <= 5) M.handleLink(link, leafletLayer); |
| 4867 | + if (dist <= 5){ |
| 4868 | + link.visited = true; |
| 4869 | + elem.setAttribute("stroke", "#6c00a2"); |
| 4870 | + elem.classList.add("map-a-visited"); |
| 4871 | + M.handleLink(link, leafletLayer); |
| 4872 | + } |
4867 | 4873 | } |
4868 | 4874 | }, this); |
4869 | 4875 | L.DomEvent.on(elem, "keypress", (e) => { |
4870 | 4876 | L.DomEvent.stop(e); |
4871 | | - if(e.keyCode === 13 || e.keyCode === 32) |
| 4877 | + if(e.keyCode === 13 || e.keyCode === 32) { |
| 4878 | + link.visited = true; |
| 4879 | + elem.setAttribute("stroke", "#6c00a2"); |
| 4880 | + elem.classList.add("map-a-visited"); |
4872 | 4881 | M.handleLink(link, leafletLayer); |
| 4882 | + } |
4873 | 4883 | }, this); |
4874 | 4884 | L.DomEvent.on(elem, 'mouseenter keyup', (e) => { |
4875 | 4885 | if(e.target !== e.currentTarget) return; |
|
5315 | 5325 | if (!path || !layer) { return; } |
5316 | 5326 | let options = layer.options, isClosed = layer.isClosed; |
5317 | 5327 | if ((options.stroke && (!isClosed || isOutline)) || (isMain && !layer.outlinePath)) { |
5318 | | - if (options.link){ |
5319 | | - path.style.stroke = "#0000EE"; |
5320 | | - path.style.strokeOpacity = "1"; |
5321 | | - path.style.strokeWidth = "1px"; |
5322 | | - path.style.strokeDasharray = "none"; |
5323 | | - |
5324 | | - } |
5325 | 5328 | path.setAttribute('stroke', options.color); |
5326 | 5329 | path.setAttribute('stroke-opacity', options.opacity); |
5327 | 5330 | path.setAttribute('stroke-width', options.weight); |
|
5339 | 5342 | } else { |
5340 | 5343 | path.removeAttribute('stroke-dashoffset'); |
5341 | 5344 | } |
| 5345 | + |
| 5346 | + if (options.link){ |
| 5347 | + path.setAttribute("stroke", options.link.visited?"#6c00a2":"#0000EE"); |
| 5348 | + path.setAttribute("stroke-opacity", "1"); |
| 5349 | + path.setAttribute("stroke-width", "1px"); |
| 5350 | + path.setAttribute("stroke-dasharray", "none"); |
| 5351 | + } |
5342 | 5352 | } else { |
5343 | 5353 | path.setAttribute('stroke', 'none'); |
5344 | 5354 | } |
|
0 commit comments