Javascript 使用maxbounds时,传单贴图会无限移动
我创建了一个crs传单图,并试图将其maxbounds设置为crs图像的边界。 当我添加maxbounds属性时,有三个传单事件持续无限激发,这会导致贴图无限移动。 以下是事件:Javascript 使用maxbounds时,传单贴图会无限移动,javascript,angularjs,leaflet,angular-leaflet-directive,Javascript,Angularjs,Leaflet,Angular Leaflet Directive,我创建了一个crs传单图,并试图将其maxbounds设置为crs图像的边界。 当我添加maxbounds属性时,有三个传单事件持续无限激发,这会导致贴图无限移动。 以下是事件: leafletDirectiveMap.move leafletDirectiveMap.movestart leafletDirectiveMap.moveend 这是我的密码。我在用传单 angular.module('pyvMap').controller('mainCtrl', [ '$scope', '
leafletDirectiveMap.move
leafletDirectiveMap.movestart
leafletDirectiveMap.moveend
这是我的密码。我在用传单
angular.module('pyvMap').controller('mainCtrl', [ '$scope', 'leafletData', 'leafletBoundsHelpers', function($scope, leafletData, leafletBoundsHelpers) {
var mapMinZoom = 2;
var mapMaxZoom = 6;
var maxBounds = leafletBoundsHelpers.createBoundsFromArray([[0,241.59375], [-132.65625, 0]]);
angular.extend($scope, {
defaults: {
maxZoom: mapMaxZoom,
minZoom: mapMinZoom,
zoomControl: false,
crs: 'Simple',
attributionControl: false,
detectRetina: true,
tileLayer: "http://d30jy4vw1d2n56.cloudfront.net/tiles/{z}/{x}/{y}.png",
tileLayerOptions: {
minZoom: mapMinZoom,
maxZoom: mapMaxZoom,
// bounds: maxBounds,
opacity: 0.9,
// reuseTiles: true,
continuousWorld: true,
noWrap: true,
tileSize:256,
crs: 'Simple',
detectRetina: true,
},
},
center: {
zoom: 2
},
maxBounds: maxBounds
});}]);
HTML:
谢谢 一旦根据需要将
width
和height
属性添加到
标签中,无论是使用传单版本0.7.7
还是1.2.0
,您的问题看起来都不可复制:
一旦
宽度
和高度
属性根据需要添加到
标签中,无论是使用传单版本0.7.7
还是1.2.0
,您的问题看起来都不可复制:
<leaflet center="center" maxBounds="maxBounds" defaults="defaults"></leaflet>