<HTML dir=ltr><HEAD><TITLE>[OpenLayers-Users] Measure Control - get distance on mouse move</TITLE>
<META http-equiv=Content-Type content="text/html; charset=unicode">
<META content="MSHTML 6.00.2900.5726" name=GENERATOR></HEAD>
<BODY>
<DIV id=idOWAReplyText88325 dir=ltr>
<DIV dir=ltr><FONT face=Verdana color=#000000 size=2>Try this :</FONT></DIV>
<DIV dir=ltr><FONT face=Verdana size=2></FONT> </DIV>
<DIV dir=ltr> var oMeasrLinearCtrlOptions =<BR> {<BR> title: 'bla bla bla',<BR> displayUnits: 'km',<BR> eventListeners:<BR> {<BR> 'measure': handleMeasr,<BR> 'measurepartial': handleMeasr<BR> },<BR> handlerOptions:<BR> {<BR> persist: true<BR> }<BR> };<BR> var oMeasrLinearCtrl = new OpenLayers.Control.Measure ( OpenLayers.Handler.Path, oMeasrLinearCtrlOptions );<BR> oToolbar.addControl ( oMeasrLinearCtrl, { iconCls: 'measrlinear', toggleGroup: 'map' } );<BR></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr>function handleMeasr(event)<BR>{<BR> if(event.order==1) // LINEAR<BR> displayMeasr (event.measure.toFixed(3) + " " + event.units, "");<BR> else // POLYGON<BR> {<BR> var area = event.measure.toFixed(3) + " " + event.units;<BR> var a = oMap.getControlsByClass('OpenLayers.Control.Measure');<BR> var ctrl = a[0];<BR> var length = (ctrl.getBestLength(event.geometry)[0]).toFixed(3) + " " + ctrl.getBestLength(event.geometry)[1];</DIV>
<DIV dir=ltr> //displayMeasr (length, area);<BR> }<BR>}<BR></DIV>
<DIV dir=ltr><FONT face=Verdana color=#000000 size=2></FONT> </DIV></DIV>
<DIV id=idSignature59301 dir=ltr>
<DIV><FONT color=#000000 size=2><FONT face=Verdana><STRONG></STRONG></FONT></FONT> </DIV>
<DIV><FONT color=#000000 size=2><FONT face=Verdana><STRONG>James </STRONG></FONT></FONT></DIV><STRONG><FONT face=Verdana size=2></FONT></STRONG></DIV>
<DIV dir=ltr> </DIV>
<DIV dir=ltr>
<DIV><BR></DIV>
<DIV>
<HR tabIndex=-1>
</DIV>
<DIV><FONT face=Tahoma size=2><B>De:</B> users-bounces@openlayers.org de la part de RFeagin<BR><B>Date:</B> jeu. 19-03-09 11:38<BR><B>А:</B> users@openlayers.org<BR><B>Objet :</B> [OpenLayers-Users] Measure Control - get distance on mouse move<BR></FONT><BR></DIV></DIV>
<DIV><BR>
<P><FONT size=2>Has anyone made the measure control get the distance on mouse move? After<BR>the first point has been added it would be nice to see a 'real-time'<BR>distance using the current mouse position as the final point.<BR><BR>Just thought I'd check to see if someone had already done it and was willing<BR>to share.<BR><BR>Thanks<BR>--<BR>View this message in context: <A href="http://n2.nabble.com/Measure-Control---get-distance-on-mouse-move-tp2503580p2503580.html">http://n2.nabble.com/Measure-Control---get-distance-on-mouse-move-tp2503580p2503580.html</A><BR>Sent from the OpenLayers Users mailing list archive at Nabble.com.<BR><BR>_______________________________________________<BR>Users mailing list<BR>Users@openlayers.org<BR><A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR></FONT></P></DIV></BODY></HTML>