1

I'm new to OpenLayers, and I am developing a basic editor using it. I can place different kind of icons (points) or paths (lines).

An "edit" tool is required. It is supposed to allow you to modify the line path, and move the icons position. However, this is where Im facing problems... to move a point DragFeature must be used, and to edit a line ModifyFeature should be the one.

image sample here

In this approach, both controls have the same tool, and I am not being able to modify a line or drag a point with the same tool. What I tried, was to use the select control instead. Once a feature is selected, according to its type, I can swap to the appropriate control (drag or modify). However, this technique is far for from perfect, since then, two clicks are required in the feature to start dragging it. The first click, is used by the select feature to capture the event and activate the DragFeature control, and the second one is to start dragging.

I would like to be able to drag a feature with one single click, and be able to edit a line with one single click.

¿Can anyone please help me? Thank you guys

2

I think you need this. Combining those two tools can be a solution, but if you split these two tasks in two icons/individual approaches you could have a cleaner code and probably you will spend less time debugging it. "Divide and conquer" may apply quite well here

  • Thanks a lot!! :-) I think I can use it, this is exactly what I was looking for. Thanks again, you saved me a lot of time! – bacubacu May 18 '13 at 23:48
  • You're welcome =) consider up voting if it was helpful :) – Gery May 19 '13 at 6:36
  • I can't up-vote yet, my reputation is null. Thanks again :-) – bacubacu May 20 '13 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.