Hi Marco,
I would suggest adding your listener before starting the load of the
document.
Then you know for sure that the document hasn't finished when you add your
listener.
Also I should point out that getSVGDocument might return true before
the SVG DOM
is really ready to be used so just checking that could be bad you really need
to use the
LoadEventDispatcherListener.
Finally you need to make sure that you set the canvas to ALWAYS_DYNAMIC
otherwise you might not get the load event called for static looking SVG
documents.
Thomas
On Jun 5, 2012, at 7:31 AM, [email protected] wrote:
> Hi,
>
> when trying to access the DOM of an SVG document in a JSVGCanvas, it
> should be done via an SVGLoadEventDispatcherListener, to assert that the
> document is only accessed, when the parsing finished.
> For example:
>
> this.svgCanvas.addSVGLoadEventDispatcherListener(new
> SVGLoadEventDispatcherAdapter() {
> @Override
> public void
> svgLoadEventDispatchStarted(SVGLoadEventDispatcherEvent e) {
> final Element element=
> svgCanvas.getSVGDocument().getElementById(elementId);
> element.setAttribute("visibility", "hidden");
> }
> }
> });
>
>
> But, of course, this handler is only called once, when the document was
> loaded. But what, if I can't be sure whether the document was already
> loaded, but still want to apply this code?
>
> What is the recommended approach to modify the DOM, regardless of the
> fact, whether the document finished loading or not?
>
>
> Regards
> Marco
>
>
> ---------------------------------------------------------------------
> 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]