Allow clicks to be stopped while drawing

This commit is contained in:
Tim Schaub
2017-11-29 10:55:15 -07:00
parent 45d2f8debb
commit b58073dd06
3 changed files with 24 additions and 1 deletions

View File

@@ -97,6 +97,14 @@ ol.interaction.Draw = function(options) {
*/
this.mode_ = ol.interaction.Draw.getMode_(this.type_);
/**
* Stop click, singleclick, and doubleclick events from firing during drawing.
* Default is `false`.
* @type {boolean}
* @private
*/
this.stopClick_ = !!options.stopClick;
/**
* The number of points that must be drawn before a polygon ring or line
* string can be finished. The default is 3 for polygon rings and 2 for
@@ -384,6 +392,9 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
this.finishCoordinate_ = null;
this.abortDrawing_();
}
if (!pass && this.stopClick_) {
event.stopPropagation();
}
return pass;
};