Use ol.coordinate.distance

This commit is contained in:
Frederic Junod
2017-02-07 08:25:19 +01:00
parent bff6a14a16
commit 5c731176b9
2 changed files with 2 additions and 5 deletions
+1 -3
View File
@@ -327,9 +327,7 @@ ol.interaction.Extent.prototype.snapToVertex_ = function(pixel, map) {
var vertexPixel = map.getPixelFromCoordinate(vertex);
//if the distance is within tolerance, snap to the segment
if (Math.sqrt(ol.coordinate.squaredDistance(pixel, vertexPixel)) <=
this.pixelTolerance_) {
if (ol.coordinate.distance(pixel, vertexPixel) <= this.pixelTolerance_) {
//test if we should further snap to a vertex
var pixel1 = map.getPixelFromCoordinate(closestSegment[0]);
var pixel2 = map.getPixelFromCoordinate(closestSegment[1]);