From 2ed509a20d3dcd77853792dbae6fea4e7e18601e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Thu, 17 Jun 2021 09:54:41 +0200 Subject: [PATCH] Support RenderFeature in Modify with hitDetection --- src/ol/interaction/Modify.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index b5a8616cd9..36fba09fab 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -82,7 +82,7 @@ const ModifyEventType = { /** * @typedef {Object} SegmentData * @property {Array} [depth] Depth. - * @property {Feature} feature Feature. + * @property {import("../Feature").FeatureLike} feature Feature. * @property {import("../geom/SimpleGeometry.js").default} geometry Geometry. * @property {number} [index] Index. * @property {Array>} segment Segment. @@ -140,7 +140,7 @@ const ModifyEventType = { export class ModifyEvent extends Event { /** * @param {ModifyEventType} type Type. - * @param {Collection} features + * @param {Collection} features * The features modified. * @param {import("../MapBrowserEvent.js").default} MapBrowserEvent * Associated {@link module:ol/MapBrowserEvent}. @@ -150,7 +150,7 @@ export class ModifyEvent extends Event { /** * The features being modified. - * @type {Collection} + * @type {Collection} * @api */ this.features = features; @@ -255,7 +255,7 @@ class Modify extends PointerInteraction { this.ignoreNextSingleClick_ = false; /** - * @type {Collection} + * @type {Collection} * @private */ this.featuresBeingModified_ = null; @@ -783,7 +783,7 @@ class Modify extends PointerInteraction { /** * @param {import("../coordinate.js").Coordinate} coordinates Coordinates. - * @param {Array} features The features being modified. + * @param {Array} features The features being modified. * @param {Array} geometries The geometries being modified. * @return {Feature} Vertex feature. * @private @@ -1140,14 +1140,13 @@ class Modify extends PointerInteraction { geometry = geometry || feature.getGeometry(); if ( geometry.getType() === GeometryType.POINT && - geometry.getCoordinates && // Skip RenderFeature includes(this.features_.getArray(), feature) ) { hitPointGeometry = geometry; - const coordinate = geometry.getCoordinates(); + const coordinate = geometry.getFlatCoordinates().slice(0, 2); nodes = [ { - feature: /** @type {Feature} */ (feature), + feature, geometry, segment: [coordinate, coordinate], },