Permalink
Browse files

don't applyBackBuffer when moving to extent outside of current bounds,

otherwise map will be blank until new image is retrieved.

only applyBackBuffer when zooming-in, zooming-out, or panning where new-bounds intersect old-bounds
  • Loading branch information...
1 parent c79332b commit 11bfb0efd754f79896c845b2d4dc1e24bf5b68f7 @lydonchandra committed Jul 10, 2012
Showing with 14 additions and 2 deletions.
  1. +14 −2 lib/OpenLayers/Layer/Grid.js
@@ -457,8 +457,20 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
this.removeBackBuffer();
}
- if(!zoomChanged || this.transitionEffect === 'resize') {
- this.applyBackBuffer(serverResolution);
+ if( this.transitionEffect === 'resize' ) {
+
+ // if new-bounds is within old-bounds (zoom-out)
+ if( (tilesBounds && tilesBounds.containsBounds(bounds))
+
+ // if old-bounds intersects new-bounds (pan)
+ || (tilesBounds && tilesBounds.intersectsBounds(bounds))
+
+ // if old-bounds is within new-bounds (zoom-in)
+ || (bounds && tilesBounds
+ && bounds.containsBounds(tilesBounds)) )
+ {
+ this.applyBackBuffer(serverResolution);
+ }
}
this.initSingleTile(bounds);

0 comments on commit 11bfb0e

Please sign in to comment.