xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Helder Magalhães <helder.magalh...@gmail.com>
Subject Re: text/tspan mouse events change when zoomed in
Date Wed, 01 Apr 2009 11:09:45 GMT
Hi Juha,

> As you suggested I tried out the nightly build (Mar 19th one) but it didn't
> fix this problem. As side note it seems that set element, that I also use in
> my SVG, doesn't work in the nightly build.

Yes, I can also confirm the symptom using the trunk code (revision
755843) using in Windows XP SP3.

> I made few changes to my code so that is produced as reduced test case as I
> could. It demonstrates all the points I made in my first message. I have
> tested it with my own program and with Batiks Squiggle.

Thanks for the test case: this made it easy to reproduce. ;-)

I've slightly beautified the test case and made minor changes (such as
renaming "changeColor" to "toggleColor" since it's what the method is
doing) and am attaching it to this message. So, in addition to the
'tpan' behavior, I've noticed that it's easy to reproduce two issues
(possibly related and/or the same):

Steps to reproduce:
1. Open attachment in Squiggle;
2. Mouse over and out on "Color test" and "Hidden test";
3. Zoom in;
4. Mouse over and out on "Color test" and "Hidden test";

Expected results:
In step 4, behavior would be the same as in step 2.

Actual results:
In step 4, mouse out events are not consistently triggered. On "Color
test", color is never toggled; On "Hidden test", only the mouse over
event seems to be triggered. If a mouse click is made over the
elements while the document is zoomed, then the events seem to be
triggered more or less as expected, but an NPE is triggered when the
click is made over "Hidden data1" (element which is displayed when
mouse is over "Hidden test"):

        at org.apache.batik.gvt.renderer.StrokingTextPainter.hitTest(Unknown
        at org.apache.batik.gvt.renderer.BasicTextPainter.selectAt(Unknown
        at org.apache.batik.gvt.TextNode.selectAt(Unknown Source)
        at org.apache.batik.gvt.text.ConcreteTextSelector.checkSelectGesture(Unknown
        at org.apache.batik.gvt.text.ConcreteTextSelector.mousePressed(Unknown
        at org.apache.batik.swing.gvt.TextSelectionManager$MouseListener.mousePressed(Unknown
        at org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(Unknown
        at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(Unknown
        at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown
        at org.apache.batik.gvt.event.AWTEventDispatcher.mousePressed(Unknown
        at org.apache.batik.swing.svg.JSVGComponent$SVGListener$13.run(Unknown
        at org.apache.batik.util.RunnableQueue.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:619)

I'd ask for more feedback for Batik developers in order to check for
possible issues in the test case itself and/or to confirm if this
should go to the bug tracker [1].

Unrelated to the report, by further analyzing what's going on, I've
noticed you are relying on adjacent DOM nodes and therefore your code
is not prepared to handle white space nodes (typically used in
properly indented XML). I'd seriously suggest taking a look at DOM 2
node list utilities such as getElementsByTagNameNS [2], in order to
fetch only the intended sets of nodes. ;-)

Best regards,
 Helder Magalhães

[1] https://issues.apache.org/bugzilla/buglist.cgi?query_format=specific&bug_status=__open__&product=Batik
[2] http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-getElBTNNS

View raw message