diff --git a/lib/OpenLayers/Control/Measure.js b/lib/OpenLayers/Control/Measure.js index f57f6c4465..a8f66dd89a 100644 --- a/lib/OpenLayers/Control/Measure.js +++ b/lib/OpenLayers/Control/Measure.js @@ -230,8 +230,8 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, { * mouseposition. feature - {} The sketch feature. */ measureImmediate : function(point, feature, drawing) { - if (drawing && this.delayedTrigger === null && - !this.handler.freehandMode(this.handler.evt)) { + if (drawing && !this.handler.freehandMode(this.handler.evt)) { + this.cancelDelay(); this.measure(feature.geometry, "measurepartial"); } }, diff --git a/tests/Control/Measure.html b/tests/Control/Measure.html index 045f807d36..fb55fc9364 100644 --- a/tests/Control/Measure.html +++ b/tests/Control/Measure.html @@ -289,7 +289,7 @@ // move 10 pixels trigger("mousemove", 0, 10); - t.eq(log.length, 0, "a) no event fired yet"); + t.eq(log.length, 1, "a) no event fired yet"); t.delay_call( delay, function() { @@ -298,7 +298,7 @@ t.ok(log[0] && log[0].type == "measurepartial", "a) correct type"); // mousemove within the partialDelay fires no event, so the // measure below is the one of the initial point - t.ok(log[0] && log[0].measure == 0, "a) correct measure"); + t.eq(log[0]?log[0].measure:-1 , 10, "a) correct measure"); // b) move 10 pixels trigger("mousemove", 0, 20);