Created
April 17, 2014 08:17
-
-
Save mathieue/10963840 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updatearc() { | |
var point = [45.337, -0.472]; | |
var point2 = [49.045, 2.153]; | |
pathArcs.attr("d", function (d) { | |
var source = map.latLngToLayerPoint(new L.LatLng(point[0], point[1])); | |
var target = map.latLngToLayerPoint(new L.LatLng(point2[0], point2[1])); | |
var dx = target.x - source.x, | |
dy = target.y - source.y, | |
dr = Math.sqrt(dx * dx + dy * dy); | |
var arc = "M" + source.x + "," + source.y + "A" + dr + "," + dr + ",0 0 1 " + target.x + "," + target.y; | |
return arc; | |
}) | |
.style({ | |
stroke: '#0000ff', | |
'stroke-width': '20px' | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment