zoomanim: avoid infinite setInterval loop
In Writer the tiles wont be sent for margin areas so waiting for all tiles will hang forever. This is more apparent in low zoom levels where the page margins are visible. So lets put a cap on waiting time instead and hope the tiles would have arrived by then. If not it will cause a flicker, but this is better than the document freezing due to infinite loop. Conflicts: loleaflet/src/layer/tile/CanvasTileLayer.js Signed-off-by: Dennis Francis <dennis.francis@collabora.com> Change-Id: I5f2fe5bac7e20cb0cc1417df078a1722b55cd08a
This commit is contained in:
parent
4765c7a315
commit
4e0f7459da
1 changed files with 5 additions and 2 deletions
|
@ -660,6 +660,7 @@ L.TileSectionManager = L.Class.extend({
|
|||
|
||||
var stopAnimation = false;
|
||||
var waitForTiles = false;
|
||||
var waitTries = 30;
|
||||
var intervalId = setInterval(function () {
|
||||
|
||||
if (stepId < steps) {
|
||||
|
@ -689,8 +690,8 @@ L.TileSectionManager = L.Class.extend({
|
|||
}
|
||||
|
||||
if (waitForTiles) {
|
||||
// Wait until we get all tiles.
|
||||
if (painter._tilesSection.haveAllTilesInView()) {
|
||||
// Wait until we get all tiles or wait time exceeded.
|
||||
if (waitTries <= 0 || painter._tilesSection.haveAllTilesInView()) {
|
||||
// All done.
|
||||
waitForTiles = false;
|
||||
clearInterval(intervalId);
|
||||
|
@ -701,6 +702,8 @@ L.TileSectionManager = L.Class.extend({
|
|||
// Don't let a subsequent pinchZoom start before finishing all steps till this point.
|
||||
painter._finishingZoom = false;
|
||||
}
|
||||
else
|
||||
waitTries -= 1;
|
||||
}
|
||||
|
||||
}, intervalGap);
|
||||
|
|
Loading…
Reference in a new issue