summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/colorpicker/colorpicker.js
diff options
context:
space:
mode:
authorxue <>2006-04-25 01:27:04 +0000
committerxue <>2006-04-25 01:27:04 +0000
commit1afc913c386bba8e6072c278b0eb4fd9818ab310 (patch)
tree40cc63eb41f47e0ac392c692619640dca57cd262 /framework/Web/Javascripts/colorpicker/colorpicker.js
parentfd019bf034ef4dbedfc305c77fed0dbd83a732c4 (diff)
Undo previous checkin (which goes int 3.0 branch and will be merged back).
Diffstat (limited to 'framework/Web/Javascripts/colorpicker/colorpicker.js')
-rw-r--r--framework/Web/Javascripts/colorpicker/colorpicker.js59
1 files changed, 17 insertions, 42 deletions
diff --git a/framework/Web/Javascripts/colorpicker/colorpicker.js b/framework/Web/Javascripts/colorpicker/colorpicker.js
index dc80f0c7..cc4587ff 100644
--- a/framework/Web/Javascripts/colorpicker/colorpicker.js
+++ b/framework/Web/Javascripts/colorpicker/colorpicker.js
@@ -83,7 +83,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
if(mode == "Full")
this.initializeFullPicker();
}
- this.show(mode);
+ this.show();
},
show : function(type)
@@ -108,7 +108,6 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
if(type == "Full")
{
- this.observeMouseMovement();
var color = Rico.Color.createFromHex(this.input.value);
this.inputs.oldColor.style.backgroundColor = color.asHex();
this.setColor(color,true);
@@ -125,14 +124,8 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this.element.style.display = "none";
this.showing = false;
- Event.stopObserving(document.body, "click", this._documentClickEvent);
+ Event.stopObserving(document.body, "click", this._documentClickEvent);
Event.stopObserving(document,"keydown", this._documentKeyDownEvent);
-
- if(this._observingMouseMove)
- {
- Event.stopObserving(document.body, "mousemove", this._onMouseMove);
- this._observingMouseMove = false;
- }
}
},
@@ -215,7 +208,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
{
this.input.value = color.toString().toUpperCase();
this.button.style.backgroundColor = color.toString();
- if(typeof(this.onChange) == "function")
+ if(isFunction(this.onChange))
this.onChange(color);
},
@@ -253,7 +246,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
TR(null,
TD(null,'H:'),
- TD(null,this.inputs['H'], '??')),
+ TD(null,this.inputs['H'], '°')),
TR(null,
TD(null,'S:'),
@@ -340,46 +333,34 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this._onMouseMove = this.onMouseMove.bind(this);
Event.observe(this.inputs.background, "mousedown", this._onColorMouseDown);
- Event.observe(this.inputs.selector, "mousedown", this._onColorMouseDown);
Event.observe(this.inputs.hue, "mousedown", this._onHueMouseDown);
- Event.observe(this.inputs.slider, "mousedown", this._onHueMouseDown);
Event.observe(document.body, "mouseup", this._onMouseUp);
-
- this.observeMouseMovement();
+
+ //Because of using the CSS filter, IE can't do colour change quickly
+ //if(!Prado.Browser().ie)
+ Event.observe(document.body, "mousemove", this._onMouseMove);
Event.observe(this.buttons.Cancel, "click", this.hide.bindEvent(this,this.options['Mode']));
Event.observe(this.buttons.OK, "click", this.onOKClicked.bind(this));
},
- observeMouseMovement : function()
- {
- if(!this._observingMouseMove)
- {
- Event.observe(document.body, "mousemove", this._onMouseMove);
- this._observingMouseMove = true;
- }
- },
-
onColorMouseDown : function(ev)
{
this.isMouseDownOnColor = true;
this.onMouseMove(ev);
- Event.stop(ev);
},
onHueMouseDown : function(ev)
{
this.isMouseDownOnHue = true;
this.onMouseMove(ev);
- Event.stop(ev);
},
onMouseUp : function(ev)
{
this.isMouseDownOnColor = false;
this.isMouseDownOnHue = false;
- Event.stop(ev);
},
onMouseMove : function(ev)
@@ -388,7 +369,6 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this.changeSV(ev);
if(this.isMouseDownOnHue)
this.changeH(ev);
- Event.stop(ev);
},
changeSV : function(ev)
@@ -396,25 +376,18 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
var px = Event.pointerX(ev);
var py = Event.pointerY(ev);
var pos = Position.cumulativeOffset(this.inputs.background);
-
var x = this.truncate(px - pos[0],0,255);
var y = this.truncate(py - pos[1],0,255);
+ var h = this.truncate(this.inputs.H.value,0,360)/360;
var s = x/255;
var b = (255-y)/255;
- var current_s = parseInt(this.inputs.S.value);
- var current_b = parseInt(this.inputs.V.value);
-
- if(current_s == parseInt(s*100) && current_b == parseInt(b*100)) return;
-
- var h = this.truncate(this.inputs.H.value,0,360)/360;
var color = new Rico.Color();
color.rgb = Rico.Color.HSBtoRGB(h,s,b);
-
this.inputs.selector.style.left = x+"px";
this.inputs.selector.style.top = y+"px";
@@ -430,10 +403,6 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
var y = this.truncate(py - pos[1],0,255);
var h = (255-y)/255;
- var current_h = this.truncate(this.inputs.H.value,0,360);
- current_h = current_h == 0 ? 360 : current_h;
- if(current_h == parseInt(h*360)) return;
-
var s = parseInt(this.inputs.S.value)/100;
var b = parseInt(this.inputs.V.value)/100;
var color = new Rico.Color();
@@ -503,8 +472,14 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
var images = Prado.WebUI.TColorPicker.UIImages;
var changeCss = color.isBright() ? 'removeClassName' : 'addClassName';
- Element[changeCss](this.inputs.selector, 'target_white');
-
+ Element[changeCss](this.inputs.selector, 'target_white');
+/* if(color.isBright())
+ Element.removeCssClass(this.inputs.selector, 'target_white');
+ //this.inputs.selector.src = images['target_black.gif'];
+ else
+ Element.addCssClass(this.inputs.selector, 'target_white');
+ //this.inputs.selector.src = images['target_white.gif'];
+*/
if(update)
this.updateSelectors(color);
},