首页 > 解决方案 > 传单图像覆盖在 iOS 12 上无法完全正常工作

问题描述

我的 PWA(使用 Leaflet 1.5.1)目前在 Android 和 iOS 上运行(自 2 年以来)没有问题,直到 iOS 12 发布。从那时起,我在 iPhone 和 iPad 上遇到了非常奇怪的问题。

主要问题是图像叠加层没有在 iOS 设备上完全呈现。

我正在设置一组叠加层:

ovl = loadOverlay(url);
overlay.push(ovl);

哪里loadOverlay()是:

function loadOverlay(imgurl) {
    bounds = new L.LatLngBounds(
        new L.LatLng(30, -10),
        new L.LatLng(50, 36)
    );

    var ovl = new L.ImageOverlay(imgurl,
        bounds, {
            pane: 'imagebg',
            attribution: "my attribution"
        });
    return ovl;
}

然后,每个叠加层都以这种方式显示:

startMap() {
 mymap = new L.Map('CopMap', {
 maxZoom: 6.50,
 minZoom: 4.75,
 zoomSnap: 0.25,
 zoomDelta: 0.25,
 zoomControl: false,
 maxBounds: [
        //south west
        [32.5, -4.],
        //north east
        [46.8, 31]
     ], 
        crs: L.CRS.Simple
 });
    mymap.attributionControl.setPrefix('');

    mymap.createPane('imagebg');
    mymap.getPane('imagebg').style.zIndex = 1;

    mymap.addLayer(overlay[iDX]);
}

这在 Android 上运行良好,而在 iOS 中,图像没有完全渲染(并非总是如此,但经常如此)。我已检查图像文件是否已正确下载到缓存中,但未完全显示。

标签: iosleaflet

解决方案


推荐阅读