0

I'm trying to create a ol.interaction.Modify() to adjust a bounding box's edges and position. In OpenLayers 2 I used TransformFeature Control and There were options to configure the transformation. How could the feature be modified in ol3 without changing the shape? I also want to add vertices as in ol2. If there's no other way then implementing a new interaction, could you provide some resources on how to do that?

1

As you found out already, there is nothing like a TransformFeature control in ol3 currently. However, it is quite easy to create a custom interaction that deals with specific feature modifications. For inspiration, you can look at the official drag-features example.

In your case, you will probably analyze the coordinate in the handleDownEvent function and determine the quadrant of your box and the proximity to the box corners. By doing so, you can conditionally set the behavior of the handleDragEvent function to either change one of the corner coordinates, or to drag the box as shown in the example.

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.