Merge pull request #3000 from bartvde/color-docs
Explain that return of ol.color.asArray should not be modified
This commit is contained in:
+6
-23
@@ -94,6 +94,8 @@ ol.color.blend = function(dst, src, opt_color) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Return the color as an array. This function maintains a cache of calculated
|
||||||
|
* arrays which means the result should not be modified.
|
||||||
* @param {ol.Color|string} color Color.
|
* @param {ol.Color|string} color Color.
|
||||||
* @return {ol.Color} Color.
|
* @return {ol.Color} Color.
|
||||||
* @api
|
* @api
|
||||||
@@ -109,6 +111,7 @@ ol.color.asArray = function(color) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Return the color as an rgba string.
|
||||||
* @param {ol.Color|string} color Color.
|
* @param {ol.Color|string} color Color.
|
||||||
* @return {string} Rgba string.
|
* @return {string} Rgba string.
|
||||||
* @api
|
* @api
|
||||||
@@ -137,12 +140,11 @@ ol.color.equals = function(color1, color2) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} s String.
|
* @param {string} s String.
|
||||||
* @param {ol.Color=} opt_color Color.
|
|
||||||
* @return {ol.Color} Color.
|
* @return {ol.Color} Color.
|
||||||
*/
|
*/
|
||||||
ol.color.fromString = (
|
ol.color.fromString = (
|
||||||
/**
|
/**
|
||||||
* @return {function(string, ol.Color=): ol.Color}
|
* @return {function(string): ol.Color}
|
||||||
*/
|
*/
|
||||||
function() {
|
function() {
|
||||||
|
|
||||||
@@ -169,10 +171,9 @@ ol.color.fromString = (
|
|||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {string} s String.
|
* @param {string} s String.
|
||||||
* @param {ol.Color=} opt_color Color.
|
|
||||||
* @return {ol.Color} Color.
|
* @return {ol.Color} Color.
|
||||||
*/
|
*/
|
||||||
function(s, opt_color) {
|
function(s) {
|
||||||
var color;
|
var color;
|
||||||
if (cache.hasOwnProperty(s)) {
|
if (cache.hasOwnProperty(s)) {
|
||||||
color = cache[s];
|
color = cache[s];
|
||||||
@@ -191,7 +192,7 @@ ol.color.fromString = (
|
|||||||
cache[s] = color;
|
cache[s] = color;
|
||||||
++cacheSize;
|
++cacheSize;
|
||||||
}
|
}
|
||||||
return ol.color.returnOrUpdate(color, opt_color);
|
return color;
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@@ -275,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.
|
* @param {ol.Color} color Color.
|
||||||
* @return {string} String.
|
* @return {string} String.
|
||||||
|
|||||||
Reference in New Issue
Block a user