Re: [svg-developers] Re: click coordinates not of object

2010-11-22 Thread Erik Dahlstrom
On Sat, 20 Nov 2010 16:37:57 +0100, Kenneth N nelli...@verizon.net wrote:

 --- In svg-developers@yahoogroups.com, Holger Jeromin mailgm...@...  
 wrote:

 Narendra Sisodiya schrieb am 20.11.2010 05:36:
...
 offsetX is only available in opera, safari, chrome.
 layerX is available in safari, chrome, firefox
 clientx is available in all: opera, chrome, safari, firefox and adobe
 svg viewer
 pageX is available in all browsers (no adobe plugin) and is independant
 from the scrolling.

 But the problem is still that the offset of
 document.getElementById(grid) compared to the page is apparently not
 available. This is really suprising to me. I have not found a solution.
...
 Thank you for your response. Another difference I just noticed is that  
 Safari responds to the onclick handler if anywhere in the viewBox is  
 clicked

Sounds like a Safari bug to me. The event must have a target element  
inside the g element to be able to hit the g element (through event  
bubbling) since the g itself has no geometry that can be clicked.

  whereas Firefox and Opera require you to click right on one of the  
 lines, so this is a separate problem to fix.

This ought to be one of the first things tought in SVG courses, event  
shields / event capturing regions - just put a rect inside the g element  
where you want the events to be captured. Or since you have a simple grid,  
put the eventlistener on the root element and then check the coordinates  
to see which gridsquare was hit.

Using your examples it could look like this for example:

...
g id=grid style=stroke: black stroke-width=.02
rect width=10 height=10 fill=white/
!-- horizontal lines --
line x1=0 y1=0 x2=10 y2=0 /
...

 And Opera's responses using offsetX/Y appear to be complete garbage!

Note: the spec that defines offsetX/Y and pageX,Y is still in an unstable  
state (working draft), http://www.w3.org/TR/cssom-view/. ClientX,Y is the  
only pair that is defined in a stable w3c specification (DOM Level 2  
Events),  
http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-MouseEvent. I'm  
pretty sure that the coordinate system of offsetX/Y are not in svg user  
units of the target element (unless it's the root element possibly), so if  
you're looking for that then you will have to convert them anyway.

 Anyway, I'm still open to ideas and offer links to the original version  
 (offsetXY) as well as links to versions using clientXY and pageXY.

 http://tinyurl.com/offsetXY-svg
 http://tinyurl.com/clientXY-svg
 http://tinyurl.com/PageXY-svg

Here are a few blogposts of mine that deal with the coordinate-space  
conversions you are struggling with:

   
http://my.opera.com/MacDev_ed/blog/2010/02/01/how-to-get-all-svg-elements-intersected-by-a-given-rectangle
   http://my.opera.com/MacDev_ed/blog/getting-screen-boundingboxes-in-svg
   
http://my.opera.com/MacDev_ed/blog/2009/01/21/getting-boundingbox-of-svg-elements

I tend to go with clientX,Y since there are built-in methods[1][2] that  
allow rather easy transformation (ok, i would like it to be easier still,  
but it's not that hard to hide the tricky bits in a script utility  
function) to the right coordinate space, see e.g the example in the second  
example above. Unless you expect document scrolling or if you have svg  
inline inside an (X)HTML document then clientX,Y should be sufficient for  
all cases. A combination (or an alternative [3]) can be used for the other  
cases. In general if you have a viewBox and your viewport (defined by the  
container, usually html/css) is not using the same aspect ratio then you  
will need to transform coordinates.

Cheers
/Erik

[1] http://www.w3.org/TR/SVG11/types.html#InterfaceSVGLocatable
[2] http://www.w3.org/TR/SVG11/coords.html#InterfaceSVGMatrix
[3] http://xn--dahlstrm-t4a.net/svg/examples/FixedPositionGroupInScript.svg

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed




-
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my 
membership
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)

* To change settings via email:
svg-developers-dig...@yahoogroups.com 
svg-developers-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
svg-developers-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



[svg-developers] Re: click coordinates not of object

