如何放大传单保险丝搜索?
How to zoom in leaflet fuse search?
我正在使用传单和传单融合搜索来搜索地图中绘制的线。
目前我的代码:
var map = L.map('map').setView([1.3096622448984000, 103.7689017333800], 12);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=fhi', {
maxZoom: 18,
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
id: 'mapbox.streets'
}).addTo(map);
map.doubleClickZoom.disable();
var options = {
position: 'topleft',
title: 'Search',
placeholder: 'enter link id ',
maxResultLength: 15,
threshold: 0.5,
showInvisibleFeatures: true,
showResultFct: function(feature, container) {
props = feature.properties;
var name = L.DomUtil.create('b', null, container);
name.innerHTML = props.id;
container.appendChild(L.DomUtil.create('br', null, container));
var cat = props.id
info = '' + cat + ', ' + 'th link';
container.appendChild(document.createTextNode(info));
}
};
var searchCtrl = L.control.fuseSearch(options);
searchCtrl.addTo(map);
searchCtrl.indexFeatures(zones.features, ['id']);
info.addTo(map);
所以现在当我搜索时,我还可以显示 popup.But 我想在搜索时放大地图,这可能吗?感谢任何帮助。
我在这里复制我为 所做的答案是一样的:
我想我们必须修改 createResultItem 函数:
https://github.com/naomap/leaflet-fusesearch/blob/master/src/leaflet.fusesearch.js#L286
函数似乎只允许openPoup / panAndpopup作为事件,这一步添加其他事件或传递个人函数会很有用
我正在使用传单和传单融合搜索来搜索地图中绘制的线。 目前我的代码:
var map = L.map('map').setView([1.3096622448984000, 103.7689017333800], 12);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=fhi', {
maxZoom: 18,
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
id: 'mapbox.streets'
}).addTo(map);
map.doubleClickZoom.disable();
var options = {
position: 'topleft',
title: 'Search',
placeholder: 'enter link id ',
maxResultLength: 15,
threshold: 0.5,
showInvisibleFeatures: true,
showResultFct: function(feature, container) {
props = feature.properties;
var name = L.DomUtil.create('b', null, container);
name.innerHTML = props.id;
container.appendChild(L.DomUtil.create('br', null, container));
var cat = props.id
info = '' + cat + ', ' + 'th link';
container.appendChild(document.createTextNode(info));
}
};
var searchCtrl = L.control.fuseSearch(options);
searchCtrl.addTo(map);
searchCtrl.indexFeatures(zones.features, ['id']);
info.addTo(map);
所以现在当我搜索时,我还可以显示 popup.But 我想在搜索时放大地图,这可能吗?感谢任何帮助。
我在这里复制我为
我想我们必须修改 createResultItem 函数:
https://github.com/naomap/leaflet-fusesearch/blob/master/src/leaflet.fusesearch.js#L286
函数似乎只允许openPoup / panAndpopup作为事件,这一步添加其他事件或传递个人函数会很有用