Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cursor disappears in Google Maps application

This is really odd. After creating a Google Maps application using v3 of the API, sometimes the mouse cursor will disappear when I hover the cursor over the map. I have several controls outside of the map that I need to interact with. After I click on one of them and the map loses focus, the problem shows itself. Has anyone else had this happen? I tried setting the focus to the div where the map is but that didn't work.

like image 482
Douglas Starnes Avatar asked Jan 22 '12 08:01

Douglas Starnes


2 Answers

Short answer: preloading Google's hand cursor file solves this problem.

Detailed explanation: I was experiencing the same issue in Chrome on OS X, even after upgrading to 17.0.963.56 today. Other browsers and Chrome on windows were working fine.

The cursor was gone when moving from a custom element onto the map image. On the zoom controls and markers, the mouse was visible but it disappeared again when moving off them. Setting a CSS cursor:pointer for all divs under the map-element made the cursor visible too, but not in the correct style of course.

I checked the Google Maps DOM and found out Google was using a url cursor when over the map image: http://maps.gstatic.com/mapfiles/openhand_8_8.cur.

There's different ways of preloading this cursor image file. You could create a hidden image in your html: Or use jQuery to create an image element with the right src attribute.

Please let me know if this solves it for you too.

like image 93
Micros Avatar answered Oct 24 '22 12:10

Micros


What browser do You use? I met the same problem (chrome v.17.0.963.46 and mac os x v. 10.7.2 and v. 10.6.8). I developed extension for chrome and all was well until update chrome up to version 17.0.963.46. From that moment began having problems with cursor. But I noticed the same problem on "clear" google map - http://maps.google.com. I am thinking that it is the problem of this version of browser. For FireFox all ok. Read info by this link - may be it can help You: http://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20Mstone%20ReleaseBlock%20Area%20Feature%20Status%20Owner%20Summary&groupby=&sort=&id=113358

like image 22
user935714 Avatar answered Oct 24 '22 11:10

user935714