2010-11-22 Thread Kenneth Nellis
I appreciate the responses I got to this issue. Thank you!
BTW, Erik, the SVG cartoon [1] on your personal blog page [2] doesn't  
render in Mac/Safari 4.1.3 or Mac/Firefox 3.6.12; instead the  
browsers diagnose XML parsing errors. I suspect either they don't  
recognize the compressed SVG format (.svgz) of the cartoon or maybe  
the type specification (image/svg+xml) should be different for .svgz  
files? FWIW.
—Ken Nellis
[1] http://files.myopera.com/MacDev_ed/files/ 
hittesting_public_domain.svgz
[2] http://my.opera.com/macdev_ed





-
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my 
membership
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)

* To change settings via email:
svg-developers-dig...@yahoogroups.com 
svg-developers-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
svg-developers-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



[svg-developers] Re: click coordinates not of object

2010-11-22 Thread Robert Longson
 BTW, Erik, the SVG cartoon [1] on your personal blog page [2] doesn't  
 render in Mac/Safari 4.1.3 or Mac/Firefox 3.6.12; instead the  
 browsers diagnose XML parsing errors. I suspect either they don't  
 recognize the compressed SVG format (.svgz) of the cartoon or maybe  
 the type specification (image/svg+xml) should be different for .svgz  
 files? FWIW.

Firefox and Safari do support compressed svg files but they must be served with 
Content-Encoding: gzip set in the http response.

Best regards

Robert.







-
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my 
membership
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)

* To change settings via email:
svg-developers-dig...@yahoogroups.com 
svg-developers-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
svg-developers-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/



Re: [svg-developers] US Map with US Census data

2010-11-22 Thread Barend Köbben
Nice.

cartographer grumble
  don't use a value map (choropleth) for absolute values  (data of measurement 
level ratio),
  Its perception properties makes for confused readers...
/cartographer grumble

:-) as an example of the power of SVG (for which I am sure it was meant), it is 
of course excellent. Note that on a display with portrait ratio the map is 
obscuring the title.

Yours,

--
Barend Köbben (Senior Lecturer)
ITC - University of Twente, Faculty of Geo-Information
Science and Earth Observation
PO Box 217, 7500AE Enschede (The Netherlands)
+31-(0)53 4874 253



From: ddailey ddai...@zoominternet.netmailto:ddai...@zoominternet.net
Reply-To: 
svg-developers@yahoogroups.commailto:svg-developers@yahoogroups.com 
svg-developers@yahoogroups.commailto:svg-developers@yahoogroups.com
Date: Sun, 21 Nov 2010 22:12:52 +0100
To: svg-developers@yahoogroups.commailto:svg-developers@yahoogroups.com 
svg-developers@yahoogroups.commailto:svg-developers@yahoogroups.com
Subject: [svg-developers] US Map with US Census data



Here's a little something I cobbled together in the past couple of days.
http://granite.sru.edu/~ddailey/usmap.svg

It works in Opera, Firefox, Chrome and Safari, but not in ASV(IE). I've not 
tested it in IE9, but would be interested to know if it works there.

I took a gnu-licensed SVG map from Wikimedia Commons and then wrote AJAX and 
JavaScript and PHP to take data from the US Census bureau's 82 variable set, 
shading the states accordingly. After a variable is chosen then you can 
mouseover each state to see its numeric value on that variable.

Since it borrows from something with a GNU license I suppose you can't make 
profit out of it, but feel free to improve and share!

cheers
David

[Non-text portions of this message have been removed]




Faculty of Geo-Information Science and Earth Observation (ITC)
University of Twente
Chamber of Commerce: 50130536

E-mail disclaimer
The information in this e-mail, including any attachments, is intended for the 
addressee only. If you are not the intended recipient, you are hereby notified 
that any disclosure, copying, distribution or action in relation to the content 
of this information is strictly prohibited. If you have received this e-mail by 
mistake, please delete the message and any attachment and inform the sender by 
return e-mail. ITC accepts no liability for any error or omission in the 
message content or for damage of any kind that may arise as a result of e-mail 
transmission.


[Non-text portions of this message have been removed]





-
To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com
-or-
visit http://groups.yahoo.com/group/svg-developers and click edit my 
membership
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/

* Your email settings:
Individual Email | Traditional

* To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)

* To change settings via email:
svg-developers-dig...@yahoogroups.com 
svg-developers-fullfeatu...@yahoogroups.com

* To unsubscribe from this group, send an email to:
svg-developers-unsubscr...@yahoogroups.com

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/