Allow clicks to be stopped while drawing
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user