如何知道raphael对象是否被隐藏? [英] How to know if raphael object is hidden?
本文介绍了如何知道raphael对象是否被隐藏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在创建一个图表应用程序,其中我隐藏并显示一些元素,例如
I am creating a diagram application in which I hide and show few elements e.g.
var c = paper.circle(10, 10, 10);
c.hide()
var c2 = paper.circle(10, 10, 10);
c2.show()
现在我想对这样的形状采取行动,例如:计算边界框等但我无法找到如果隐藏或不隐藏形状的方法?有没有像这样的shape.is_visible()或shape.attr('visible')
Now I want to act upon such shapes e.g. calculate bounding box etc but I am not able to find how to get if shape is hidden or not? Is there something like this shape.is_visible() or shape.attr('visible')
推荐答案
我看了一眼文档和源代码,并将其煮熟(未经测试):
I took a look at the documentation and source code and cooked this up (untested):
Raphael.el.is_visible = function() {
return (this.node.style.display !== "none");
}
请致电如下:
var c = paper.circle(10, 10, 10);
c.hide();
if (c.is_visible())
alert("Visible");
else
alert("Invisible");
这篇关于如何知道raphael对象是否被隐藏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文