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

View File

@@ -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]);