Author: artdaw
Date: 2009-01-21 12:51:29 -0500 (Wed, 21 Jan 2009)
New Revision: 12363
Modified:
trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts/ui.colorpicker.js
Log:
colorPicker: ui bug were fixed
Modified:
trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts/ui.colorpicker.js
===================================================================
---
trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts/ui.colorpicker.js 2009-01-21
15:05:33 UTC (rev 12362)
+++
trunk/sandbox/ui/colorPicker/src/main/resources/org/richfaces/ui/renderkit/html/scripts/ui.colorpicker.js 2009-01-21
17:51:29 UTC (rev 12363)
@@ -16,6 +16,10 @@
},
_init: function() {
+ this.patternHex=new RegExp();
+ this.patternDec=new RegExp();
+ this.patternHex.compile("[^0-9A-Fa-f]+");
+ this.patternDec.compile("[^0-9]+");
this.charMin = 65;
var o = this.options, self = this,
tpl = $(o.clientId.toString()+"-popup");
@@ -132,9 +136,10 @@
_setNewColor: function(hsb) {
this.newColor.css('backgroundColor', '#' + this._HSBToHex(hsb));
},
+
_keyDown: function(e) {
var pressedKey = e.charCode || e.keyCode || -1;
- if ((pressedKey > this.charMin && pressedKey <= 90) || pressedKey == 32)
{
+ if ((pressedKey > this.charMin-1 && pressedKey <= 90) || pressedKey ==
32) {
return false;
}
},
@@ -144,6 +149,16 @@
target = target || e.target;
if (target.parentNode.className.indexOf('-hex') > 0) {
+ if(this.patternHex.test(target.value)){
+ target.value = 0;
+ }
+ }else{
+ if(this.patternDec.test(target.value)){
+ target.value = 0;
+ }
+ }
+
+ if (target.parentNode.className.indexOf('-hex') > 0) {
col = this._HexToHSB(this.fields.eq(0).val());
@@ -172,7 +187,7 @@
this._fillHexFields(col);
this._fillHSBFields(col);
}
- this._setSelector(col);
+ this._setSelector(col);
this._setHue(col);
this._setNewColor(col);
this._trigger('change', e, { options: this.options, hsb: col, hex:
this._HSBToHex(col), rgb: this._HSBToRGB(col) });
Show replies by date