将变换应用于父 g 元素后,子元素上的 Snap.svg 边界框未更新 [英] Snap.svg bounding box not updated on child elements after applying transform to parent g element

查看:25
本文介绍了将变换应用于父 g 元素后,子元素上的 Snap.svg 边界框未更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码笔:http://codepen.io/anon/pen/dfIBv

我在应用变换的 g 元素中有两个矩形.GetBBox 方法在转换前后显示相同的数字.

I have two rectangles in g element on which I apply transform. GetBBox method shows same numbers after and before transform.

如果我直接在这些矩形上应用相同的变换,getBBox 方法会显示正确的测量值.

If I apply same transform directly on those rectangles, getBBox method shows correct measurements.

在对父组元素应用变换后,有没有办法获得这些矩形的正确"测量值?

Is there any way how to get "correct" measurements of these rectangles after applying transform to parent group element?

谢谢!

推荐答案

Ian 是正确的.element.node.getBoundingClientRect() 显示正确的测量值.谢谢:)

Ian is correct. element.node.getBoundingClientRect() shows correct measurements. Thank you :)

这篇关于将变换应用于父 g 元素后,子元素上的 Snap.svg 边界框未更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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