Skip to content

Stack Overflow in IE8 when maxBounds is set and user scrolls past bounds #2081

@ohgit

Description

@ohgit

Leaflet experiences a stack overflow in IE8 when the user scrolls past the map edge if maxBounds is set (on L.map). It seems to be continually trying to animate the pan back to valid territory. Turning off animations does not seem to work, since panInsideBounds() does not pass animation settings to panBy. I'm using continuousWorld:true, noWrap:true, with these max bounds:

    var southWest = new L.LatLng(-90, -180);
    var northEast = new L.LatLng(90, 180);
    var mapMaxBounds = new L.LatLngBounds(southWest, northEast);

This works fine in IE9 and FF 19. I'm using version 0.6.4, which already has the fix for Issue #1866.

Adding a second parameter on this line in panInsideBounds() allows panBy to respect options, like animate:false:
return this.panBy([dx, dy], this.options);

Another issue (possibly related?) is that if the map is smaller than the view and maxBounds is set (try zoom:0), the browser will attempt to continually pan the map so it fits. FireFox gives the best visualization of this problem.

Metadata

Metadata

Assignees

Labels

blockerCritical issue or PR that must be resolved before the next release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions