correct way to determine freehand mode is enabled
This commit is contained in:
@@ -337,6 +337,11 @@ ol.interaction.Draw.prototype.setMap = function(map) {
|
||||
* @api
|
||||
*/
|
||||
ol.interaction.Draw.handleEvent = function(mapBrowserEvent) {
|
||||
if ((this.mode_ === ol.interaction.DrawMode.LINE_STRING ||
|
||||
this.mode_ === ol.interaction.DrawMode.POLYGON) &&
|
||||
this.freehandCondition_(mapBrowserEvent)) {
|
||||
this.freehand_ = true;
|
||||
}
|
||||
var pass = !this.freehand_;
|
||||
if (this.freehand_ &&
|
||||
mapBrowserEvent.type === ol.MapBrowserEvent.EventType.POINTERDRAG) {
|
||||
@@ -362,11 +367,8 @@ ol.interaction.Draw.handleDownEvent_ = function(event) {
|
||||
if (this.condition_(event)) {
|
||||
this.downPx_ = event.pixel;
|
||||
return true;
|
||||
} else if ((this.mode_ === ol.interaction.DrawMode.LINE_STRING ||
|
||||
this.mode_ === ol.interaction.DrawMode.POLYGON) &&
|
||||
this.freehandCondition_(event)) {
|
||||
} else if (this.freehand_) {
|
||||
this.downPx_ = event.pixel;
|
||||
this.freehand_ = true;
|
||||
if (!this.finishCoordinate_) {
|
||||
this.startDrawing_(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user