I want to let visitors scale the image using click-and-drag:
<html>
<body>
<svg>
<image>
Is there a JavaScript library that will help me?
I notice Raphael has click and drag methods but I will still have to write a lot of JS to:
- Find the corners of the image
- Make the area near the corners selectable
- Draw icons for the corners so it’s obvious they are selectable
- Add click, drag and drop to the corners
- Update the dimensions of the image
I could do all that but it sounds time-consuming. Is there an open-source script I should use? Other suggestions?
I found this solution at this post:
Draggables and Resizables in SVG.
In the answer, you can find a jsfiddle link: http://jsfiddle.net/tmkfs/. You can resize the box by clicking and dragging the corner of the box. Hope this code could help you.