You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Julleofa <ju...@yahoo.com> on 2009/03/31 09:03:09 UTC

text/tspan mouse events change when zoomed in

Hi,

I have created SVG that has some text elements in it. Under text element I
have several tspan elements. Initially only one tspan element is visible,
I’m using the visibility attribute for this, but when user moves mouse over
the visible tspan element (onmouseover) this tspan element is hidden and
others are made visible. When mouse is moved away (onmouseout) this element
is made visible again and others are hidden.

Everything works as supposed until I zoom in to the SVG. Mouseover works
fine again but once I mouseout nothing happens. If I mouseover again the
mouseout script is run. So every other time I mouseover the mouseover script
is run and every other time mouseout script is run.

This is quite baffling. Since I couldn’t find any errors on my code I did
some experimenting. I created script that changes elements fill attribute.
Then I attached this script to path elements mouseover and mouseout events.
To my supprise this worked correctly both before zooming and during zooming.

To be certain I attached same script to previously mentioned text element.
When not zoomed in everything worked fine. After zooming in neither
mouseover nor mouseout had any effect to text. By chance I clicked on the
text and then the script was run.

To me it seems zooming in messes up text and tspan elements event handling.
Has anybody else ever heard of his kind of strange behaviour? Is there any
way to fix this or go around it?

Thanks.

Juha

-- 
View this message in context: http://www.nabble.com/text-tspan-mouse-events-change-when-zoomed-in-tp22799472p22799472.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: text/tspan mouse events change when zoomed in

Posted by Helder Magalhães <he...@gmail.com>.
Hi everyone,

> 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].

A fix from Thomas, landed in revision 761228, fixed this issue.
Thanks, Thomas! :-)

Should something be inserted into the relevant change tracker
("CHANGES")? Specially for the "Fix mouse events on tspans." item,
which has no associated bug... ;-)

@Juha
The fix should be available in nightly builds [1] by tomorrow. ;-)

Regards,
 Helder

[1] http://arc.mcc.id.au/batik-nightly/

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: text/tspan mouse events change when zoomed in

Posted by Helder Magalhães <he...@gmail.com>.
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"):

java.lang.NullPointerException
        at org.apache.batik.gvt.renderer.StrokingTextPainter.hitTest(Unknown
Source)
        at org.apache.batik.gvt.renderer.BasicTextPainter.selectAt(Unknown
Source)
        at org.apache.batik.gvt.TextNode.selectAt(Unknown Source)
        at org.apache.batik.gvt.text.ConcreteTextSelector.checkSelectGesture(Unknown
Source)
        at org.apache.batik.gvt.text.ConcreteTextSelector.mousePressed(Unknown
Source)
        at org.apache.batik.swing.gvt.TextSelectionManager$MouseListener.mousePressed(Unknown
Source)
        at org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(Unknown
Source)
        at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(Unknown
Source)
        at org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(Unknown
Source)
        at org.apache.batik.gvt.event.AWTEventDispatcher.mousePressed(Unknown
Source)
        at org.apache.batik.swing.svg.JSVGComponent$SVGListener$13.run(Unknown
Source)
        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].


@Juha
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

Re: text/tspan mouse events change when zoomed in

Posted by Julleofa <ju...@yahoo.com>.
Hi Helder,

Here is some basic information about my system and software versions:
 - Windows XP Professional Version 2002, Service Pack 3
 - JDK was originally 6.0_07 but updated it to 6.0_13 and it didn't help.
 - Batik 1.7

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.

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.

http://www.nabble.com/file/p22820242/test.svg test.svg 

Juha
-- 
View this message in context: http://www.nabble.com/text-tspan-mouse-events-change-when-zoomed-in-tp22799472p22820242.html
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: text/tspan mouse events change when zoomed in

Posted by Helder Magalhães <he...@gmail.com>.
Hi Juha,

> Has anybody else ever heard of his kind of strange behaviour?

No, I've never heard of it. I've searched the bug database [1] but
didn't find anything related.


> Is there any way to fix this or go around it?

Well, attaching a reduced test case [1] (which apparently you have
already produced) would help. Also, please provide more information
such as Operating System, Java environment version and Batik version.
Finally, you may want to experiment with the trunk version from the
Subversion repository [3] to see if it was already fixed in the
meantime (assuming you are working with a release version). If you are
not comfortable with compiling Batik and/or working with SVN, you may
prefer a nightly build [4]).


Hope this helps,
 Helder


[1] https://issues.apache.org/bugzilla/buglist.cgi?query_format=specific&bug_status=__open__&product=Batik
[2] http://webkit.org/quality/reduction.html
[3] http://xmlgraphics.apache.org/batik/download.cgi#Subversion+repository
[4] http://arc.mcc.id.au/batik-nightly/

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org