openlayers/ol3 — pull request #2757 by tschaub (2014-09-26 22:19:59+00:00)
Title: Clear the canvas on layer extent changes

Things I like about this solution:

* The layer renderer listens for changes on the layer. This is far more direct than having the map listen for layer group changes and then call `map.render()`, as by the time we get to preparing the frame in the layer renderer, we know nothing about what changed. And we have to store extra state on the layer renderer in order to figure out what work we need to do.

Things I don't like about this solution:

* Clearing the canvas and unsetting `rendereredCanvasZ_` is a bit awkward. It would be nice to have a `forgetEverythingAndStartOver` method. But I'm not sure where else this would get used yet.

* The WebGL renderer doesn't really work well with layers with limited extents. This doesn't help there.

* Both the Canvas and the DOM renderer will render tiles from a higher zoom level while zooming out. So, when zooming from 2 to 1, tiles from 2 will be rendered when we get to 1 if tiles from 1 are not loaded. The result is that when you change the layer extent and zoom out, you can occasionally see tiles from the previously rendered zoom level that are outside the new extent. I feel like there is a bug lurking here.

Input welcome.

Fixes #2731.