0
如何避免縮放this.map.fitBounds()? 做這個.map.fitBounds將放大或縮小映射以擬合邊界值。我想避免fitBounds的縮小功能。我可以這樣做嗎?避免縮小this.map.fitBounds()
試過following.This將在執行fitBounds()後執行。需要在執行fitBounds之前執行()
var lineBounds = this._trail.getLineBounds()
, current_zoom = this.map.getZoom()
, center = this.map.getCenter();
this.map.fitBounds(lineBounds, {
padding: [29, 29],
});
this.map.once('zoomend', function() {
if (current_zoom > this.map.getZoom()) {
this.map.setView(center, current_zoom);
}
}.bind(this));