OpenLayers: draw path with only two points

المشرف العام

Administrator
طاقم الإدارة
I want to draw a path with no more then 2 points. On the second point I want the path to be finished.

I'm using the OpenLayers DrawFeature, I set a callbacks for "point" where I count the created points and if the points are two I'm finishing the sketch with finishSketch() method. The problem is that when finishSketch() method calls the finishGeometry() method which removes the last added point from the path which cause the following error to show

"Uncaught TypeError: Cannot read property 'geometry' of null "

My question is the any legit way for finishing a path programmaticaly or this is a bug in the DrawFeature control.



أكثر...
 
أعلى