简体   繁体   English

标记选定的svg / gfx元素

[英]Mark selected svg / gfx elements

I found out that in svg/gfx you can't set border and padding and such to child elements. 我发现在svg / gfx中,您不能为子元素设置边框和填充等。

So is there an alternative for this(svg/gfx way for borders/paddings...)? 那么,有没有替代方法(用于边框/填充的svg / gfx方法...)?

I want to make it so when a user clicks an <image> (or other node type) he somehow sees which element is selected. 我要这样做,以便当用户单击<image> (或其他节点类型)时,他会以某种方式看到选择了哪个元素。 I thought that border would work, but apparently I was wrong. 我以为边界可以用,但显然我错了。

Draw a rect the with a stroke of the highlight colour and a fill of none. 用高光颜色的笔触绘制一个矩形,不填充任何颜色。 Make it visible when an element is selected and size it to the size of the selected element. 选择元素时使其可见,并将其调整为选定元素的大小。 You can get the dimensions of the element by calling the getBBox() function on it. 您可以通过调用元素的getBBox()函数来获取其尺寸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM