Make map handle size changes

This commit is contained in:
Éric Lemoine
2013-01-24 22:06:47 +01:00
parent 71a462cd54
commit 15898b559b
3 changed files with 11 additions and 22 deletions

View File

@@ -285,6 +285,8 @@ ol.Map = function(mapOptions) {
goog.events.listen(this, ol.Object.getChangedEventType(ol.MapProperty.VIEW),
this.handleViewChanged_, false, this);
goog.events.listen(this, ol.Object.getChangedEventType(ol.MapProperty.SIZE),
this.handleSizeChanged_, false, this);
this.setValues(mapOptionsInternal.values);
this.handleBrowserWindowResize();
@@ -567,6 +569,14 @@ ol.Map.prototype.handleBrowserWindowResize = function() {
};
/**
* @private
*/
ol.Map.prototype.handleSizeChanged_ = function() {
this.render();
};
/**
* @private
*/

View File

@@ -93,15 +93,6 @@ ol.renderer.canvas.Map.prototype.handleLayerRendererChange = function(event) {
};
/**
* @inheritDoc
*/
ol.renderer.canvas.Map.prototype.handleSizeChanged = function() {
goog.base(this, 'handleSizeChanged');
this.getMap().render();
};
/**
* @inheritDoc
*/

View File

@@ -58,11 +58,7 @@ ol.renderer.Map = function(container, map) {
goog.events.listen(
map, ol.Object.getChangedEventType(ol.MapProperty.LAYERS),
this.handleLayersChanged, false, this),
goog.events.listen(
map, ol.Object.getChangedEventType(ol.MapProperty.SIZE),
this.handleSizeChanged, false, this)
this.handleLayersChanged, false, this)
];
};
@@ -210,14 +206,6 @@ ol.renderer.Map.prototype.handleLayersRemove = function(collectionEvent) {
};
/**
* @protected
*/
ol.renderer.Map.prototype.handleSizeChanged = function() {
this.getMap().render();
};
/**
* @param {ol.layer.Layer} layer Layer.
* @protected