Re: keeping DOM and Graphics in sync

rm <[email protected]>
Newsgroups gmane.text.xml.batik.user
Message-ID <[email protected]>
hi again,

some additions to this - if i transform my dom tree, then load it again, then modify attributes in the dom, getBBox works, and the changes are reflected immediately in the call … as below.

so - how can i make batik aware of a dynamically added node so that it works the same way as a node that's been there from the beginning?

.rm


------------------------------------------------------------------------------------------------------------------------------------------------------------------

// test-rect is INSIDE of test-g

Element g1 = (ctx.getDocument().getElementById("test-g"));
			
		
Element r1 = (ctx.getDocument().getElementById("test-rect"));
r1.setAttributeNS(null, "width","200");
r1.setAttributeNS(null, "height","900");
	
for(int i =0; i<5;i++) {
	
	r1.setAttributeNS(null, "transform", "rotate("+i+",0,0)");
	
	System.err.println(" ========> "+((SVGLocatable)g1).getBBox().getWidth());
	System.err.println(" ========> "+((SVGLocatable)g1).getBBox().getHeight());
	System.err.println();
}


------------------------------------------------------------------------------------------------------------------------------------------------------------------

results in a nice, expectable:

 ========> 200.0
 ========> 900.0

 ========> 215.6767
 ========> 903.3534

 ========> 231.2877
 ========> 906.43164

 ========> 246.82828
 ========> 909.23376

 ========> 262.29364
 ========> 911.7589
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.