One surprise to be aware of is that <g/> elements and <svg/> elements seem to treat their coordinate systems differently. I had some problems when I tried implementing layers with <svg/> elements that were simplified when I used <g/>.
If I remember correctly, it may have had something to do with an unusual coordinate system in the main <svg/>. In any case, test it carefully. I found the results surprising.<smile/> G. Wade Stefán Freyr Stefánsson wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Thank you for your reply. > > I just had an idea! :o) > > I was reading about SVG when I suddenly noticed that it's possible to "embed" > a new <svg> element inside the root <svg> element to obtain a completely new > coordinate system. > > I've done some experiments with this and it looks like it could work! > > To explain I have to ellaborate a bit on what I've already done: > As I said in my previous post I've managed to create a small application that > displays a floor plan with "chairs" that are given a special ID by using a > custom made attribute. > In order to manipulate these "chairs" I recursively scan the SVG DOM tree once > it's been parsed and look for any Element that has that attribute and store > that element in a HashMap that maps the value of the chair-id attribute to > the Element that contains the chair definition. So in reality, I'm able to > get a reference to the <use...> element that defines the chair in the SVG > floor plan document. > When I receive the vote event for a particular chair, I look up that chairs > element using the HashMap and manipulate the Element object. > > So... since I'm able to do that, I could just as well "pre-process" the SVG > DOM tree in memory in such a way that I yank the <use...> element out of the > tree and put in a new <svg> element using the x and y values of the <use> > element that was there in the first place... So what I'll have is a floor > plan file that looks very simple: > <svg ...> > <defs> > <g id="chair" style="stroke:black;stroke-width:1.5;"> > <rect width="400" height="400" x="0" y="0"/> > </g> > </defs> > > <use xlink:href="#chair" x="50" y="50" embla:chair-id="1"/> > <use xlink:href="#chair" x="500" y="100" embla:chair-id="2"/> > </svg> > > But after the pre-processing, the DOM tree will actually look like this: > <svg ...> > <defs> > <g id="chair" style="stroke:black;stroke-width:1.5;"> > <rect width="400" height="400" x="0" y="0"/> > </g> > </defs> > > <svg x="50" y="50"> > <use xlink:href="#chair" x="0" y="0" embla:chair-id="1"/> > </svg> > <svg x="500" y="100"> > <use xlink:href="#chair" x="0" y="0" embla:chair-id="2"/> > </svg> > </svg> > > (I've tried to view this file in Squiggle and it seems to work) ...[snip]... --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]