0

我正在使用 XSLTForms,我需要添加一张传单地图。但是那个图书馆的东西不起作用。我在 .xml 文件中有以下代码(就像我拥有的​​每个 xform 一样),但是当我缩放地图(通过双击或单击缩放按钮)时,它会冻结。

_zoomIn: 功能在冻结时仍会触发,但不会产生预期的视觉变化。

这是简单的 xforms 示例:

<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="no" lang="en"?>

<html   xmlns="http://www.w3.org/1999/xhtml" 
        xmlns:xf="http://www.w3.org/2002/xforms"
        xmlns:ev="http://www.w3.org/2001/xml-events">
    <head>
        <link type="text/css" rel="stylesheet" href="res/leaflet-0.8-dev/leaflet.css"/> 
        <link type="text/css" rel="stylesheet" href="res/style.css"/>
        <script type="text/javascript" src="res/jquery-ui/jquery-1.11.2.min.js"></script>
        <script type="text/javascript" src="res/leaflet-0.8-dev/leaflet.js"></script>

        <script type="text/javascript">
            function showOutdoorMap(id){
                var map = L.map(id);
                L.tileLayer('https://{s}.tiles.mapbox.com/v3/{id}/{z}/{x}/{y}.png', {
                    id: 'examples.map-i875mjb7'
                }).addTo(map);
                map.locate({setView: true});
            }
        </script>
    </head>
    <body onload="showOutdoorMap('map')">
        <fieldset>
            <label class="header">Demo:</label>
            <div id="map" style='width:100%; height:250px;'/>
        </fieldset>
    </body>
</html>
4

1 回答 1

0

解决方案是在 中注释一行setView: function (center, zoom, options),允许 _resetView 方法刷新:

if (animated) {
    clearTimeout(this._sizeTimer);
    /*return this;*/
}

我还必须评论这一行,以便毫无问题地拖放:

/*if (L.DomUtil.hasClass(this._element, 'leaflet-zoom-anim')) { return; }*/
于 2015-01-22T15:36:02.897 回答