From a50fda5ac87a959478030afdb614b32aa5abdf26 Mon Sep 17 00:00:00 2001 From: Ludvig Eriksson Date: Tue, 4 Dec 2018 09:55:31 +0100 Subject: [PATCH] Call insertVertexCondition only when a vertex acually can be inserted --- src/ol/interaction/Modify.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index ba0b7ed285..279c12e38e 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -82,7 +82,7 @@ const ModifyEventType = { * {@link module:ol/events/condition~altKeyOnly} results in a vertex deletion. * @property {import("../events/condition.js").Condition} [insertVertexCondition] A * function that takes an {@link module:ol/MapBrowserEvent~MapBrowserEvent} and - * returns a boolean to indicate whether a new vertex can be added to the sketch + * returns a boolean to indicate whether a new vertex should be added to the sketch * features. Default is {@link module:ol/events/condition~always}. * @property {number} [pixelTolerance=10] Pixel tolerance for considering the * pointer close enough to a segment or vertex for editing. @@ -823,8 +823,9 @@ class Modify extends PointerInteraction { this.dragSegments_.push([segmentDataMatch, 1]); componentSegments[uid][1] = segmentDataMatch; - } else if (this.insertVertexCondition_(evt) && getUid(segment) in this.vertexSegments_ && - (!componentSegments[uid][0] && !componentSegments[uid][1])) { + } else if (getUid(segment) in this.vertexSegments_ && + (!componentSegments[uid][0] && !componentSegments[uid][1]) && + this.insertVertexCondition_(evt)) { insertVertices.push([segmentDataMatch, vertex]); } }