SVGSVGElement: currentScale 属性
SVGSVGElement
接口的 currentScale
属性反映了相对于初始视图的当前缩放因子,用于考虑用户对最外层 <svg>
元素的缩放和移动操作。
DOM 属性 currentScale
和 currentTranslate
等价于 2x3 矩阵 [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y]
。如果启用了“缩放”(即 zoomAndPan="magnify"
),那么其效果就像在 SVG 文档片段的最外层(即在最外层 <svg>
元素之外)应用了一个额外的变换。
如果 <svg>
元素不在最外层,那么 currentScale
始终为 1
,对其进行设置无效。