Raphael JS 嵌套画布?
我正在使用 Raphael JS 在网页上绘制矢量图形,并且我有一个矩形 (Raphael.rect),我想将其用作与其父级不同的单独画布。 有什么办法可以做到这一点吗?
编辑:我只是像平常一样在矩形中绘制,但它不会切断其边框的内容。
I'm using Raphael JS to draw vector graphics on a webpage, and I have a rectangle (Raphael.rect) that I'd like to use as a seperate canvas from its parent.
Is there any way to do this?
EDIT: I'd just draw in the rectangle like normal, but it wouldn't cut off the contents at its border.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
目前,您无法使用 Raphael
rect
作为常规 Raphael 对象的等效项:遗憾的是,不支持嵌套。您可能需要做的是使用rect
的位置作为应出现在rect
内的所有绘图操作的偏移量。You currently can not use a Raphael
rect
as the equivalent of a regular Raphael object: nesting is unfortunately not supported. What you will probably have to do is use the position of therect
as an offset for all your drawing operations that should appear inside therect
.显然,clip-rect 适用于此。
噢,在所有希望都破灭后寻找的力量。
Apparently clip-rect works for this.
Oh the power of searching after all hope is lost.