SVG路径忽略锚点

时间:2014-06-20 19:02:20

标签: google-maps svg

虽然我认为“移动”是绝对的而不是相对的,但我的图标的anchor:被忽略了。无论我在代码中为anchor:提供什么值,SVG标记都保持不变。更具体地说,销钉位于它们应该位于的下方和右侧。是因为我使用贝塞尔曲线,还是什么?

function createMarker(point,text,ID,color,label,pinage) { 
    var stroke = "000000"
    var icon = {

path: "M16,3.5c-4.142,0-7.5,3.358-7.5,7.5c0,4.143,7.5,18.121,7.5,18.121S23.5,15.143,23.5,11C23.5,6.858,20.143,3.5,16,3.5z M16,14.584c-1.979,0-3.584-1.604-3.584-3.584S14.021,7.416,16,7.416S19.584,9.021,19.584,11S17.979,14.584,16,14.584z",
      fillColor: color,
      fillOpacity: .8,
      anchor: google.maps.Point(0.0, 0.0),
      strokeWeight: 1,
      scale:1.4
    };
    var marker = new google.maps.Marker({ position: point, map: map , title: text, icon: icon,  zIndex: ID});
}

1 个答案:

答案 0 :(得分:4)

您已经省略了new - 关键字,必须是:

anchor: new google.maps.Point(0.0, 0.0),