Pointer Events in SVG

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Pointer Events in SVG

Daniel Herzog
Hi,

just to quickly introduce myself, I work at Vodafone and contributed to the WICD Testsuite.

I would like to know, is there a way to get the pointer-position in reference to an SVGs coordinate-system? Please take a look at the following testfile (with Opera 9.23, Firefox2, Safari3):
<a href="http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml

The blue rect is part of an SVG that has a viewBox of only 20 x 6, but the whole thing is in a container much bigger and is therefore scaled up. When hovering the SVG you see some properties of mouse-events below it, but none of them quite fit the SVGs coordinate system. The maximum x-values for that would be 20 then. I think it would be important to have an easy way for getting to these values, just thinking of a simple mousefollow, or slider controls, for example.

Thanks a lot,
Daniel<a href="http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
Reply | Threaded
Open this post in threaded view
|

Re: Pointer Events in SVG

Jonathan Chetwynd

Daniel,

Please could you provide your expectations for limit values?
ie four corners of blue box.

The grouping of the data doesn't seem obvious, x,y....

in OS X,

Safari displays results, Mozilla and Opera do not.
I am using nightlies which may effect results.

regards

Jonathan Chetwynd
Accessibility Consultant on Media Literacy and the Internet



On 24 Oct 2007, at 16:15, Daniel Herzog wrote:

Hi,

just to quickly introduce myself, I work at Vodafone and contributed  
to the WICD Testsuite.

I would like to know, is there a way to get the pointer-position in  
reference to an SVGs coordinate-system? Please take a look at the  
following testfile (with Opera 9.23, Firefox2, Safari3):
http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml

The blue rect is part of an SVG that has a viewBox of only 20 x 6,  
but the whole thing is in a container much bigger and is therefore  
scaled up. When hovering the SVG you see some properties of mouse-
events below it, but none of them quite fit the SVGs coordinate  
system. The maximum x-values for that would be 20 then. I think it  
would be important to have an easy way for getting to these values,  
just thinking of a simple mousefollow, or slider controls, for example.

Thanks a lot,
Daniel


Reply | Threaded
Open this post in threaded view
|

Re: Pointer Events in SVG

Dave Raggett
In reply to this post by Daniel Herzog

You can readily get the screen coordinates and transform them back
into the SVG coordinate system, e.g.

function locateEvent(event)
{
   var target = evt.target;
   var m = target.getScreenCTM();
   var pt = document.documentElement.createSVGPoint();
   pt.x = evt.clientX;
   pt.y = evt.clientY;
   pt = pt.matrixTransform(m.inverse());
   return pt;
}

But whilst getScreenCTM() and inverse() are available in SVGT 1.2,
it seems that createSVGPoint() and matrixTransform() aren't, at
least based upon searching through:

     http://www.w3.org/TR/SVGMobile12/svgudom.html

Am I missing something, or this is intentional?

I agree that it would be nice to have an easier way to getting the
event location in the SVG coordinate system.

  Dave Raggett <[hidden email]> http://www.w3.org/People/Raggett

On Wed, 24 Oct 2007, Daniel Herzog wrote:

> Hi,
>
> just to quickly introduce myself, I work at Vodafone and contributed to the
> WICD Testsuite.
>
> I would like to know, is there a way to get the pointer-position in
> reference to an SVGs coordinate-system? Please take a look at the following
> testfile (with Opera 9.23, Firefox2, Safari3):
> http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml
>
> The blue rect is part of an SVG that has a viewBox of only 20 x 6, but the
> whole thing is in a container much bigger and is therefore scaled up. When
> hovering the SVG you see some properties of mouse-events below it, but none
> of them quite fit
> the SVGs coordinate system. The maximum x-values for that would be 20 then.
> I think it would be important to have an easy way for getting to these values,
just thinking of a simple mousefollow, or slider controls, for example.
>
> Thanks a lot,
> Daniel
> <http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml>
>

Reply | Threaded
Open this post in threaded view
|

Re: Pointer Events in SVG

Daniel Herzog
In reply to this post by Jonathan Chetwynd
Jonathan,

the blue box has a width of 20 and a height of 6, matching the viewBox. Not sure if that was the question, sorry. It runs on all mentioned browsers on OSX, at least for me.

Regards,
Daniel

2007/10/25, "~:'' ありがとうございました。" <[hidden email]>:
Daniel,

Please could you provide your expectations for limit values?
ie four corners of blue box.

The grouping of the data doesn't seem obvious, x,y....

in OS X,

Safari displays results, Mozilla and Opera do not.
I am using nightlies which may effect results.

regards

Jonathan Chetwynd
Accessibility Consultant on Media Literacy and the Internet



On 24 Oct 2007, at 16:15, Daniel Herzog wrote:

Hi,

just to quickly introduce myself, I work at Vodafone and contributed
to the WICD Testsuite.

I would like to know, is there a way to get the pointer-position in
reference to an SVGs coordinate-system? Please take a look at the
following testfile (with Opera 9.23, Firefox2, Safari3):
http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml

The blue rect is part of an SVG that has a viewBox of only 20 x 6,
but the whole thing is in a container much bigger and is therefore
scaled up. When hovering the SVG you see some properties of mouse-
events below it, but none of them quite fit the SVGs coordinate
system. The maximum x-values for that would be 20 then. I think it
would be important to have an easy way for getting to these values,
just thinking of a simple mousefollow, or slider controls, for example.

