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
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.interaction.Draw.handleEvent = function(mapBrowserEvent) {
|
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_;
|
var pass = !this.freehand_;
|
||||||
if (this.freehand_ &&
|
if (this.freehand_ &&
|
||||||
mapBrowserEvent.type === ol.MapBrowserEvent.EventType.POINTERDRAG) {
|
mapBrowserEvent.type === ol.MapBrowserEvent.EventType.POINTERDRAG) {
|
||||||
@@ -362,11 +367,8 @@ ol.interaction.Draw.handleDownEvent_ = function(event) {
|
|||||||
if (this.condition_(event)) {
|
if (this.condition_(event)) {
|
||||||
this.downPx_ = event.pixel;
|
this.downPx_ = event.pixel;
|
||||||
return true;
|
return true;
|
||||||
} else if ((this.mode_ === ol.interaction.DrawMode.LINE_STRING ||
|
} else if (this.freehand_) {
|
||||||
this.mode_ === ol.interaction.DrawMode.POLYGON) &&
|
|
||||||
this.freehandCondition_(event)) {
|
|
||||||
this.downPx_ = event.pixel;
|
this.downPx_ = event.pixel;
|
||||||
this.freehand_ = true;
|
|
||||||
if (!this.finishCoordinate_) {
|
if (!this.finishCoordinate_) {
|
||||||
this.startDrawing_(event);
|
this.startDrawing_(event);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user