I've attached a small test case to show the problem.  If I bring the cursor
down the window until it touches the top of the text then I see negative
client coordinates printed out.  (The zero point on the Y axis seems like it
may be at the baseline of the text.)  Do you see the same?

----- Original Message ----- 
From: "Thomas DeWeese" <[EMAIL PROTECTED]>
To: "Batik Users" <[EMAIL PROTECTED]>
Sent: Wednesday, August 20, 2003 10:55 AM
Subject: Re: getCharNumAtPosition trouble


> Denis Bohm wrote:
> > I checked out the lastest CVS and am trying that.  The root of the
problem
> > seems to be that I'm getting negative numbers from MouseEvent.getClientY
> > when I point at the center of the text.  This seems wrong.  Shouldn't I
only
> > get positive values since they are with respect to the upper left of the
> > canvas?
>
>    If this is before you apply the matrix yes you should only get positive
> values.  There must be something odd about your setup as I have never seen
> this happen.  I'm sure a standalone version of the problem would help
immensely.
>
> > BTW:  Here is the SVG that I'm using:
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
> > "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"; [
> > ]>
> > <svg width="220" height="60" viewBox="0 0 220 60">
> >     <text id="expression.0" transform="matrix(1 0 0 1 0 20)">if (true or
> > false) then {&apos;foo&apos;} else {&apos;bar&apos;,
&apos;zip&apos;}</text>
> >     <text id="result.0" transform="matrix(1 0 0 1 0 40)">result</text>
> > </svg>
>
>      Nothing looks particularly odd (other than the use of matrix rather
> than 'translate(0,20)' or a simple y="20" on the text - but you probably
just
> cribbed from Illustrator :)
>
> > ----- Original Message ----- 
> > From: "Thomas DeWeese" <[EMAIL PROTECTED]>
> > To: "Batik Users" <[EMAIL PROTECTED]>
> > Sent: Wednesday, August 20, 2003 5:03 AM
> > Subject: Re: getCharNumAtPosition trouble
> >
> >
> >
> >>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]
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

<<attachment: TextTest.svg>>

Attachment: TextTest.java
Description: Binary data

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

Reply via email to