Thanks a lot,
Daniel

Reply | Threaded
Open this post in threaded view
|

Re: Pointer Events in SVG

Daniel Herzog
In reply to this post by Dave Raggett
Hi,

thank you very much! But still, even if its technically doable with some lines of script, I still think its an unnecessary burden for a developer, since its needed for very simple use-cases. Plus some of the features used in this are not included in SVGT 1.2, I agree.

Regards,
Daniel


2007/10/25, Dave Raggett <[hidden email]>:
You can readily get the screen coordinates and transform them back
into the SVG coordinate system, e.g.

function locateEvent(event)
{
   var target = evt.target;
   var m = target.getScreenCTM();
   var pt = document.documentElement.createSVGPoint();
   pt.x = evt.clientX;
   pt.y = evt.clientY;
   pt = pt.matrixTransform(m.inverse());
   return pt;
}

But whilst getScreenCTM() and inverse() are available in SVGT 1.2,
it seems that createSVGPoint() and matrixTransform() aren't, at
least based upon searching through:

     http://www.w3.org/TR/SVGMobile12/svgudom.html

Am I missing something, or this is intentional?

I agree that it would be nice to have an easier way to getting the
event location in the SVG coordinate system.

  Dave Raggett <[hidden email]> http://www.w3.org/People/Raggett

On Wed, 24 Oct 2007, Daniel Herzog wrote:

> Hi,
>
> just to quickly introduce myself, I work at Vodafone and contributed to the
> WICD Testsuite.
>
> I would like to know, is there a way to get the pointer-position in
> reference to an SVGs coordinate-system? Please take a look at the following
> testfile (with Opera 9.23, Firefox2, Safari3):
> http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml
>
> The blue rect is part of an SVG that has a viewBox of only 20 x 6, but the
> whole thing is in a container much bigger and is therefore scaled up. When
> hovering the SVG you see some properties of mouse-events below it, but none
> of them quite fit
> the SVGs coordinate system. The maximum x-values for that would be 20 then.
> I think it would be important to have an easy way for getting to these values,
just thinking of a simple mousefollow, or slider controls, for example.
>
> Thanks a lot,
> Daniel
> < http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml>
>



--
Daniel Herzog
Linienstr. 5
40227 Düsseldorf
Umsatzsteuer ID: 133/5127/1334
0176 / 61 10 58 34
Reply | Threaded
Open this post in threaded view
|

Re: Pointer Events in SVG

Andreas Neumann
In reply to this post by Dave Raggett

I raised an issue about these missing methods with the SVG working
group. We will discuss whether we can add these methods back into the
uDom. I personally agree that these methods are important. Some people
weren't present at the SVG telcon, so I don't know if there was any
reasoning on why these methods weren't included.

Andreas

Dave Raggett wrote:

>
> You can readily get the screen coordinates and transform them back
> into the SVG coordinate system, e.g.
>
> function locateEvent(event)
> {
>   var target = evt.target;
>   var m = target.getScreenCTM();
>   var pt = document.documentElement.createSVGPoint();
>   pt.x = evt.clientX;
>   pt.y = evt.clientY;
>   pt = pt.matrixTransform(m.inverse());
>   return pt;
> }
>
> But whilst getScreenCTM() and inverse() are available in SVGT 1.2, it
> seems that createSVGPoint() and matrixTransform() aren't, at least
> based upon searching through:
>
>     http://www.w3.org/TR/SVGMobile12/svgudom.html
>
> Am I missing something, or this is intentional?
>
> I agree that it would be nice to have an easier way to getting the
> event location in the SVG coordinate system.
>
>  Dave Raggett <[hidden email]> http://www.w3.org/People/Raggett
>
> On Wed, 24 Oct 2007, Daniel Herzog wrote:
>
>> Hi,
>>
>> just to quickly introduce myself, I work at Vodafone and contributed
>> to the
>> WICD Testsuite.
>>
>> I would like to know, is there a way to get the pointer-position in
>> reference to an SVGs coordinate-system? Please take a look at the
>> following
>> testfile (with Opera 9.23, Firefox2, Safari3):
>> http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml
>>
>> The blue rect is part of an SVG that has a viewBox of only 20 x 6,
>> but the
>> whole thing is in a container much bigger and is therefore scaled up.
>> When
>> hovering the SVG you see some properties of mouse-events below it,
>> but none
>> of them quite fit
>> the SVGs coordinate system. The maximum x-values for that would be 20
>> then.
>> I think it would be important to have an easy way for getting to
>> these values,
> just thinking of a simple mousefollow, or slider controls, for example.
>>
>> Thanks a lot,
>> Daniel
>> <http://dev.danielherzog.de/wicd/pointerPositionTesting.xhtml>
>>
>


--
--
----------------------------------------------
Andreas Neumann
Institute of Cartography
ETH Zurich
Wolfgang-Paulistrasse 15
CH-8093  Zurich, Switzerland

Phone: ++41-44-633 3031, Fax: ++41-44-633 1153
e-mail: [hidden email]
www: http://www.carto.net/neumann/
SVG.Open: http://www.svgopen.org/
Carto.net: http://www.carto.net/