使用缩放时计算 protovis 中的可见区域
有没有办法在缩放时获得面板的可见区域。我 有一个力定向图,我有兴趣获得所有 缩放事件后位于可见区域的元素。 有什么建议吗? 谢谢
Is there someway to get the visible area of the panel when zooming. I
have a force directed graph and I am interested in obtaining all the
elements that are in the visible area after a zoom event.
Any suggestions?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过
transform
参数访问面板的当前变换矩阵。因此,在下面的示例中:如果您加载此示例,然后稍微缩放,您可以像这样访问当前变换矩阵:
您应该能够确定子标记是否(例如,在本示例中,
dot
)通过将转换矩阵应用于其top
和left
参数,然后检查它们是否位于面板的原始边界框内,位于可见区域中(0,0,200,200)。对于上面的点,您可以这样检查:You can access the current transformation matrix of a panel via the
transform
parameter. So, in the following example:If you load this example, then zoom around a bit, you can access the current transformation matrix like this:
You should be able to determine whether a child mark (e.g., in this example,
dot
) is in the visible area by applying the transformation matrix to itstop
andleft
parameters and then checking to see whether they're within the panel's original bounding box (0,0,200,200). For thedot
above, you could check like this: