Set up a resize event listener to call map.updateSize() as necessary.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@262 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -5,7 +5,8 @@ OpenLayers.Events.prototype = {
|
|||||||
BROWSER_EVENTS: [
|
BROWSER_EVENTS: [
|
||||||
"mouseover", "mouseout",
|
"mouseover", "mouseout",
|
||||||
"mousedown", "mouseup", "mousemove",
|
"mousedown", "mouseup", "mousemove",
|
||||||
"click", "dblclick"
|
"click", "dblclick",
|
||||||
|
"resize", "focus", blur"
|
||||||
],
|
],
|
||||||
|
|
||||||
// hash of Array(Function): events listener functions
|
// hash of Array(Function): events listener functions
|
||||||
|
|||||||
@@ -85,10 +85,14 @@ OpenLayers.Map.prototype = {
|
|||||||
|
|
||||||
this.events = new OpenLayers.Events(this, div, this.EVENT_TYPES);
|
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 = [];
|
this.layers = [];
|
||||||
|
|
||||||
if (!this.controls) {
|
if (!this.controls) {
|
||||||
this.controls = [];
|
this.controls = [];
|
||||||
this.addControl(new OpenLayers.Control.MouseDefaults(), null );
|
this.addControl(new OpenLayers.Control.MouseDefaults(), null );
|
||||||
this.addControl(new OpenLayers.Control.PanZoom(),
|
this.addControl(new OpenLayers.Control.PanZoom(),
|
||||||
new OpenLayers.Pixel(4,4) );
|
new OpenLayers.Pixel(4,4) );
|
||||||
@@ -96,8 +100,6 @@ OpenLayers.Map.prototype = {
|
|||||||
|
|
||||||
this.popups = new Array();
|
this.popups = new Array();
|
||||||
|
|
||||||
this.updateSize();
|
|
||||||
|
|
||||||
// always call map.destroy()
|
// always call map.destroy()
|
||||||
Event.observe(window, 'unload',
|
Event.observe(window, 'unload',
|
||||||
this.destroy.bindAsEventListener(this));
|
this.destroy.bindAsEventListener(this));
|
||||||
|
|||||||
Reference in New Issue
Block a user