Merge pull request #56 from jorix/3576-MeasureImm

#3576 Incorrect geometry passed to measurePartial
This commit is contained in:
Éric Lemoine
2012-03-03 23:59:54 -08:00
2 changed files with 5 additions and 5 deletions

View File

@@ -231,8 +231,8 @@ OpenLayers.Control.Measure = OpenLayers.Class(OpenLayers.Control, {
* mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature. * mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature.
*/ */
measureImmediate : function(point, feature, drawing) { measureImmediate : function(point, feature, drawing) {
if (drawing && this.delayedTrigger === null && if (drawing && !this.handler.freehandMode(this.handler.evt)) {
!this.handler.freehandMode(this.handler.evt)) { this.cancelDelay();
this.measure(feature.geometry, "measurepartial"); this.measure(feature.geometry, "measurepartial");
} }
}, },

View File

@@ -289,16 +289,16 @@
// move 10 pixels // move 10 pixels
trigger("mousemove", 0, 10); trigger("mousemove", 0, 10);
t.eq(log.length, 0, "a) no event fired yet"); t.eq(log.length, 1, "a) has fired an event");
t.delay_call( t.delay_call(
delay, function() { delay, function() {
// confirm measurepartial is fired // 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"); t.ok(log[0] && log[0].type == "measurepartial", "a) correct type");
// mousemove within the partialDelay fires no event, so the // mousemove within the partialDelay fires no event, so the
// measure below is the one of the initial point // 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 // b) move 10 pixels
trigger("mousemove", 0, 20); trigger("mousemove", 0, 20);