拉斐尔移动套装 [英] Raphael Moving Sets

查看:29
本文介绍了拉斐尔移动套装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用两个矩形制作了一个烛台并制作了一组.然后我制作了 100 根烛台并将其做成了一套.当我尝试移动所有 100 个烛台时,它们要么都移动到一个坐标,要么都正确移动,但这些烛台都移动到了蜡烛的边缘.

I make a candlestick using two rectangles and making a set. Then I make 100 candlesticks and make that a set. When I try to move all 100 candlesticks, they either all move to one coordinate, or all move correctly, but the sticks all move to the edge of the candle.

如何移动整个集合,但保留烛台的内部变换?

How can I move the whole set, but retain the inner transforms of the candlesticks?

推荐答案

可以使用 "...Tx,y" 和 "Tx,你……"分别.在您的示例中,前置可能会更实用,因为您希望视图框中集合的绝对移动发生在基于每个元素分配的任何其他转换之前.

It is possible to "append" or "prepend" transformations to a set of Raphael objects using the forms "...Tx,y" and "Tx,y..." respectively. In your example, prepending will probably be more functional since you want the absolute movement of the set in the viewbox to occur before any other transformations assigned on a per-element basis.

您应该能够做到这一点或类似的事情:

You should be able to do this or something much like it:

var shift_x = 100, shift_y = 50;
set.attr( { transform: "T" + shift_x + "," + shift_y + "..." } );

您会在 正式文档中注意到一些关于转换前置/追加的省略注释功能,遗憾的是,还有很多不足之处.

You'll notice some elliptical commentary with respect to transform prepend/append in the formal documentation for that function which, sadly, leaves much to be desired.

这篇关于拉斐尔移动套装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