So I can't really point to why this might cause the problem but it really isn't very good to be reading the DOM outside of the UpdateManager thread (generally it is ok but it really isn't guarenteed). So I would suggest putting the whole shebang (getElementsByTagName, for loop, everything) into one big runnable in the UpdateManager.
Also I assume this isn't the problem but shouldn't that be a TagNameNS or something? (this isn't a call I use regularly). Do you know if this problem is limited to the use element?
zze-DAROUX Olivier FTRD/DIH/GRE wrote:
zze-DAROUX Olivier FTRD/DIH/GRE wrote:
Hi!
Maybe someone could help me to find out the problem :
I use some "use" elements refering to internal PNG
(base64-ed) in my SVG document
(displayed by a canvas). The visibility attribute is
hidden. When I set this
attribute to visible (using the update manager), the png
doesn't appear, it
only does when (for example) I move the document (using arrows).
Can you provide a reproducable test case (in particular use elements aren't allowed to reference PNG data directly). If you can't give a complete test case it might also be useful to see the code that you use to register the runnable with the update manager and change the attribute.
The svg document looks like : <svg> <defs> <image xlink:href="data:;base64,random_letters" other_attributes id="toto" /> </defs> <g> <use xlink:href="#toto" other_attributes/> </g> </svg>
for the code (hope it's not obscur) :
NodeList nodes = player.svgDoc.getElementsByTagName("use"); for (int i=0; i<nodes.getLength(); i++) { Node node = nodes.item(i); NamedNodeMap nodeAttributes = node.getAttributes(); Node nodeHref = nodeAttributes.getNamedItemNS("http://www.w3.org/1999/xlink", "href"); if (nodeHref.getNodeValue().equals("#" + key)) { final Node nodeVisibility = nodeAttributes.getNamedItem("visibility"); RunnableQueue queueAction = player.svgView.getUpdateManager().getUpdateRunnableQueue();
if (nodeVisibility.getNodeValue().equals("hidden")) { queueAction.invokeLater( new Runnable() { public void run() { nodeVisibility.setNodeValue("visible"); } } ); } else { queueAction.invokeLater( new Runnable() { public void run() { nodeVisibility.setNodeValue("hidden"); } } ); } } }
Thanks Thomas O
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]