在 Raphael.js 中拖动并旋转一组路径
首先,有没有办法访问您从此方法创建的路径“行”之一: 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");
?这创建了一个 8 边形状,我需要使其中一侧的描边颜色不同。
我找不到办法,所以我最终这样做了:
r = paper.set();
r.push(
paper.path("M0 0L0 50"),
paper.path("M0 50L125 50"),
paper.path("M125 50L125 0"),
paper.path("M125 0L0 0")
);
创建 4 条线,组成一个矩形。我需要一种方法来拖动这些类型的形状,如果您单击并按住路径内“包含”区域中的任意位置,拖动就会开始。我还需要一种方法来旋转整组路径,并且能够在坐标系不旋转的情况下拖动它们。我正在使用最新版本的Raphael(2.0)。
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"),
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).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了帮助解决第二个问题,Raphael.Freetransform 处理单个元素和集合的拖动、旋转和缩放。
To help with second question, Raphael.Freetransform handles dragging, rotating and scaling of individual elements and sets.