传单不连贯地绘制瓷砖

2022-01-12 00:00:00 leaflet javascript

我正在实例化一张传单地图,但图块基本上散布在整个页面上 - 虽然地图位于 div 内,但大多数图块不遵守该边界:

I am instantiating a leaflet map, but the tiles are basically being scattered all over the page - while the map is within a div, most of the tiles are not respecting that boundary:

<div class="widget-content listing-search-map-widget-content">
    <div class="ih-map" 
         id="Map_5333811_16"
         style="height:450px;"
         data-centerpoint="38.573955 -121.442478" 
         data-mousewheel="true" 
         data-maptype="TERRAIN"
         data-zoom="8"
        >
    </div>
</div>

javascript 归结为:

The javascript comes down to:

mapOptions = {
               attributionControl: true,
               center: {
                   lat: 38.573955
                   lng: -121.442478
               },
               centerpoint: "38.573955,-121.442478", 
               layers: {},
               maptype: "Terrain", 
               scrollWheelZoom: false, 
               zoom: 8
            }

var map = L.map( "Map_5333811_16", mapOptions );

什么会导致瓷砖在整个地方绘制?几个瓷砖在 div 的范围内,但不是其余的.您可以在此处看到发生的情况的屏幕截图:

What would cause the tiles to plot all over the place?a couple of tiles are within the bounds of the div, but not the rest of them. You can see a screenshot of what happens here:

推荐答案

这听起来像是缺少 Leaflet CSS 文件的症状,或者该文件的版本不正确.

This sounds like a symptom of missing Leaflet CSS file, or incorrect version of that file.

相关文章