本文介绍了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:关键词]
发布评论