Use ol.object.assign to update config properties in ol.source.CartoDB
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
goog.provide('ol.source.CartoDB');
|
goog.provide('ol.source.CartoDB');
|
||||||
|
|
||||||
|
goog.require('ol.object');
|
||||||
goog.require('ol.source.State');
|
goog.require('ol.source.State');
|
||||||
goog.require('ol.source.XYZ');
|
goog.require('ol.source.XYZ');
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ ol.source.CartoDB = function(options) {
|
|||||||
this.mapId_ = options.map || '';
|
this.mapId_ = options.map || '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object}
|
* @type {!Object}
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
this.config_ = options.config || {};
|
this.config_ = options.config || {};
|
||||||
@@ -57,7 +58,7 @@ goog.inherits(ol.source.CartoDB, ol.source.XYZ);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current config.
|
* Returns the current config.
|
||||||
* @return {Object} The current configuration.
|
* @return {!Object} The current configuration.
|
||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.source.CartoDB.prototype.getConfig = function() {
|
ol.source.CartoDB.prototype.getConfig = function() {
|
||||||
@@ -72,9 +73,7 @@ ol.source.CartoDB.prototype.getConfig = function() {
|
|||||||
* @api
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.source.CartoDB.prototype.updateConfig = function(config) {
|
ol.source.CartoDB.prototype.updateConfig = function(config) {
|
||||||
for (var key in config) {
|
ol.object.assign(this.config_, config);
|
||||||
this.config_[key] = config[key];
|
|
||||||
}
|
|
||||||
this.initializeMap_();
|
this.initializeMap_();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user