Does SVG support layers?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Does SVG support layers?

sieg
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


_______________________________________________
dev-tech-svg mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-svg
Reply | Threaded
Open this post in threaded view
|

Re: Does SVG support layers?

Jeff Schiller
On Jul 16, 5:51 pm, "Siegfried Heintze" <[hidden email]> wrote:
> 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

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
_______________________________________________
dev-tech-svg mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-svg
Reply | Threaded
Open this post in threaded view
|

Re: Does SVG support layers?

Rick-2
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.

On Wed, Jul 16, 2008 at 9:36 PM, codedread <[hidden email]> wrote:

> On Jul 16, 5:51 pm, "Siegfried Heintze" <[hidden email]> wrote:
>> 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
>
> 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
> _______________________________________________
> dev-tech-svg mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-svg
>



--
Cheers!
Rick
_______________________________________________
dev-tech-svg mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-svg