Javascript 更改 SVG 路径的宽度/高度
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14907208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Changing the width/height of an SVG path
提问by nicholaswmin
How can I change the width/heightof a selected path in SVG-edit.
如何更改SVG-edit 中选定路径的宽度/高度。
So far i only have this:
svgCanvas.changeSelectedAttribute("height", "499");
到目前为止,我只有这个:
svgCanvas.changeSelectedAttribute("height", "499");
The above command has absolutely no effect on the path. Resizing the bounding box just resizes the bounding box, but notthe path itself.
上面的命令对路径完全没有影响。调整边界框的大小只会调整边界框的大小,而不是路径本身。
采纳答案by Plynx
For a path, you probably want to apply a transformrather than edit the path coordinates, which can get complicated. See http://www.w3.org/TR/SVG/coords.html#TransformAttribute
对于路径,您可能希望应用变换而不是编辑路径坐标,这会变得很复杂。见http://www.w3.org/TR/SVG/coords.html#TransformAttribute

