- From: Rick Anderson <rianders@rci.rutgers.edu>
- Date: Wed, 1 May 2002 23:30:02 -0400 (EDT)
- To: www-svg@w3.org
It seems impossible to refer to inner objects invoked by using the <use> tag. In the example below the only way to create a fill affect is to directly set the fill on the rectangle inside the group, inside the <defs>. This however causes all references to the rectangle to be filled with the same color. In batik using the DOM viewer it shows that the <use> tag has no children. Which might explain why affects can only be performed directly on the linked object. Can an object truly be copied using the <use> tag? If so how do you reference that copy? The example below demonstrates this problem. --Rick Anderson ______________________________________________________ "With that amount of fixing it really ought to be better." <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/SVG/DTD/svg10.dtd"> <svg width="336" height="100"> <!-- Rick Anderson rianders@rci.rutgers.edu --> <!-- simple rollover and button test --> <!-- problem: the set does not work on the use tag. --> <!-- problem: the mouseover changes both objects --> <!-- question: Is there a way to clone objects? --> <defs> <g id="foo"> <rect id="bar" width="50" height="16" fill="red"> <!-- These do nothing. They do work in a rectangle all by itself. Outside of defs. <set xlink:href="#bar" attributeName="fill" to="green" begin="mouseover" end="mouseout" /> <set xlink:href="#bar" attributeName="fill" to="green" begin="footext.mouseover" end="footext.mouseout" /> <set xlink:href="#footext" attributeName="fill" to="yellow" begin="bar.mouseover" end="bar.mouseout" /> <set xlink:href="#footext" attributeName="fill" to="yellow" begin="mouseover" end="mouseout" /> --> </rect> <!-- text must appear outside of rect so that it is not coverd by rect. --> <text id="footext" x="10" y="12" style="text-decoration:underline;fill:black">blah</text> </g> <g id="text0" > <text id="innertext" x="75" y="25" style="text-decoration:underline;fill:black">inside</text> </g> </defs> <use id="test0" xlink:href="#foo" x="24" y="10" > <!-- Will only perform the fill on #bar, filling #test0, and #foo does nothing.--> <set xlink:href="#bar" attributeName="fill" to="green" begin="test0.mouseover" end="test0.mouseout" /> </use> <!-- uses the rectangle --> <use id="test1" xlink:href="#bar" x="24" y="30" /> <!-- uses only the text --> <use id="test1a" xlink:href="#footext" x="24" y="45" /> <!-- Uses text group --> <use id="test2" xlink:href="#text0" /> <!-- This directly references #innertext. This causes a color change. --> <!--However, it causes all #innertexts to change color. --> <set xlink:href="#innertext" attributeName="fill" to="green" begin="test2.mouseover" end="test2.mouseout" /> <!-- green is not activated when this text field is entered by mouse --> <use id="test3" xlink:href="#text0" x="75" y="45" /> </svg>
Received on Wednesday, 1 May 2002 23:30:07 UTC