petchgamer / svgweb

Automatically exported from code.google.com/p/svgweb
Other
0 stars 0 forks source link

Support non standard draw event #593

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I propose a non standard "draw" event to workaround Issue 265, Issue 295, and 
Issue 417.

In these issues, which are best described in Issue 265 comment #1, the problem 
is that there is an asynchronous behavior to SVG Web rendering whereas native 
behavior is synchronous. So, with native SVG, I can expect that the graphics I 
add will have been rendered immediately after I append the element(s) to the 
document, and the bounding box and transforms will be available immediately. 
With SVG Web, however, there is no way really, to know when the element is 
valid. The reason for this is because the element is only valid after the next 
flash frame is scheduled and run which, depending on cpu load, could take a 
while.

The problem above is serious and prevents important functionality in SVG from 
working. Solving this problem "correctly" means a major overhaul of SVG Web and 
is not something that is going to happen soon.

I have worked around this problem in my own application by adding an event 
listener for a nonstandard 'draw' event. I write my code to check and only used 
this event when SVG Web is being used in flash mode, otherwise the code is 
standard DOM code. My position on this is that if I can justify using this in 
my own code then I should provide this option to other developers, with full 
disclosure on it being nonstandard, but allowing them to decide for themselves.

Original issue reported on code.google.com by grick23@gmail.com on 21 Dec 2010 at 11:46