Skip to content

Commit

Permalink
Remove code that suggests that color arrays may be modified
Browse files Browse the repository at this point in the history
  • Loading branch information
Bart van den Eijnden committed Dec 4, 2014
1 parent 22e3351 commit ccc7c1b
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions src/ol/color/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,11 @@ ol.color.equals = function(color1, color2) {

/**
* @param {string} s String.
* @param {ol.Color=} opt_color Color.
* @return {ol.Color} Color.
*/
ol.color.fromString = (
/**
* @return {function(string, ol.Color=): ol.Color}
* @return {function(string): ol.Color}
*/
function() {

Expand All @@ -172,10 +171,9 @@ ol.color.fromString = (
return (
/**
* @param {string} s String.
* @param {ol.Color=} opt_color Color.
* @return {ol.Color} Color.
*/
function(s, opt_color) {
function(s) {
var color;
if (cache.hasOwnProperty(s)) {
color = cache[s];
Expand All @@ -194,7 +192,7 @@ ol.color.fromString = (
cache[s] = color;
++cacheSize;
}
return ol.color.returnOrUpdate(color, opt_color);
return color;
});

})();
Expand Down Expand Up @@ -278,24 +276,6 @@ ol.color.normalize = function(color, opt_color) {
};


/**
* @param {ol.Color} color Color.
* @param {ol.Color=} opt_color Color.
* @return {ol.Color} Color.
*/
ol.color.returnOrUpdate = function(color, opt_color) {
if (goog.isDef(opt_color)) {
opt_color[0] = color[0];
opt_color[1] = color[1];
opt_color[2] = color[2];
opt_color[3] = color[3];
return opt_color;
} else {
return color;
}
};


/**
* @param {ol.Color} color Color.
* @return {string} String.
Expand Down

0 comments on commit ccc7c1b

Please sign in to comment.