Possible threading bug with a resized event
Baskakov Daniel <[email protected]>
| Newsgroups | gmane.text.xml.batik.user |
|---|---|
| Message-ID | <CAMojAe--6+5K7VOMgLem+fqy3V4Po=oTw342BjqfV6hk84-PFQ@mail.gmail.com> |
Hi! Let me introduce a problem first. I'm creating a library with custom-animated SVG images. The most animations implemented by dynamic DOM modifications are handled by Batik pretty well, but some are not. There are some cases (see applied example) when it is impossible to identify what elements need to be repainted upon dynamically changing a DOM. The most "elegant" decision I found to eliminate this problem is to force a complete GVT tree rebuild by removing and adding back a root element of SVG document. This cause a repaint of the entire SVG, capturing all DOM changes and showing correct image on the canvas. But there is another problem appeared. After the canvas image is "refreshed" by removing/adding the root element, resizing the canvas occasionally cause paint transformation to break. The image became misplaced. The applied example visually demonstrates this situation. There is a frame with a rotating knob. When the "Root replace" check box is disabled, no actions are performed except setting a transform attribute of appropriate nodes. Batik handle changes automatically and the knob is rotated, but you can see the shadow is not rotated. When the "Root replace" is enabled, the remove/add root node operation is performed each animation frame. In this case the animation is perfect. Now, with enabled "Root replace" press the bottom 'Send "resized" event' button. This will send the 'COMPONENT_RESIZED' event to JSVGCanvas. Bang: the image will slightly move out of the drawing canvas! Finally, when you played enough with the animation), here are my questions: 1. Is it acceptable to remove and add the SVG document root element to make all DOM-modifications visible? 2. Any ideas to avoid image jumping with "add/remove refresh" and a resized event (if it is a bug)? PS: I used Batik 1.7 and 1.8pre with the same result. Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
svgResizeTest.zip
(application/zip, 20.3 KB) - not displayed