patch for #441 - resolving Rico namespace conflict
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2094 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Rico.Color = OpenLayers.Class.create();
|
||||
OpenLayers.Rico.Color = OpenLayers.Class.create();
|
||||
|
||||
Rico.Color.prototype = {
|
||||
OpenLayers.Rico.Color.prototype = {
|
||||
|
||||
initialize: function(red, green, blue) {
|
||||
this.rgb = { r: red, g : green, b : blue };
|
||||
@@ -25,7 +25,7 @@ Rico.Color.prototype = {
|
||||
hsb.h = h;
|
||||
|
||||
// convert back to RGB...
|
||||
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
|
||||
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
|
||||
},
|
||||
|
||||
setSaturation: function(s) {
|
||||
@@ -34,7 +34,7 @@ Rico.Color.prototype = {
|
||||
hsb.s = s;
|
||||
|
||||
// convert back to RGB and set values...
|
||||
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
|
||||
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
|
||||
},
|
||||
|
||||
setBrightness: function(b) {
|
||||
@@ -43,17 +43,17 @@ Rico.Color.prototype = {
|
||||
hsb.b = b;
|
||||
|
||||
// convert back to RGB and set values...
|
||||
this.rgb = Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
|
||||
this.rgb = OpenLayers.Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
|
||||
},
|
||||
|
||||
darken: function(percent) {
|
||||
var hsb = this.asHSB();
|
||||
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
|
||||
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
|
||||
},
|
||||
|
||||
brighten: function(percent) {
|
||||
var hsb = this.asHSB();
|
||||
this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
|
||||
this.rgb = OpenLayers.Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
|
||||
},
|
||||
|
||||
blend: function(other) {
|
||||
@@ -80,7 +80,7 @@ Rico.Color.prototype = {
|
||||
},
|
||||
|
||||
asHSB: function() {
|
||||
return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
|
||||
return OpenLayers.Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
|
||||
},
|
||||
|
||||
toString: function() {
|
||||
@@ -89,7 +89,7 @@ Rico.Color.prototype = {
|
||||
|
||||
};
|
||||
|
||||
Rico.Color.createFromHex = function(hexCode) {
|
||||
OpenLayers.Rico.Color.createFromHex = function(hexCode) {
|
||||
if(hexCode.length==4) {
|
||||
var shortHexCode = hexCode;
|
||||
var hexCode = '#';
|
||||
@@ -101,39 +101,39 @@ shortHexCode.charAt(i));
|
||||
var red = hexCode.substring(0,2);
|
||||
var green = hexCode.substring(2,4);
|
||||
var blue = hexCode.substring(4,6);
|
||||
return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
|
||||
return new OpenLayers.Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for creating a color from the background of
|
||||
* an HTML element.
|
||||
*/
|
||||
Rico.Color.createColorFromBackground = function(elem) {
|
||||
OpenLayers.Rico.Color.createColorFromBackground = function(elem) {
|
||||
|
||||
var actualColor = RicoUtil.getElementsComputedStyle($(elem), "backgroundColor", "background-color");
|
||||
|
||||
if ( actualColor == "transparent" && elem.parentNode )
|
||||
return Rico.Color.createColorFromBackground(elem.parentNode);
|
||||
return OpenLayers.Rico.Color.createColorFromBackground(elem.parentNode);
|
||||
|
||||
if ( actualColor == null )
|
||||
return new Rico.Color(255,255,255);
|
||||
return new OpenLayers.Rico.Color(255,255,255);
|
||||
|
||||
if ( actualColor.indexOf("rgb(") == 0 ) {
|
||||
var colors = actualColor.substring(4, actualColor.length - 1 );
|
||||
var colorArray = colors.split(",");
|
||||
return new Rico.Color( parseInt( colorArray[0] ),
|
||||
return new OpenLayers.Rico.Color( parseInt( colorArray[0] ),
|
||||
parseInt( colorArray[1] ),
|
||||
parseInt( colorArray[2] ) );
|
||||
|
||||
}
|
||||
else if ( actualColor.indexOf("#") == 0 ) {
|
||||
return Rico.Color.createFromHex(actualColor);
|
||||
return OpenLayers.Rico.Color.createFromHex(actualColor);
|
||||
}
|
||||
else
|
||||
return new Rico.Color(255,255,255);
|
||||
return new OpenLayers.Rico.Color(255,255,255);
|
||||
}
|
||||
|
||||
Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
|
||||
OpenLayers.Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
|
||||
|
||||
var red = 0;
|
||||
var green = 0;
|
||||
@@ -188,7 +188,7 @@ Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
|
||||
return { r : parseInt(red), g : parseInt(green) , b : parseInt(blue) };
|
||||
}
|
||||
|
||||
Rico.Color.RGBtoHSB = function(r, g, b) {
|
||||
OpenLayers.Rico.Color.RGBtoHSB = function(r, g, b) {
|
||||
|
||||
var hue;
|
||||
var saturation;
|
||||
|
||||
Reference in New Issue
Block a user