Marker cursor does not change

1,984 views
Skip to first unread message

Yves

unread,
Mar 18, 2011, 3:56:44 PM3/18/11
to Google Maps JavaScript API v3
I can define whatever cursor and shape I want for a Marker, it just
doesn't change the cursor to anything than the default arrow. What's
wrong here? I've added a click handler for my Markers so that the user
is redirected to a detail view for that marker. A "pointing hand"
cursor would be very appreciated here.

I set the following properties of the Marker: position, title (the
tooltip appears only sporadically), map, icon, shadow, cursor, shape,
zIndex

Firefox 3.6.latest on Windows XP.

Rossko

unread,
Mar 18, 2011, 6:20:52 PM3/18/11
to Google Maps JavaScript API v3
> What's wrong here?

Where? i.e. where is your demonstration of your problem?

If you want a wild guess, I would think you haven't set the shape
property of your icon properly.

Yves

unread,
Mar 29, 2011, 4:21:30 PM3/29/11
to Google Maps JavaScript API v3
The shape property is correctly set to the rectangle [0, 0, 20, 34]
which corresponds to the size of the icon image.

I'll work on getting a public example online. All my current
development takes place in a yet non-public site and I need to create
a copy of the problem every time something doesn't work here... :-(

Yves

unread,
Mar 29, 2011, 4:30:51 PM3/29/11
to Google Maps JavaScript API v3
Okay, let's look at this page:

http://unclassified.de/tmp/maptest/cursor.html

The marker should have a pointer (hand) cursor, but it doesn't.

en4ce

unread,
Mar 29, 2011, 5:12:03 PM3/29/11
to Google Maps JavaScript API v3
ermmm, of cause its not "// <-- THIS IS NOT REGARDED!" because you say
something like: when ever a marker is created change the cursor....

do it that way and it will work:

var myOptions = {
zoom: VAR something,
center: myLatlng,
streetViewControl: true,
draggableCursor:'url(images/cursor.png) 16 16, default', <---
here is the important part
}

map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);

--Enrico

geoco...@gmail.com

unread,
Mar 29, 2011, 5:15:45 PM3/29/11
to Google Maps JavaScript API v3
Have you tried using a MarkerShape for the shape (as specified in the
documentation)?

shape MarkerShape Image map region definition used for drag/click.

Currently you are using an anonymous object, not a MarkerShape. Don't
know if that will fix your problem or not.

-- Larry

Rossko

unread,
Mar 29, 2011, 5:26:25 PM3/29/11
to Google Maps JavaScript API v3
> http://unclassified.de/tmp/maptest/cursor.html
>
> The marker should have a pointer (hand) cursor, but it doesn't.

I get a pointy-finger cursor in FF2, and a tooltip/title, where I'd
expect one. Must be fairly browser specific?

