csssvgborderdojox.gfxgfx

Mark selected svg / gfx elements


I found out that in svg/gfx you can't set border and padding and such to child elements.

So is there an alternative for this(svg/gfx way for borders/paddings...)?

I want to make it so when a user clicks an <image>(or other node type) he somehow sees which element is selected. I thought that border would work, but apparently I was wrong.


Solution

  • 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.