在Google地图v3中标记阴影 [英] Marker shadows in Google Maps v3

查看:84
本文介绍了在Google地图v3中标记阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法让标记阴影与Google Maps中的视觉刷新一起工作,但看起来似乎无法完成。

I'm looking for a way to make marker shadows work with the "visual refresh" that's coming to Google Maps, but can't seem to.

我假设以下是推荐的方式:
https:// developers.google.com/maps/tutorials/customizing/custom-markers

I suppose the following is the recommended way to do it: https://developers.google.com/maps/tutorials/customizing/custom-markers

任何人都可以在该教程的示例中看到标记阴影吗?我不能。

Can anyone see the marker shadows in the examples on that tutorial? I can't.

你们是怎么做到这一点的?

What are you guys doing to make this work?

预先感谢! / p>

Thanks in advance!

推荐答案

为什么不使用更低的z-index创建额外的标记?

Why not create an extra marker with lower z-index?

createMarkerShadow = function(map, data) {
        var latLng = new google.maps.LatLng(data.latitude, data.longitude);
        var markerShadow = new google.maps.Marker({
            clickable: false,
            position: latLng,
            map: map,
            icon:{
                url: '/frontend/img/icons/google-map-marker-shadow.svg',
                //The size image file.
                size: new google.maps.Size(225, 120),
                //The point on the image to measure the anchor from. 0, 0 is the top left.
                origin: new google.maps.Point(0, 0),
                //The x y coordinates of the anchor point on the marker. e.g. If your map marker was a drawing pin then the anchor would be the tip of the pin.
                anchor: new google.maps.Point(115, 82)
            },
            zIndex: (Math.round(latLng.lat()*-100000)<<5)-1
        });

        return markerShadow;
    };


setMarkerShadows = function (map, locations, bound) {
    for (var i = 0; i < locations.length; i++) {
        var data = locations[i];
        var markerShadow = createMarkerShadow(map, data);

        bound.extend(markerShadow.getPosition());
    }
};

bound = new google.maps.LatLngBounds();

这篇关于在Google地图v3中标记阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