Skip to content

Commit

Permalink
correct way to determine freehand mode is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
drnextgis committed Mar 18, 2016
1 parent 9c573a5 commit 658a2b3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ol/interaction/drawinteraction.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down

0 comments on commit 658a2b3

Please sign in to comment.