Re: Making mouse events less painful to deal with in SVG

On 4/30/09 5:38 AM, Doug Schepers wrote:
> We've talked about this issue before, and I raised an issue on it a 
> while back (ISSUE-2182):
>   http://www.w3.org/Graphics/SVG/WG/track/issues/2182

Okay, cool.

> I think it might be useful to return an object that contains more than 
> just the coordinates... there are times you might wish to get the CTM 
> and such, for more complex operations. 

So I definitely see the utility of being able to get the mouse event coordinates
in whatever coordinate system happens to be of interest to the author. To me it
makes sense that that interface should be on the mouse event in the form of
tellMeYourPositionInTheCoordinateSystemAt(element).

I don't (yet?) see the utility of making CTM (or other TM) information available
from the event though. Providing TM information from A to B raises the question,
what is A, and what is B. I'd assume that A would be the current event target,
but I'm not sure what B should be. Say you have SVG that's inline in HTML, which
is embedded by an <iframe> which is in HTML in a <foreignObject>, thit's
in...you get the idea. Whatever choice you make for B, it seems to me that it's
going to be the wrong choice for some use cases. Besides that, I think transform
information is better obtained from elements, not the event. From the event you
know the event target, and from that you can get the transform to the coordinate
system of interest to you using getTransformToElement, all the way up to the
coordinate system established by the document element. That's not quite up to
the client area, but I think that last missing piece could be added in by
defining that to be what getTransformToElement returns to if you pass in null.
Thoughts? Anyway, if you think TM information would be useful on the event, can
you elaborate.

Can you also elaborate on the "and such"? I'm not sure what else you'd want on
the event.

> But I'd be happy if we had 
> anything like this at all.  The current way to get a simple point, 
> especially when you are zoomed in, transformed, or viewBoxed, is insane.
> 
> I think that solving this for the author will lead to making clever apps 
> an order of magnitude easier. 

Agreed.

Jonathan

Received on Thursday, 30 April 2009 06:40:24 UTC