衣夹人已经从我的地图上消失了 [英] Pegman has disappeared from my map

查看:37
本文介绍了衣夹人已经从我的地图上消失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,街景街景小人已经出现在我的地图上.今天,我注意到他没有出现(尽管如果您知道将鼠标悬停在何处抓住他,您仍然可以看到街景).我的缩放控件也已经消失了(但是如果您知道要在哪里移动鼠标,它仍然存在),但是在看起来似乎还不错的移动设备上却没有.

For as long as I can remember, the street view pegman has appeared on my map. Today, I noticed that he doesn't appear (although if you know where to mouse over to grab him, you can still get a streetview happening). My zoom control has similarly disappeared (but is still there if you know where to mouse for it) but not on mobile devices where it seems to display just fine.

我的第一个猜测是这是最近引入的Maps API中的错误.但是,在API的URL中指定 v = 3.4 并不能解决问题.

My first guess is that this is a bug in the Maps API that's been introduced recently. But specifying v=3.4 in the URL for the API doesn't correct the issue.

我做错什么了吗?如果没有,是否有解决方法?

Am I doing something wrong? If not, is there a workaround?

这是我创建地图的方式:

Here's how I create the map:

<script type="text/javascript">
var lat=<?php echo $lat; ?>;
var lon=<?php echo $lon; ?>;
var initialZoom=<?php echo $initialZoom; ?>;
var mapTypeId = 'Custom Map';
var mapStyle = [{featureType:"administrative", elementType:"all", stylers:[{hue:"#dae6c3"},{saturation:22},{lightness:-5}]}, 
                {featureType:"landscape", elementType:"all", stylers:[{hue:"#dae6c3"},{saturation:16},{lightness:-7}]},
                {featureType:"road", elementType:"geometry", stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100}]}];
var styledMap = new google.maps.StyledMapType(mapStyle);

var mapType = new google.maps.ImageMapType({
    tileSize: new google.maps.Size(256,256),
    getTileUrl: function(coord,zoom) {
        return "img/tiles/"+zoom+"/"+coord.x+"/"+coord.y+".png";
    }
});
var map = new google.maps.Map(document.getElementById("map_canvas"), 
        {center:new google.maps.LatLng(lat,lon),
         mapTypeId:google.maps.MapTypeId.ROADMAP,
         zoom:initialZoom,
         mapTypeControl:false});
map.overlayMapTypes.insertAt(0, mapType);

map.mapTypes.set(mapTypeId, styledMap);
map.setMapTypeId(mapTypeId);
</script>

推荐答案

我最近添加了导致问题的CSS规则:

I had recently added this CSS rule which was causing the problem:

img {
    max-width: 100%; 
}

删除该规则解决了该问题.

Removing that rule fixed the problem.

这篇关于衣夹人已经从我的地图上消失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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