gpt4 book ai didi

javascript - 谷歌地图 Javascript V3 : How can I Set the Marker Shadow's Offset from the Marker?

转载 作者:行者123 更新时间:2023-11-29 20:14:45 36 4
gpt4 key购买 nike

我有一张带有几种不同类型图标的 Google map 。我在每个图标上都有一个阴影。如何调整标记阴影与标记的偏移量?

在构建每个标记的循环中,我有:

var icon = customIcons[type];
var marker = new google.maps.Marker({
map: map,
position: point,
icon: icon.icon,
shadow: icon.shadow
});

图标按类型设置。

var customIcons = {
  Football: {
    icon: 'http://path-to-image1.png',
    shadow: 'http://path-to-shadow-image1.png'
  },
  Lacrosse: {
    icon: 'http://path-to-image2.png',
    shadow: 'http://path-to-shadow-image2.png'
  }
};

在此tutorial ,他们为单个图标设置大小和偏移量如下:

var image = new google.maps.MarkerImage('images/beachflag.png',
// This marker is 20 pixels wide by 32 pixels tall.
new google.maps.Size(20, 32),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
new google.maps.Point(0, 32));
var shadow = new google.maps.MarkerImage('images/beachflag_shadow.png',
// The shadow image is larger in the horizontal dimension
// while the position and offset are the same as for the main image.
new google.maps.Size(37, 32),
new google.maps.Point(0,0),
new google.maps.Point(0, 32));

在我的情况下,我有多个图标,它们被设置在一个对象中。如何将大小和偏移量添加到 var customIcons

谢谢。

最佳答案

根据这 block Google Map API v3 documentation :

Note: Marker shadows were removed in version 3.14 of the Google Maps JavaScript API. Any shadows specified programmatically will be ignored.

关于javascript - 谷歌地图 Javascript V3 : How can I Set the Marker Shadow's Offset from the Marker?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7683046/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com