update map resize functionality to deal with google layer. if ve had a similar checkResize() function, then we would be able to safely resize an OL map with a ve layer in it as well. unfortunately, this is not the case. a bug report i am gonna file
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.0@1275 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -148,6 +148,12 @@ OpenLayers.Layer.prototype = {
|
|||||||
Object.extend(this, this.options);
|
Object.extend(this, this.options);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
onMapResize: function() {
|
||||||
|
//this function can be implemented by subclasses
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {OpenLayers.Bounds} bound
|
* @param {OpenLayers.Bounds} bound
|
||||||
|
|||||||
@@ -147,6 +147,13 @@ OpenLayers.Layer.Google.prototype =
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Event} evt
|
||||||
|
*/
|
||||||
|
onMapResize: function() {
|
||||||
|
this.gmap.checkResize();
|
||||||
|
},
|
||||||
|
|
||||||
/** If we can't load the GMap, then display an error message to the
|
/** If we can't load the GMap, then display an error message to the
|
||||||
* user and tell them where to go for help.
|
* user and tell them where to go for help.
|
||||||
*
|
*
|
||||||
|
|||||||
+12
-8
@@ -470,14 +470,18 @@ OpenLayers.Map.prototype = {
|
|||||||
if (oldSize == null)
|
if (oldSize == null)
|
||||||
this.size = oldSize = newSize;
|
this.size = oldSize = newSize;
|
||||||
if (!newSize.equals(oldSize)) {
|
if (!newSize.equals(oldSize)) {
|
||||||
// move the layer container so that the map is still centered
|
|
||||||
var dx = (newSize.w - oldSize.w) / 2,
|
//notify layers of mapresize
|
||||||
dy = (newSize.h - oldSize.h) / 2;
|
for(var i=0; i < this.layers.length; i++) {
|
||||||
var lcStyle = this.layerContainerDiv.style;
|
this.layers[i].onMapResize();
|
||||||
lcStyle.left = (parseInt(lcStyle.left) + dx) + "px";
|
}
|
||||||
lcStyle.top = (parseInt(lcStyle.top ) + dy) + "px";
|
|
||||||
// reset the map center
|
var center = new OpenLayers.Pixel(newSize.w /2, newSize.h / 2);
|
||||||
this.layerContainerOrigin = this.center.clone();
|
|
||||||
|
var zoom = this.getZoom();
|
||||||
|
this.zoom = null;
|
||||||
|
this.setCenter(center, zoom);
|
||||||
|
|
||||||
// store the new size
|
// store the new size
|
||||||
this.size = newSize;
|
this.size = newSize;
|
||||||
// the div might have moved on the page, also
|
// the div might have moved on the page, also
|
||||||
|
|||||||
Reference in New Issue
Block a user