measure control - wrong measure when moving fast, r=fredj (closes #2691)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10407 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2010-06-17 12:55:44 +00:00
parent cd94a7f17d
commit c4fbe1c0b3
2 changed files with 48 additions and 0 deletions

View File

@@ -19,6 +19,7 @@
}
// test for <http://trac.openlayers.org/ticket/2691>
function test_cancel(t) {
t.plan(4);
@@ -67,6 +68,52 @@
}
function test_partial(t) {
t.plan(1);
// set up
var map, layer, control, geometry, log;
map = new OpenLayers.Map("map", {units: "m"});
layer = new OpenLayers.Layer(null, {isBaseLayer: true});
map.addLayer(layer);
map.zoomToMaxExtent();
control = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, {
partialDelay: null
});
map.addControl(control);
control.activate();
control.events.on({
"measurepartial": function(e) {
log.measure = e.measure;
}
});
// test
geometry = new OpenLayers.Geometry.LineString([
new OpenLayers.Geometry.Point(1, 1),
new OpenLayers.Geometry.Point(2, 1)
]);
log = {};
control.measurePartial(null, geometry);
geometry.components[1].x = 3;
t.delay_call(0.2, function() {
t.eq(log.measure, 1, "partial measure is correct");
// tear down
map.destroy
});
};
</script>
</head>
<body>