Hi, there is already a ticket for this issue:
http://trac.openlayers.org/ticket/2094 Regards, Andreas. On Thu, Jul 2, 2009 at 9:47 AM, Andreas Hocevar<[email protected]> wrote: > Hi, > > On Thu, Jul 2, 2009 at 12:33 AM, <[email protected]> wrote: >> I have a question about the measure control in openlayers.... I noticed >> today that after we upgraded to Openlayers 2.8, the behavior for the control >> is somewhat different than it was in 2.7, with the primary difference being >> that if you're "in a hurry" so to speak and don't make your clicks slow and >> deliberate, an invalid distance appears on the initial click. I checked and >> it doesn't look like its just me -- it happens on the example page also. >> >> http://openlayers.org/dev/examples/measure.html >> >> Click while you're in motion and it's fairly easy to replicate. Your >> initial distance will vary based on...well I'm not sure, but the distance is >> not zero as you might expect. Any thoughts on what might be causing this >> behavior? > > The distance you see is the distance at the time the calculation is > done, which happens later than the click. > > It is because the measure calculation is now called using setTimeout > (due to issues in IE, IIRC), and takes the geometry which already has > a length when the calculation is done. If you want to create a bug > report: the fix is easy. In the first line of the measurePartial > method in Control.Measure, you have to add > > geometry = geometry.clone(); > > BTW, the final result of the measure calculation is still correct. > > Also, you can configure the measure control to update the distance > while moving the mouse: > > var control = new OpenLayers.Control.Measure(/* your config here */); > control.handler.callbacks.modify = function(point, feature) { > control.measurePartial(point, feature.geometry); > }; > > Regards, > Andreas. > > > -- > Andreas Hocevar > OpenGeo - http://opengeo.org/ > Expert service straight from the developers. > -- Andreas Hocevar OpenGeo - http://opengeo.org/ Expert service straight from the developers. _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
