diff --git a/lib/OpenLayers/Events.js b/lib/OpenLayers/Events.js index cfed09feee..a825e72bab 100644 --- a/lib/OpenLayers/Events.js +++ b/lib/OpenLayers/Events.js @@ -5,7 +5,8 @@ OpenLayers.Events.prototype = { BROWSER_EVENTS: [ "mouseover", "mouseout", "mousedown", "mouseup", "mousemove", - "click", "dblclick" + "click", "dblclick", + "resize", "focus", blur" ], // hash of Array(Function): events listener functions diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 4410f15ae1..796c0411ef 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -85,10 +85,14 @@ OpenLayers.Map.prototype = { this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES); + this.updateSize(); + // update the internal size register whenever the div is resized + this.events.register("resize", this, updateSize); + this.layers = []; if (!this.controls) { - this.controls = []; + this.controls = []; this.addControl(new OpenLayers.Control.MouseDefaults(), null ); this.addControl(new OpenLayers.Control.PanZoom(), new OpenLayers.Pixel(4,4) ); @@ -96,8 +100,6 @@ OpenLayers.Map.prototype = { this.popups = new Array(); - this.updateSize(); - // always call map.destroy() Event.observe(window, 'unload', this.destroy.bindAsEventListener(this));