Google Maps API v3 draggableCursor options such as position

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-16 05:01:04

问题


This is a long shot, but I was wondering if there were any settings in Google Maps API v3 that would allow me to set where on my custom "draggableCursor" the tip/end (for lack of a better word) of the cursor should be. The default settings seem to be that the top left hand corner of the image is the cursor point, but I want it to be the bottom left hand side.

Here is my code so far:

map.setOptions({ draggableCursor: 'url(images/markers/you_marker.cur), default' });

回答1:


The hotspot for a cursor should be defined in the .cur file. It defaults to the top-left in the absence of any other position being specified. The API simply specifies which cursor file to use.

http://www.axialis.com/tutorials/what-is-a-cursor.html#t8 (other cursor design programs are available).




回答2:


Andrew Leach's answer is correct in that the cursor hotspot is defined in the .cur file, except Google Maps won't recognize it.

For a custom cursor in Google Maps you can change the hotspot by setting the coordinates in a CSS rule:

map.setOptions({ draggableCursor: 'url(images/markers/you_marker.cur) 16 16, default' });


来源:https://stackoverflow.com/questions/10687213/google-maps-api-v3-draggablecursor-options-such-as-position

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!