Make map handle background color changes

This commit is contained in:
Éric Lemoine
2013-01-24 22:12:10 +01:00
parent 2a28b7c699
commit 4a64837ba1
4 changed files with 11 additions and 26 deletions

View File

@@ -287,6 +287,9 @@ ol.Map = function(mapOptions) {
this.handleViewChanged_, false, this);
goog.events.listen(this, ol.Object.getChangedEventType(ol.MapProperty.SIZE),
this.handleSizeChanged_, false, this);
goog.events.listen(
this, ol.Object.getChangedEventType(ol.MapProperty.BACKGROUND_COLOR),
this.handleBackgroundColorChanged_, false, this),
this.setValues(mapOptionsInternal.values);
// this gives the map an initial size
@@ -561,6 +564,14 @@ ol.Map.prototype.handlePostRender = function() {
};
/**
* @private
*/
ol.Map.prototype.handleBackgroundColorChanged_ = function() {
this.render();
};
/**
* @protected
*/

View File

@@ -76,14 +76,6 @@ ol.renderer.canvas.Map.prototype.getCanvas = function() {
};
/**
* @inheritDoc
*/
ol.renderer.canvas.Map.prototype.handleBackgroundColorChanged = function() {
this.getMap().render();
};
/**
* @param {goog.events.Event} event Event.
* @protected

View File

@@ -52,10 +52,6 @@ ol.renderer.Map = function(container, map) {
* @type {Array.<number>}
*/
this.mapListenerKeys_ = [
goog.events.listen(
map, ol.Object.getChangedEventType(ol.MapProperty.BACKGROUND_COLOR),
this.handleBackgroundColorChanged, false, this),
goog.events.listen(
map, ol.Object.getChangedEventType(ol.MapProperty.LAYERS),
this.handleLayersChanged, false, this)
@@ -157,12 +153,6 @@ ol.renderer.Map.prototype.getMap = function() {
};
/**
* Handle background color changed.
*/
ol.renderer.Map.prototype.handleBackgroundColorChanged = goog.nullFunction;
/**
* @param {ol.CollectionEvent} collectionEvent Collection event.
* @protected

View File

@@ -409,14 +409,6 @@ ol.renderer.webgl.Map.prototype.getShader = function(shaderObject) {
};
/**
* @inheritDoc
*/
ol.renderer.webgl.Map.prototype.handleBackgroundColorChanged = function() {
this.getMap().render();
};
/**
* @param {goog.events.Event} event Event.
* @protected