diff --git a/src/ol/interaction/extent.js b/src/ol/interaction/extent.js index d827a2c287..8579fc7a68 100644 --- a/src/ol/interaction/extent.js +++ b/src/ol/interaction/extent.js @@ -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]); diff --git a/src/ol/interaction/snap.js b/src/ol/interaction/snap.js index 6da5ef8315..3e10becec3 100644 --- a/src/ol/interaction/snap.js +++ b/src/ol/interaction/snap.js @@ -371,8 +371,7 @@ ol.interaction.Snap.prototype.snapTo = function(pixel, pixelCoordinate, map) { vertex = (ol.coordinate.closestOnSegment(pixelCoordinate, closestSegment)); vertexPixel = map.getPixelFromCoordinate(vertex); - if (Math.sqrt(ol.coordinate.squaredDistance(pixel, vertexPixel)) <= - this.pixelTolerance_) { + if (ol.coordinate.distance(pixel, vertexPixel) <= this.pixelTolerance_) { snapped = true; if (this.vertex_) { pixel1 = map.getPixelFromCoordinate(closestSegment[0]);