openlayers/ol3 — pull request #3061 by elemoine (2014-12-18 12:59:52+00:00)
Title: Add a renderBuffer option to ol.layer.Vector

This PR fixes a the bug reported in #2851 and a `renderBuffer` option to `ol.layer.Vector`.

The bug reported in #2851 can be easily reproduced using the [icon](http://openlayers.org/en/master/examples/icon.html) example. Just move the map north until the icon hits the bottom of the viewport: the icon disappears as soon as the icon position (`[0, 0]`) is outside the viewport.

This PR fixes the bug by removing the `ol.extent.intersects` tests in the `ReplayGroup`'s `replay` functions. This means `Replay` objects are now unconditionally replayed, even when their envelope does not intersect the viewport extent.

Also, currently, we do not recreate a new `ReplayGroup` when the extent of the current `ReplayGroup` [contains](https://github.com/openlayers/ol3/blob/cd0bed62917d0cce5375644145089f6c84535239/src/ol/renderer/canvas/canvasvectorlayerrenderer.js#L193) the viewport extent. This means that we may have rendering issues (symbols/icons not drawn) when the viewport approaches the boundary of tthe `ReplayGroup` extent.

This PR addresses this problem by using not re-creating the batch only in the case where the `ReplayGroup` extent equals the viewport extent. But note that we still do not create new `ReplayGroup`'s during animations and interactions.

And, at last, this PR adds a `renderBuffer` option to `ol.layer.Vector` that allows specifying the size (in pixels) of the rendering buffer around the viewport extent. The default value is 100 pixels, but larger values can be used when using large icon sizes or line widths. This option is somewhat similar to MapServer's [`tile_map_edge_buffer`](http://mapserver.org/fr/output/tile_mode.html).

Please review.