我想限制KML文件中所有图标的可点击区域,我对如何实现这一点感到有点困惑。图标都是典型风格的指针,我想将可点击区域限制在指针顶部所包含的圆圈内。图标是19x32,所以我想想我想要一个从顶部居中9px的圆,从左边9px,半径为9px。如果geoxml3会这样做,我想这将在解析器对象中指定,尽管它可能在KML文件的IconStyle中。如果实际上是在解析器对象中,我还没有找到正确的语法。显然不是:
var blues = new geoXML3.parser({map: map, singleInfoWindow: true, zoom: false, markerOptions: {shape: {type:circle, coords: [9px,9px,9px]}}});
blues.parse('allbluesdance.kml');
所以请理顺我。
谢谢, 德鲁
答案 0 :(得分:0)
GeoXml3的markerOptions选项恰好是Google Maps Javascript API v3 markerOptions对象。
您的图标为49x32 pixels,center of the circle is defined from the top left,因此您可能希望中心为24,9,半径为9:
var blues = new geoXML3.parser({
map: map,
singleInfoWindow: true,
suppressDirections: true,
markerOptions: {
shape: {
type: 'circle',
coords: [24,9,9]
}
},
zoom: false
});
来自documentation on Complex Icons:
// Shapes define the clickable region of the icon.
// The type defines an HTML <area> element 'poly' which
// traces out a polygon as a series of X,Y points. The final
// coordinate closes the poly by connecting to the first
// coordinate.
var shape = {
coords: [1, 1, 1, 20, 18, 20, 18 , 1],
type: 'poly'
};
HTML area circle shape,看起来如果删除了&#34; px&#34; (文档说明了一组数字),除了它位于图标的左侧。