Skip to content

Commit

Permalink
Merge pull request openlayers#635 from bartvde/resize
Browse files Browse the repository at this point in the history
fix issue with orientation changes on mobile devices (r=@ahocevar and thanks to @ahocevar for coming up with this idea in the first place)
  • Loading branch information
Bart van den Eijnden committed Aug 16, 2012
2 parents 5cf260f + 39a6d7d commit e4e06a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/OpenLayers/Map.js
Expand Up @@ -588,8 +588,13 @@ OpenLayers.Map = OpenLayers.Class({
// Else updateSize on catching the window's resize
// Note that this is ok, as updateSize() does nothing if the
// map's size has not actually changed.
this.updateSizeDestroy = OpenLayers.Function.bind(this.updateSize,
this);
var me = this;
// We need to call this in the next cycle, otherwise it can cause
// issues on mobile devices on orientation change. It will use the
// height of the previous orientation otherwise.
this.updateSizeDestroy = function() {
window.setTimeout(function() { me.updateSize(); }, 0);
};
OpenLayers.Event.observe(window, 'resize',
this.updateSizeDestroy);
}
Expand Down

0 comments on commit e4e06a8

Please sign in to comment.