Denis Bohm wrote:
I'm trying to track the cursor movement across some text to highlight the
character that the cursor is over.  In my svg I have a text element that
contains a tspan element.  I tried the following on mousemove for the text,
but always get -1 for the character index:

This I believe is because you should use getClientX/Y not screenX/Y. Rereading the spec it is unclear which coordinate system getScreenCTM should transform to (clientX/Y has 0,0 at the upper left of the canvas, screenX/Y has 0,0 at the upper left of the physical device).

   I will send a question to the SVG Working Group on this to get a clarification
of what is the correct answer.

        SVGRect extent = parent.getExtentOfChar(0);
        System.out.println(extent.getX() + " " + extent.getY());

So I tried the following, which also gives -1:

        point.setX(extent.getX() + 1);
        point.setY(extent.getY() + 1);
        index = parent.getCharNumAtPosition(point);
        System.out.println(index);

Any idea what I might be doing wrong?

There was a bug in getExtentOfChar which I just fixed in CVS. You can check the commit message to get the patches, or just use CVS to update.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to