correct way to determine freehand mode is enabled

This commit is contained in:
drnextgis
2016-03-18 11:10:27 +06:00
parent 9c573a5b3c
commit 658a2b317e

View File

@@ -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);
}