使用currentScale放大SVG

Arn*_*aud 4 svg zoom

我有一个网页,其中有一个SVG框<svg id='graph'>...</svg>.

我想给用户提供放大SVG框的可能性.

document.getElementById("graph").currentScale*=2;例如,如果我想将盒子的大小加倍,我就是为此而使用的.

问题是所有窗口都被调整大小,甚至是框外的HTML元素.

你知道这个问题的根源吗?

Ras*_*ash 7

要将缩放应用于仅svg,请使用此...

<svg>
<g transform="scale(2)">

</g>
</svg>
Run Code Online (Sandbox Code Playgroud)