Wasn't it Esa who wrote:
>
>Not especially about this version but in the legendary series of
>Syntax Changes.
>
>I made some experiments with GIcon().sprite property. I did not manage
>to make sprite.width or sprite.height to do anything. Instead I
>happily discovered sprite.top property which wakes up the sprite.
>
>icon.sprite.image = "mysprite.png";
>icon.sprite.top = 42;
>
>Those lines make the marker icon file "mysprite.png" to be shown 42 px
>from top of the image.
>The viewport (size of the visible icon) is still defined by
>GIcon().iconSize property.
>
>Note that the type of sprite.top property is number. A string like
>'42px' does not work.
>
>Test page:
>http://esa.ilmari.googlepages.com/sprite.htm

You're right.

sprite.width and sprite.height are ignored if you already have 
icon.iconSize.

I had also missed the .top parameter.

Also, if you use sprite, the image is *clipped* to the specified size 
rather than being *scaled* to the specified size as it would be 
normally.


The whole thing now makes sense. It makes it possible to store several 
icon images in the same image file, and use them like this:
    http://econym.org.uk/gmap/example_sprites.htm

If you're going to be using a lot of sprite images, it's more efficient 
to fetch one 7kb image file than ten 0.7kb image files, because you only 
have to connect to the file server once. For small files, the Internet 
latency may take nearly as long as the transmission of the data.

A quick test on http://econym.org.uk/gmap/example_sprites.htm
shows that the time between sending the request for the sprites.png file 
and receiving the first byte was 209ms, and the time taken from the 
first byte to the last byte was 367ms, for a total of 576ms.

Ten smaller files would have each taken a similar amount of time to 
receive the first byte, but about a tenth of the time to receive the 
data, for a total of 2457ms. In normal circumstances, those fetches 
would be performed simultaneously, but when loading a Google Map, all 
the other channels could well be busy fetching map tiles.

-- 
http://econym.org.uk/gmap
The Blackpool Community Church Javascript Team


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to