Ahmed Hussain created BATIK-1307:
------------------------------------
Summary: CSS class change on group does not trigger update
Key: BATIK-1307
URL: https://issues.apache.org/jira/browse/BATIK-1307
Project: Batik
Issue Type: Bug
Components: SVG DOM
Affects Versions: 1.13
Environment: Mac OS 11.13.1
Reporter: Ahmed Hussain
Attachments: complicated-css.svg, simple-css.svg
I'm using as an embedded component for diagrams in a project. I was trying to
add some interaction, highlighting nodes and edges on mouse over. I am doing
this from Java by hit testing on mouse-move, then modifying the DOM
accordingly; this is much easier for my use case than adding javascript event
handlers.
Since I have control over the top-level embedded CSS style block, it is easiest
to put all the styling I require for highlighting into that, then toggle a
'highlight' class on and off when the mouse moves over a particular DOM element.
The problem I have run into is that the change to the class attribute doesn't
seem to take effect in certain circumstances. My hunch is that the problem is
that this occurs when the CSS acts indirectly. If you see the attached
simple-css.svg, I can toggle 'highlight' programmatically on any of the
rectangle objects and this correctly causes the styles to get updated, and the
diagram to be repainted.
However, in complicated-css.svg this does not work. In theory I should be able
to highlight the nodes or edges by adding a highlight css class to the grouping
nodes e2, e6 etc. If I do this before loading the document, this renders fine.
But if I toggle it programmatically on a live DOM, this does not get detected
as triggering a style change. I can 'nudge' it by adding a stroke='red'
attribute to the group - that then causes the rendering to change appropriately.
Assume it's something to do with event propagation/dirty DOM detection but
haven't managed to figure out where.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]