Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Does SVG support layers?

15,369 views
Skip to first unread message

Siegfried Heintze

unread,
Jul 16, 2008, 6:51:33 PM7/16/08
to
I want to have a grid that I can turn on and off. Does SVG have the concept
of a layer where all members of the layer can be made invisible or visible
or would I have to iterate over all my little "x"'s and turn each one on and
off?

Thanks,
Siegfried


codedread

unread,
Jul 16, 2008, 9:36:50 PM7/16/08
to

SVG has the more powerful, generic concept of 'groups' (the <g>
element): http://www.w3.org/TR/SVG11/struct.html#Groups

You could use the display property with a <g> to achieve what you
want: http://www.w3.org/TR/SVG11/painting.html#DisplayProperty

Regards,
Jeff

Rick

unread,
Jul 17, 2008, 10:48:24 PM7/17/08
to codedread, dev-te...@lists.mozilla.org
As Jeff says, you can emulate layers with groups.

To make a group invisible, use the visibility attribute. This will
make the content of the group (layer) visible/invisible, but it will
still be there, you just won't be able to see it.

To make a group not render at all, i.e not respond to any interaction
at all use the display attribute. Display 'none' will render the
content of the group totally innocuous as if it were not there at all.
In effect it is not.

SVG uses the painters model, I think this is important to know if you
are used to CAD systems. the last group in the document is drawn last
and it will appear on top of everything else. So if you want your
grid in front of the image, put it at the bottom of the document.

Also InkScape, an excellent SVG editor, has a feature that emulates layers.

> _______________________________________________
> dev-tech-svg mailing list
> dev-te...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-tech-svg
>

--
Cheers!
Rick

0 new messages