I'm working on a layout builder in SVG and want to add drag and drop and resizable features to it. my webpage contains a main canvas(SVG) and some nested SVG's in it. I want my nested SVG's (child SVGs you can say) to be draggable. How can I do that? I searched in JQuery we have draggable and resizable API but its not working in SVG. How can I achieve it in d3.js? any help would be preferred. thanks in advance.
相关问题
- How to fix IE ClearType + jQuery opacity problem i
- jQuery add and remove delay
- Include empty value fields in jQuery .serialize()
- Disable Browser onUnload on certain links?
- how to get selected text from iframe with javascri
Mike Bostock's Circle Dragging example should get you started. The bare minimum, comparable to jQuery, would be:
But better join the SVG elements to data objects first and then modify the data instead of the elements directly:
To account for mouse pointer offset, and to turn the drag-and-drop into a rescale operation, you'll have to fill in the drag handler functions accordingly.