marker = new google.maps.Marker({
...
shape: { type: "rectangle", ...
Have you tried 'rect' , as per the docs?

geoco...@gmail.com

unread,
Mar 29, 2011, 5:43:10 PM3/29/11
to Google Maps JavaScript API v3
On Mar 29, 2:15 pm, "geocode...@gmail.com" <geocode...@gmail.com>
wrote:
> On Mar 29, 1:30 pm, Yves <yves.goer...@gmail.com> wrote:
>
> > Okay, let's look at this page:
>
> >http://unclassified.de/tmp/maptest/cursor.html
>
> > The marker should have a pointer (hand) cursor, but it doesn't.
>
> Have you tried using a MarkerShape for the shape (as specified in the
> documentation)?

Oops. It is an anonymous object. Sorry about that.
Changing it to "rect" rather that "rectangle" (as documented)

fixes it in a local copy.

-- Larry

Yves

unread,
Apr 1, 2011, 12:14:36 PM4/1/11
to Google Maps JavaScript API v3
How is MarkerShape supposed to be used? It's not a constructor,
according to FireBug, and it doesn't have a constructor, according to
the Google Docs. Is MarkerShape only an object template, which I
perfectly matched already?

Rossko

unread,
Apr 1, 2011, 4:33:46 PM4/1/11
to Google Maps JavaScript API v3
Here are the docs
http://code.google.com/apis/maps/documentation/javascript/reference.html#MarkerShape
Here is an example
http://code.google.com/apis/maps/documentation/javascript/overlays.html#ComplexIcons

You're using it alright, except for the type: which isn't one of the
types given in the docs

Yves

unread,
Apr 2, 2011, 3:19:38 AM4/2/11
to Google Maps JavaScript API v3
On 1 Apr., 22:33, Rossko <ros...@culzean.clara.co.uk> wrote:
> > How is MarkerShape supposed to be used? It's not a constructor,
> > according to FireBug, and it doesn't have a constructor, according to
> > the Google Docs. Is MarkerShape only an object template, which I
> > perfectly matched already?
>
> Here are the docshttp://code.google.com/apis/maps/documentation/javascript/reference.h...
> Here is an examplehttp://code.google.com/apis/maps/documentation/javascript/overlays.ht...
>
> You're using it alright, except for the type: which isn't one of the
> types given in the docs

The example does the same thing as I do:

var shape = {
coord: [1, 1, 1, 20, 18, 20, 18 , 1],
type: 'poly'
};

And the API reference still does not explain how the MarkerShape
*type* is used. It cannot be instantiated. So I interpret the
documentation as a blueprint of how my (anonymous) object should be
built.

So what's the point?

Rossko

unread,
Apr 2, 2011, 6:09:08 AM4/2/11
to Google Maps JavaScript API v3
> So what's the point?

In the example you are showing us, you have
shape: { type: "rectangle", ...
The docs list only three values for type: and that is not one of them.

The docs suggest using
shape: { type: "rect", ...

Yves

unread,
Apr 3, 2011, 5:37:32 AM4/3/11
to Google Maps JavaScript API v3
My version of the docs [1] treats "rect" synonymous to "rectangle".
But that must be an error. It really works with "rect" now that I knew
what I had to change.

Since this is already the second {error that kept me from working} (is
there a word for it?) in the German docs, is there a way how I can
always automatically switch to the English version of it? Right now
I'm taken directly to the de version when I open it.

[1] http://code.google.com/intl/de/apis/maps/documentation/javascript/reference.html#MarkerShape

Yves

unread,
Apr 3, 2011, 5:48:12 AM4/3/11
to Google Maps JavaScript API v3
Okay, the cursor is now changed - as long as the map is draggable. I
have updated my online example so that the map is not draggable. Now
the cursor is not updated anymore! Is that by intention?

Yves

unread,
May 17, 2011, 5:23:49 PM5/17/11
to Google Maps JavaScript API v3
Still anybody here? It's still broken. :-(

The cursor is only changed to anything if the map is draggable. If it
is not draggable, the cursor is the default arrow everywhere.

Rossko

unread,
May 17, 2011, 5:55:42 PM5/17/11
to Google Maps JavaScript API v3
> The cursor is only changed to anything if the map is draggable. If it
> is not draggable, the cursor is the default arrow everywhere.

I can see that behaviour in FF, but in IE it works as expected with
cursor change and tooltip over the marker. That suggests a link to
the different rendering technologies. Have a try with marker option
optimized:false

Yves

unread,
May 18, 2011, 3:19:34 AM5/18/11
to Google Maps JavaScript API v3
On 17 Mai, 23:55, Rossko <ros...@culzean.clara.co.uk> wrote:
> I can see that behaviour in FF, but in IE it works as expected with
> cursor change and tooltip over the marker.  That suggests a link to
> the different rendering technologies.

I cannot see it working in both Firefox 4.0.1 and Internet Explorer
9.0 on Windows XP.

> Have a try with marker option optimized:false

That seems to work. What does this undocumented option mean?

Rossko

unread,
May 18, 2011, 4:25:54 AM5/18/11
to Google Maps JavaScript API v3
> That seems to work. What does this undocumented option mean?

aha ... it is documented in the English docs.
Says
"Optimization renders many markers as a single static element.
Optimized rendering is enabled by default. Disable optimized rendering
for animated GIFs or PNGs, or when each marker must be rendered as a
separate DOM element (advanced usage only)."

See
http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/712af9174695ec91/0ee5f885b8db2ccb?lnk=gst&q=optimized#0ee5f885b8db2ccb
for more background.

I suspect you must either use optimized:false -or- use your own
mouseover/mouseout listeners to get the effect you want.

Enoch Lau

unread,
May 18, 2011, 1:49:10 PM5/18/11
to google-map...@googlegroups.com
This appears to be the same issue as reported here: http://code.google.com/p/gmaps-api-issues/issues/detail?id=3120
Reply all
Reply to author
Forward
0 new messages