Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

selecting multiple svg elements and dragging them in Raphael.js

Does anyone know how I can achieve this?

I basically have an svg document with multiple shapes,lines,text,etc... and I am trying to implement a selection tool which helps me select multiple elements, group them and drag them.

like image 826
fogy Avatar asked Apr 30 '11 22:04

fogy


1 Answers

There is a feature in raphäel called set: http://raphaeljs.com/reference.html#set

You can add all the elements you want to drag around to a new set and then apply the dragging mechanism to the set.

I made you this: http://jsfiddle.net/Wrajf/

It's not perfect. I would add the mousemove event to the document, but for that you need a library like jQuery. Otherwise if you move the mouse to fast you have a fall out.

like image 195
thgie Avatar answered Sep 23 '22 15:09

thgie