Google Maps v3 中的标记阴影

编程入门 行业动态 更新时间:2024-10-08 00:28:31
本文介绍了Google Maps v3 中的标记阴影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我正在寻找一种方法,让标记阴影与 Google 地图即将推出的视觉刷新"配合使用,但似乎无法实现.

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/maps/tutorials/customizing/custom-markers

I suppose the following is the recommended way to do it: https://developers.google/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?

提前致谢!

推荐答案

为什么不创建一个具有较低 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 Maps v3 中的标记阴影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

限时送ChatGPT账号..

更多推荐

[db:关键词]

本文发布于:2023-03-31 21:46:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/815321.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标记   阴影   Google   Maps

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!