什么是构造接口`google.maps.Icon` [英] What is the construct interface `google.maps.Icon`
问题描述
Google地图V3 JS API 的文档似乎没有给出 google.maps.Icon
构造的接口。我发现一个带有 MarkerImage
的例子,现在似乎不推荐使用它。
我如何创建图标并将其分配给标记?例如(未测试/不工作):
var icon = new google.maps.Icon(path,
新的google.maps.Size(32,32),//大小
新的google.maps.Point(0,32),//在精灵中的偏移
null,//定位
) ;
我看到了文档,但是如果该类没有看到示例用法!
没有google.maps.Icon的构造函数,它是一个像MapOptions , MarkerOptions , PolygonOptions 等。
<你可以像这样使用它:
var icon = {
anchor:new Point(...),
url:myurl
// etc ..
};
The docs of Google Maps V3 JS API does not seem to give the interface of the construct of google.maps.Icon
. I found an example with MarkerImage
, which seems to be deprecated now.
So, what are the possible google.maps.Icon
construct parameters and what is their order? How to define icon size, icon offset in sprite, icon anchor, etc?
Edit:
How would I create an icon and assign it to a marker? Eg (not tested/does not work):
var icon = new google.maps.Icon(path,
new google.maps.Size(32, 32), // size
new google.maps.Point(0, 32), // offset in sprite
null, // anchor
);
I do see the docs but I do not see example usage if that class!
There is no constructor for the google.maps.Icon, it is an anonymous javascript object like MapOptions, MarkerOptions, PolygonOptions, etc.
You use it like this:
var icon = {
anchor: new Point(...),
url: "myurl"
// etc..
};
这篇关于什么是构造接口`google.maps.Icon`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!