【问题标题】:MarkerWithLabel not showing full custom iconMarkerWithLabel 未显示完整的自定义图标
【发布时间】:2014-08-10 03:45:28
【问题描述】:

我们正在使用 google 实用程序脚本来创建一个自定义图标,并在其下方提供信息。

var marker5 = new MarkerWithLabel({position: point, 
    map: map,
    draggable: false,
    raiseOnDrag: false, 
    labelContent: infor,
    labelAnchor: new google.maps.Point(20, 0),
    labelClass: "labels",         // the CSS class for the label
    labelStyle: {opacity: 0.75},
    icon: {
      url: entImage,
      size: new google.maps.Size(30, 30),
      origin: new google.maps.Point(20, 0)
    },
    marker: MarkerWithLabel
});

当我们使用新的 google.maps.Size(30, 30) 调整图标大小时,它无法显示完整的图标,只是其中的一部分。如何确保我们调整大小时覆盖整个图像。

【问题讨论】:

标签: google-maps-api-3 google-maps-markers


【解决方案1】:

我已经设法通过一种简单的方式解决了这个问题,为了其他人的利益,只需创建一个像这样的图像图标

var pIcon = new google.maps.MarkerImage('logo.png',
                                  null,
                  null,
                  null,
                  new google.maps.Size(30, 30));

此后只需应用到其余代码中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-17
    • 1970-01-01
    • 1970-01-01
    • 2018-12-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多