我正在和XSLTForms合作,我需要添加一张传单地图。但是那个图书馆的东西不起作用。我在一个.xml文件中有以下代码(与我所拥有的每个xform一样),但是当我缩放地图(通过双击或在缩放按钮中单击)时,它会冻结。
_zoomIn:函数在冻结时仍然会被触发,但它不会进行预期的视觉更改。
以下是简单的xform示例:
<?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>发布于 2015-01-22 15:36:02
解决方案是在setView: function (center, zoom, options)中注释一行,允许_resetView方法刷新:
if (animated) {
clearTimeout(this._sizeTimer);
/*return this;*/
}为了没有问题地拖放,我还不得不评论这一行:
/*if (L.DomUtil.hasClass(this._element, 'leaflet-zoom-anim')) { return; }*/https://stackoverflow.com/questions/28092712
复制相似问题