From 93d3ddb033d522d127487617f4432e412ec292c3 Mon Sep 17 00:00:00 2001 From: Greg Gianforcaro Date: Sat, 23 Nov 2019 00:26:59 -0500 Subject: [PATCH] Fix modifying circle geometries The Snap interaction may have altered the event coordinate, so Modify should use the event coordinate whenever available. Resolves #10316 --- src/ol/interaction/Modify.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 42d6fda4dc..fe81a771ee 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -807,8 +807,8 @@ class Modify extends PointerInteraction { if (!this.condition_(evt)) { return false; } - this.handlePointerAtPixel_(evt.pixel, evt.map); const pixelCoordinate = evt.coordinate; + this.handlePointerAtPixel_(evt.pixel, evt.map, pixelCoordinate); this.dragSegments_.length = 0; this.modified_ = false; const vertexFeature = this.vertexFeature_; @@ -916,16 +916,17 @@ class Modify extends PointerInteraction { */ handlePointerMove_(evt) { this.lastPixel_ = evt.pixel; - this.handlePointerAtPixel_(evt.pixel, evt.map); + this.handlePointerAtPixel_(evt.pixel, evt.map, evt.coordinate); } /** * @param {import("../pixel.js").Pixel} pixel Pixel * @param {import("../PluggableMap.js").default} map Map. + * @param {import("../coordinate.js").Coordinate=} opt_coordinate The pixel Coordinate. * @private */ - handlePointerAtPixel_(pixel, map) { - const pixelCoordinate = map.getCoordinateFromPixel(pixel); + handlePointerAtPixel_(pixel, map, opt_coordinate) { + const pixelCoordinate = opt_coordinate || map.getCoordinateFromPixel(pixel); const projection = map.getView().getProjection(); const sortByDistance = function(a, b) { return projectedDistanceToSegmentDataSquared(pixelCoordinate, a, projection) -