From eae04c92bcd785ea81693b3c6ae8f2cda589f209 Mon Sep 17 00:00:00 2001 From: Xavier Mamano Date: Wed, 16 Nov 2011 19:51:28 +0100 Subject: [PATCH 1/2] cancelDelay before measureImmediate + changes in tests. --- lib/OpenLayers/Control/Measure.js | 4 ++-- tests/Control/Measure.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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); From 7c76b90a2de0f27f5b4c6d7e5c6ba7b451f24d33 Mon Sep 17 00:00:00 2001 From: Xavier Mamano Date: Tue, 17 Jan 2012 22:45:25 +0100 Subject: [PATCH 2/2] Test Measure: Correct the text of expected result. --- tests/Control/Measure.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Control/Measure.html b/tests/Control/Measure.html index fb55fc9364..58df363f6e 100644 --- a/tests/Control/Measure.html +++ b/tests/Control/Measure.html @@ -289,12 +289,12 @@ // move 10 pixels trigger("mousemove", 0, 10); - t.eq(log.length, 1, "a) no event fired yet"); + t.eq(log.length, 1, "a) has fired an event"); t.delay_call( delay, function() { // confirm measurepartial is fired - t.eq(log.length, 1, "a) event logged"); + t.eq(log.length, 1, "a) one event logged"); 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