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:
@@ -115,7 +115,7 @@ var source = new ol.source.GeoJSON(
|
|||||||
'coordinates': [
|
'coordinates': [
|
||||||
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
[[-1e6, -7.5e5], [-1e6, 7.5e5]],
|
||||||
[[-1e6, -7.5e5], [-1e6, 7.5e5], [-5e5, 0], [-1e6, -7.5e5]],
|
[[-1e6, -7.5e5], [-1e6, 7.5e5], [-5e5, 0], [-1e6, -7.5e5]],
|
||||||
[[1e6, -7.5e5], [15e5, 0], [15e5, 0], [1e6, 7.5e5]],
|
[[1e6, -7.5e5], [15e5, 0], [15e5, 0], [1e6, 7.5e5]],
|
||||||
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
[[-7.5e5, -1e6], [7.5e5, -1e6]],
|
||||||
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
[[-7.5e5, 1e6], [7.5e5, 1e6]]
|
||||||
]
|
]
|
||||||
@@ -129,7 +129,7 @@ var source = new ol.source.GeoJSON(
|
|||||||
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
[[[-5e6, 6e6], [-5e6, 8e6], [-3e6, 8e6],
|
||||||
[-3e6, 6e6], [-5e6, 6e6]]],
|
[-3e6, 6e6], [-5e6, 6e6]]],
|
||||||
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
[[[-3e6, 6e6], [-2e6, 8e6], [0, 8e6],
|
||||||
[0, 6e6], [-3e6, 6e6] ]],
|
[0, 6e6], [-3e6, 6e6]]],
|
||||||
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
[[[1e6, 6e6], [1e6, 8e6], [3e6, 8e6],
|
||||||
[3e6, 6e6], [1e6, 6e6]]]
|
[3e6, 6e6], [1e6, 6e6]]]
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -436,11 +436,11 @@ ol.interaction.Modify.handleDownEvent_ = function(evt) {
|
|||||||
|
|
||||||
// prevent dragging closed linestrings by the connecting node
|
// prevent dragging closed linestrings by the connecting node
|
||||||
if ((segmentDataMatch.geometry.getType() ===
|
if ((segmentDataMatch.geometry.getType() ===
|
||||||
ol.geom.GeometryType.LINE_STRING ||
|
ol.geom.GeometryType.LINE_STRING ||
|
||||||
segmentDataMatch.geometry.getType() ===
|
segmentDataMatch.geometry.getType() ===
|
||||||
ol.geom.GeometryType.MULTI_LINE_STRING) &&
|
ol.geom.GeometryType.MULTI_LINE_STRING) &&
|
||||||
componentSegments[uid][0] &&
|
componentSegments[uid][0] &&
|
||||||
componentSegments[uid][0].index === 0) {
|
componentSegments[uid][0].index === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,8 +507,8 @@ ol.interaction.Modify.handleDragEvent_ = function(evt) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
geometry.setCoordinates(coordinates);
|
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) {
|
ol.interaction.Modify.handleEvent = function(mapBrowserEvent) {
|
||||||
var handled;
|
var handled;
|
||||||
if (!mapBrowserEvent.map.getView().getHints()[ol.ViewHint.INTERACTING] &&
|
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);
|
this.handlePointerMove_(mapBrowserEvent);
|
||||||
}
|
}
|
||||||
if (!goog.isNull(this.vertexFeature_) &&
|
if (!goog.isNull(this.vertexFeature_) &&
|
||||||
|
|||||||
Reference in New Issue
Block a user