Drag and rotate a set of paths in Raphael.js
First off, is there any way to access one of the path "lines" you create from this method: paper.path("M 250 250 l 0 -50 l -50 0 l 0 -50 l -50 0 l 0 50 l -50 0 l 0 50 z");
? That creates an 8-sided shape and I need to have one of the side's stroke color be different.
I couldn't find a way so I ended up doing this:
r = paper.set();
r.push(
paper.path("M0 0L0 50"开发者_如何学C),
paper.path("M0 50L125 50"),
paper.path("M125 50L125 0"),
paper.path("M125 0L0 0")
);
That creates 4 lines that make up a rectangle. I need a way to drag these types of shapes around, the drag would start if you click and hold anywhere in a "contained" area inside the paths. I also need a way to rotate an entire set of paths and be able to drag them without the coordinate system rotating as well. I'm using the latest version of Raphael (2.0).
To help with second question, Raphael.Freetransform handles dragging, rotating and scaling of individual elements and sets.
精彩评论