Prevent unnecessary function calls
handlePointerMove_ doesn't need to be called when dragging. handleDragEvent_ takes care of the event in that case. in handleDragEvent_, createOrUpdateVertexFeature_ doesn't need to be called for each dragged segment. it can be called only once with current vertex. fixes made to pass the build
This commit is contained in:
@@ -436,11 +436,11 @@ ol.interaction.Modify.handleDownEvent_ = function(evt) {
|
||||
|
||||
// prevent dragging closed linestrings by the connecting node
|
||||
if ((segmentDataMatch.geometry.getType() ===
|
||||
ol.geom.GeometryType.LINE_STRING ||
|
||||
segmentDataMatch.geometry.getType() ===
|
||||
ol.geom.GeometryType.MULTI_LINE_STRING) &&
|
||||
componentSegments[uid][0] &&
|
||||
componentSegments[uid][0].index === 0) {
|
||||
ol.geom.GeometryType.LINE_STRING ||
|
||||
segmentDataMatch.geometry.getType() ===
|
||||
ol.geom.GeometryType.MULTI_LINE_STRING) &&
|
||||
componentSegments[uid][0] &&
|
||||
componentSegments[uid][0].index === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -507,8 +507,8 @@ ol.interaction.Modify.handleDragEvent_ = function(evt) {
|
||||
}
|
||||
|
||||
geometry.setCoordinates(coordinates);
|
||||
this.createOrUpdateVertexFeature_(vertex);
|
||||
}
|
||||
this.createOrUpdateVertexFeature_(vertex);
|
||||
};
|
||||
|
||||
|
||||
@@ -538,7 +538,8 @@ ol.interaction.Modify.handleUpEvent_ = function(evt) {
|
||||
ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
|
||||
var handled;
|
||||
if (!mapBrowserEvent.map.getView().getHints()[ol.ViewHint.INTERACTING] &&
|
||||
mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE) {
|
||||
mapBrowserEvent.type == ol.MapBrowserEvent.EventType.POINTERMOVE &&
|
||||
!this.handlingDownUpSequence) {
|
||||
this.handlePointerMove_(mapBrowserEvent);
|
||||
}
|
||||
if (!goog.isNull(this.vertexFeature_) &&
|
||||
|
||||
Reference in New Issue
Block a user