xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas E Deweese <thomas.dewe...@kodak.com>
Subject 'use' element and DOM structure
Date Thu, 11 Apr 2002 20:39:02 GMT
>>>>> "MT" == Milan Trninic <mtrninic@galdosinc.com> writes:

MT> Hi, does someone know how to figure out what School has user
MT> clicked on. In the following snippet:

MT> <g id="School" transform="scale(0.25)"> <path style="..."d="..."/>
MT> <path style="..." d="..."/> </g> <use
MT> transform="translate(0.0,400.0) scale(1)"
MT> xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#School"
MT> id="School.1"/> <use transform="translate(0.0,400.0) scale(1)"
MT> xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#School"
MT> id="School.2"/>

MT> There are two schools with IDs Schools.1 and School.2. When user
MT> clicks on one of them, the event contains the g element, not the
MT> 'use' element. Now I couldn't figure out how to follow the link
MT> backwards to the 'use' element.  The problem is that the SVG
MT> document contains 'use' elements without children ("non-exposed
MT> DOM tree" as the spec state), and g element which I can get from
MT> the event is the one under svg, not the cloned (non-exposed) one
MT> under 'use'.

    You can take a look at samples/mines.svg.

    In this example I do something like:

function handleClick(evt, id) {
  var e = doc.getElementById(id);
}


<g id="School" transform="scale(0.25)">          
    <path style="..."d="..."/>           
    <path style="..." d="..."/>       
</g>       
<use transform="translate(0.0,400.0) scale(1)" 
     onclick="handleClick(evt, 'School.1')"
     xlink:href="#School" id="School.1"/>    

<use transform="translate(0.0,400.0) scale(1)" 
     onclick="handleClick(evt, 'School.1')"
     xlink:href="#School" id="School.2"/>    

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message