Do not draw circle when pointer not moved

This commit is contained in:
Andreas Hocevar
2016-11-03 12:58:01 +01:00
parent 760a231306
commit fb1a8335ac
2 changed files with 22 additions and 1 deletions

View File

@@ -355,6 +355,7 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
var shouldHandle = this.freehand_ ?
squaredDistance > this.squaredClickTolerance_ :
squaredDistance <= this.squaredClickTolerance_;
var circleMode = this.mode_ === ol.interaction.Draw.Mode.CIRCLE;
if (shouldHandle) {
this.handlePointerMove_(event);
if (!this.finishCoordinate_) {
@@ -362,7 +363,7 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
if (this.mode_ === ol.interaction.Draw.Mode.POINT) {
this.finishDrawing();
}
} else if (this.freehand_ || this.mode_ === ol.interaction.Draw.Mode.CIRCLE) {
} else if (this.freehand_ || circleMode) {
this.finishDrawing();
} else if (this.atFinish_(event)) {
if (this.finishCondition_(event)) {
@@ -372,6 +373,8 @@ ol.interaction.Draw.handleUpEvent_ = function(event) {
this.addToDrawing_(event);
}
pass = false;
} else if (circleMode) {
this.finishCoordinate_ = null;
}
return pass;
};