OpenLayers measure and draw controls don't show the sketches on move in touch devices

المشرف العام

Administrator
طاقم الإدارة
I have a GIS API that uses the OpenLayers 2.13 measure and drawFeature controls. But let's just talk about the measure control, because the issues are certainly connected.

As I show in this CodePen, the measure control is supposed to show the immediate measures, i.e., print them on mouse move.

measureControl = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, measureControlOptions);map.addControl(measureControl);measureControl.events.register('measure', measureControl, function(e) { printOutput(e);});measureControl.events.register('measurepartial', measureControl, function(e) { printOutput(e);});Of course, when I use this example in a touch device, I can't use the onmousemove event. Instead, the behaviour is like this:

  • 1st tap to start measuring
  • 2nd tap to stop measuring
It shows the desired length, but I am not able to perform an accurate measurement because I want to see the measures as I move my finger on the touch screen.

I am not very familiar with touch events, so I apologize if this is a stupid question. but is there an easy way to mimim the mouse behaviour on the touch device?

The desired behaviour is something like:

  • tap down --> starts measuring
  • tap move (without lifting the finger) --> keeps measuring and show the new measurement on each move
  • tap up --> stops the measurement
Thanks a lot



أكثر...
 
أعلى