a:55:{s:9:"#provides";s:24:"dojox.widget.ColorPicker";s:9:"#resource";s:21:"widget/ColorPicker.js";s:9:"#requires";a:4:{i:0;a:3:{i:0;s:6:"common";i:1;s:22:"dijit.form._FormWidget";i:2;s:5:"dijit";}i:1;a:3:{i:0;s:6:"common";i:1;s:13:"dojo.dnd.move";i:2;s:4:"dojo";}i:2;a:3:{i:0;s:6:"common";i:1;s:7:"dojo.fx";i:2;s:4:"dojo";}i:3;a:2:{i:0;s:6:"common";i:1;s:11:"dojox.color";}}s:24:"dojox.widget.ColorPicker";a:6:{s:4:"type";s:8:"Function";s:6:"chains";a:2:{s:9:"prototype";a:1:{i:0;s:22:"dijit.form._FormWidget";}s:4:"call";a:1:{i:0;s:22:"dijit.form._FormWidget";}}s:7:"summary";s:48:"a HSV color picker - similar to Photoshop picker";s:11:"description";s:180:"Provides an interactive HSV ColorPicker similar to PhotoShop's color selction tool. This is an enhanced version of the default dijit.ColorPalette, though provides no accessibility.";s:8:"examples";a:2:{i:0;s:160:" var picker = new dojox.widget.ColorPicker({ // a couple of example toggles: animatePoint:false, showHsv: false, webSafe: false, showRgb: false });";i:1;s:70:"
";}s:9:"classlike";b:1;}s:32:"dojox.widget.ColorPicker.showRgb";a:3:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:7:"Boolean";s:7:"summary";s:27:"show/update RGB input nodes";}s:32:"dojox.widget.ColorPicker.showHsv";a:3:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:7:"Boolean";s:7:"summary";s:27:"show/update HSV input nodes";}s:32:"dojox.widget.ColorPicker.showHex";a:3:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:7:"Boolean";s:7:"summary";s:27:"show/update Hex value field";}s:32:"dojox.widget.ColorPicker.webSafe";a:3:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:7:"Boolean";s:7:"summary";s:61:"deprecated? or just use a toggle to show/hide that node, too?";}s:37:"dojox.widget.ColorPicker.animatePoint";a:3:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:7:"Boolean";s:7:"summary";s:70:"toggle to use slideTo (true) or just place the cursor (false) on click";}s:38:"dojox.widget.ColorPicker.slideDuration";a:3:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:7:"Integer";s:7:"summary";s:88:"time in ms picker node will slide to next location (non-dragging) when animatePoint=true";}s:35:"dojox.widget.ColorPicker.liveUpdate";a:3:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:7:"Boolean";s:7:"summary";s:52:"Set to true to fire onChange in an indeterminate way";}s:37:"dojox.widget.ColorPicker.PICKER_HUE_H";a:4:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:8:"instance";s:24:"dojox.widget.ColorPicker";s:4:"type";s:3:"int";s:7:"summary";s:53:"Height of the hue picker, used to calculate positions";}s:41:"dojox.widget.ColorPicker.PICKER_SAT_VAL_H";a:4:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:8:"instance";s:24:"dojox.widget.ColorPicker";s:4:"type";s:3:"int";s:7:"summary";s:52:"Height of the 2d picker, used to calculate positions";}s:41:"dojox.widget.ColorPicker.PICKER_SAT_VAL_W";a:4:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:8:"instance";s:24:"dojox.widget.ColorPicker";s:4:"type";s:3:"int";s:7:"summary";s:51:"Width of the 2d picker, used to calculate positions";}s:30:"dojox.widget.ColorPicker.value";a:4:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:8:"instance";s:24:"dojox.widget.ColorPicker";s:4:"type";s:6:"String";s:7:"summary";s:336:"Default color for this component. Only hex values are accepted as incoming/returned values. Adjust this value with `.attr`, eg: dijit.byId("myPicker").attr("value", "#ededed"); to cause the points to adjust and the values to reflect the current color. don't change to d.moduleUrl, build won't intern it.";}s:34:"dojox.widget.ColorPicker._underlay";a:3:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:7:"private";b:1;s:7:"summary";s:0:"";}s:37:"dojox.widget.ColorPicker.templatePath";a:2:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:35:"dojox.widget.ColorPicker.postCreate";a:4:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:6:"source";s:1916:" this.inherited(arguments); // summary: As quickly as we can, set up ie6 alpha-filter support for our // underlay. we don't do image handles (done in css), just the 'core' // of this widget: the underlay. if(d.isIE < 7){ this.colorUnderlay.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this._underlay+"', sizingMethod='scale')"; this.colorUnderlay.src = this._blankGif.toString(); } // hide toggle-able nodes: if(!this.showRgb){ this.rgbNode.style.display = "none"; } if(!this.showHsv){ this.hsvNode.style.display = "none"; } if(!this.showHex){ this.hexNode.style.display = "none"; } if(!this.webSafe){ this.safePreviewNode.style.visibility = "hidden"; } // this._offset = ((d.marginBox(this.cursorNode).w)/2); this._offset = 0; var cmb = d.marginBox(this.cursorNode); var hmb = d.marginBox(this.hueCursorNode); this._shift = { hue: { x: Math.round(hmb.w / 2) - 1, y: Math.round(hmb.h / 2) - 1 }, picker: { x: Math.floor(cmb.w / 2), y: Math.floor(cmb.h / 2) } }; //setup constants this.PICKER_HUE_H = d.coords(this.hueNode).h; var cu = d.coords(this.colorUnderlay); this.PICKER_SAT_VAL_H = cu.h; this.PICKER_SAT_VAL_W = cu.w; var ox = this._shift.picker.x; var oy = this._shift.picker.y; this._mover = new d.dnd.move.boxConstrainedMoveable(this.cursorNode, { box: { t:0 - oy, l:0 - ox, w:this.PICKER_SAT_VAL_W, h:this.PICKER_SAT_VAL_H } }); this._hueMover = new d.dnd.move.boxConstrainedMoveable(this.hueCursorNode, { box: { t:0 - this._shift.hue.y, l:0, w:0, h:this.PICKER_HUE_H } }); // no dnd/move/move published ... use a timer: d.subscribe("/dnd/move/stop", d.hitch(this, "_clearTimer")); d.subscribe("/dnd/move/start", d.hitch(this, "_setTimer"));";s:7:"summary";s:0:"";}s:32:"dojox.widget.ColorPicker.startup";a:4:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:6:"source";s:59:" this._started = true; this.attr("value", this.value);";s:7:"summary";s:0:"";}s:38:"dojox.widget.ColorPicker._setValueAttr";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"value";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:63:" if(!this._started){ return; } this.setColor(value, true);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.widget.ColorPicker.setColor";a:5:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:5:"color";a:1:{s:4:"type";s:6:"String";}s:5:"force";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:152:" var col = dojox.color.fromString(color); this._updatePickerLocations(col); this._updateColorInputs(col); this._updateValue(col, force);";s:7:"summary";s:127:"Set a color on a picker. Usually used to set initial color as an alternative to passing defaultColor option to the constructor.";}s:34:"dojox.widget.ColorPicker._setTimer";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"mover";a:1:{s:4:"type";s:11:"d.dnd.Mover";}}s:6:"source";s:5427:"dojo.provide("dojox.widget.ColorPicker"); dojo.experimental("dojox.widget.ColorPicker"); // level: beta dojo.require("dijit.form._FormWidget"); dojo.require("dojo.dnd.move"); dojo.require("dojo.fx"); dojo.require("dojox.color"); ;(function(d){ var webSafeFromHex = function(hex){ // stub, this is planned later: return hex; } dojo.declare("dojox.widget.ColorPicker", dijit.form._FormWidget, { // summary: a HSV color picker - similar to Photoshop picker // // description: // Provides an interactive HSV ColorPicker similar to // PhotoShop's color selction tool. This is an enhanced // version of the default dijit.ColorPalette, though provides // no accessibility. // // example: // | var picker = new dojox.widget.ColorPicker({ // | // a couple of example toggles: // | animatePoint:false, // | showHsv: false, // | webSafe: false, // | showRgb: false // | }); // // example: // | // | // // showRgb: Boolean // show/update RGB input nodes showRgb: true, // showHsv: Boolean // show/update HSV input nodes showHsv: true, // showHex: Boolean // show/update Hex value field showHex: true, // webSafe: Boolean // deprecated? or just use a toggle to show/hide that node, too? webSafe: true, // animatePoint: Boolean // toggle to use slideTo (true) or just place the cursor (false) on click animatePoint: true, // slideDuration: Integer // time in ms picker node will slide to next location (non-dragging) when animatePoint=true slideDuration: 250, // liveUpdate: Boolean // Set to true to fire onChange in an indeterminate way liveUpdate: false, // PICKER_HUE_H: int // Height of the hue picker, used to calculate positions PICKER_HUE_H: 150, // PICKER_SAT_VAL_H: int // Height of the 2d picker, used to calculate positions PICKER_SAT_VAL_H: 150, // PICKER_SAT_VAL_W: int // Width of the 2d picker, used to calculate positions PICKER_SAT_VAL_W: 150, // value: String // Default color for this component. Only hex values are accepted as incoming/returned // values. Adjust this value with `.attr`, eg: dijit.byId("myPicker").attr("value", "#ededed"); // to cause the points to adjust and the values to reflect the current color. value: "#ffffff", _underlay: d.moduleUrl("dojox.widget","ColorPicker/images/underlay.png"), // don't change to d.moduleUrl, build won't intern it. templatePath: dojo.moduleUrl("dojox.widget","ColorPicker/ColorPicker.html"), postCreate: function(){ this.inherited(arguments); // summary: As quickly as we can, set up ie6 alpha-filter support for our // underlay. we don't do image handles (done in css), just the 'core' // of this widget: the underlay. if(d.isIE < 7){ this.colorUnderlay.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this._underlay+"', sizingMethod='scale')"; this.colorUnderlay.src = this._blankGif.toString(); } // hide toggle-able nodes: if(!this.showRgb){ this.rgbNode.style.display = "none"; } if(!this.showHsv){ this.hsvNode.style.display = "none"; } if(!this.showHex){ this.hexNode.style.display = "none"; } if(!this.webSafe){ this.safePreviewNode.style.visibility = "hidden"; } // this._offset = ((d.marginBox(this.cursorNode).w)/2); this._offset = 0; var cmb = d.marginBox(this.cursorNode); var hmb = d.marginBox(this.hueCursorNode); this._shift = { hue: { x: Math.round(hmb.w / 2) - 1, y: Math.round(hmb.h / 2) - 1 }, picker: { x: Math.floor(cmb.w / 2), y: Math.floor(cmb.h / 2) } }; //setup constants this.PICKER_HUE_H = d.coords(this.hueNode).h; var cu = d.coords(this.colorUnderlay); this.PICKER_SAT_VAL_H = cu.h; this.PICKER_SAT_VAL_W = cu.w; var ox = this._shift.picker.x; var oy = this._shift.picker.y; this._mover = new d.dnd.move.boxConstrainedMoveable(this.cursorNode, { box: { t:0 - oy, l:0 - ox, w:this.PICKER_SAT_VAL_W, h:this.PICKER_SAT_VAL_H } }); this._hueMover = new d.dnd.move.boxConstrainedMoveable(this.hueCursorNode, { box: { t:0 - this._shift.hue.y, l:0, w:0, h:this.PICKER_HUE_H } }); // no dnd/move/move published ... use a timer: d.subscribe("/dnd/move/stop", d.hitch(this, "_clearTimer")); d.subscribe("/dnd/move/start", d.hitch(this, "_setTimer")); }, startup: function(){ this._started = true; this.attr("value", this.value); }, _setValueAttr: function(value){ if(!this._started){ return; } this.setColor(value, true); }, setColor: function(/* String */color, force){ // summary: Set a color on a picker. Usually used to set // initial color as an alternative to passing defaultColor option // to the constructor. var col = dojox.color.fromString(color); this._updatePickerLocations(col); this._updateColorInputs(col); this._updateValue(col, force); }, _setTimer: function(/* d.dnd.Mover */mover){ // FIXME: should I assume this? focus on mouse down so on mouse up dijit.focus(mover.node); d.setSelectable(this.domNode,false); this._timer = setInterval(d.hitch(this, "_updateColor"), 45); ";s:7:"private";b:1;s:7:"summary";s:0:"";}s:36:"dojox.widget.ColorPicker._clearTimer";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"mover";a:1:{s:4:"type";s:11:"d.dnd.Mover";}}s:6:"source";s:122:" clearInterval(this._timer); this._timer = null; this.onChange(this.value); d.setSelectable(this.domNode,true);";s:7:"private";b:1;s:7:"summary";s:0:"";}s:32:"dojox.widget.ColorPicker._setHue";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"h";a:2:{s:4:"type";s:7:"Decimal";s:7:"summary";s:6:"0..360";}}s:6:"source";s:90:" d.style(this.colorUnderlay, "backgroundColor", dojox.color.fromHsv(h,100,100).toHex());";s:7:"summary";s:98:"sets a natural color background for the underlay image against closest hue value (full saturation)";s:7:"private";b:1;}s:37:"dojox.widget.ColorPicker._updateColor";a:5:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:6:"source";s:582:" var _huetop = d.style(this.hueCursorNode,"top") + this._shift.hue.y, _pickertop = d.style(this.cursorNode,"top") + this._shift.picker.y, _pickerleft = d.style(this.cursorNode,"left") + this._shift.picker.x, h = Math.round(360 - (_huetop / this.PICKER_HUE_H * 360)), col = dojox.color.fromHsv(h, _pickerleft / this.PICKER_SAT_VAL_W * 100, 100 - (_pickertop / this.PICKER_SAT_VAL_H * 100)) ; this._updateColorInputs(col); this._updateValue(col, true); // update hue, not all the pickers if (h!=this._hue) { this._setHue(h); }";s:7:"summary";s:57:"update the previewNode color, and input values [optional]";s:7:"private";b:1;}s:42:"dojox.widget.ColorPicker._colorInputChange";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:682:" var col, hasit = false; switch (e.target) { //transform to hsv to pixels case this.hexCode: col = dojox.color.fromString(e.target.value); hasit = true; break; case this.Rval: case this.Gval: case this.Bval: col = dojox.color.fromArray([this.Rval.value, this.Gval.value, this.Bval.value]); hasit = true; break; case this.Hval: case this.Sval: case this.Vval: col = dojox.color.fromHsv(this.Hval.value, this.Sval.value, this.Vval.value); hasit = true; break } if(hasit){ this._updatePickerLocations(col); this._updateColorInputs(col); this._updateValue(col, true); }";s:7:"summary";s:77:"updates picker position and inputs according to rgb, hex or hsv input changes";s:7:"private";b:1;}s:37:"dojox.widget.ColorPicker._updateValue";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:3:"col";a:1:{s:4:"type";s:17:"dojox.color.Color";}s:10:"fireChange";a:1:{s:4:"type";s:7:"Boolean";}}s:6:"source";s:218:" var hex = col.toHex(); this.value = this.valueNode.value = hex; // anytime we muck with the color, fire onChange? if(fireChange && (!this._timer || this.liveUpdate)) { this.onChange(hex); }";s:7:"summary";s:86:"updates the value of the widget can cancel reverse onChange by specifying second param";s:7:"private";b:1;}s:47:"dojox.widget.ColorPicker._updatePickerLocations";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:3:"col";a:1:{s:4:"type";s:17:"dojox.color.Color";}}s:6:"source";s:908:" var hsv = col.toHsv(), ypos = Math.round(this.PICKER_HUE_H - hsv.h / 360 * this.PICKER_HUE_H - this._shift.hue.y), newLeft = Math.round(hsv.s / 100 * this.PICKER_SAT_VAL_W - this._shift.picker.x), newTop = Math.round(this.PICKER_SAT_VAL_H - hsv.v / 100 * this.PICKER_SAT_VAL_H - this._shift.picker.y) ; if (this.animatePoint) { d.fx.slideTo({ node: this.hueCursorNode, duration: this.slideDuration, top: ypos, left: 0 }).play(); d.fx.slideTo({ node: this.cursorNode, duration: this.slideDuration, top: newTop, left: newLeft }).play(); } else { d.style(this.hueCursorNode, "top", ypos + "px"); d.style(this.cursorNode, { left: newLeft + "px", top: newTop + "px" }); } // limit hue calculations to only when it changes if (hsv.h != this._hue) { this._setHue(hsv.h); }";s:7:"summary";s:54:"update handles on the pickers acording to color values";s:7:"private";b:1;}s:43:"dojox.widget.ColorPicker._updateColorInputs";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:3:"col";a:1:{s:4:"type";s:17:"dojox.color.Color";}}s:6:"source";s:571:" var hex = col.toHex(); if (this.showRgb) { this.Rval.value = col.r; this.Gval.value = col.g; this.Bval.value = col.b; } if (this.showHsv) { var hsv = col.toHsv(); this.Hval.value = Math.round((hsv.h)); // convert to 0..360 this.Sval.value = Math.round(hsv.s); this.Vval.value = Math.round(hsv.v); } if (this.showHex) { this.hexCode.value = hex; } this.previewNode.style.backgroundColor = hex; if (this.webSafe) { this.safePreviewNode.style.backgroundColor = webSafeFromHex(hex); }";s:7:"summary";s:88:"updates color inputs that were changed through other inputs or by clicking on the picker";s:7:"private";b:1;}s:37:"dojox.widget.ColorPicker._setHuePoint";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:3:"evt";a:1:{s:4:"type";s:5:"Event";}}s:6:"source";s:349:" var ypos = evt.layerY - this._shift.hue.y; if(this.animatePoint){ d.fx.slideTo({ node: this.hueCursorNode, duration:this.slideDuration, top: ypos, left: 0, onEnd: d.hitch(this, "_updateColor", true) }).play(); }else{ d.style(this.hueCursorNode, "top", ypos + "px"); this._updateColor(false); }";s:7:"summary";s:51:"set the hue picker handle on relative y coordinates";s:7:"private";b:1;}s:34:"dojox.widget.ColorPicker._setPoint";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:3:"evt";a:1:{s:4:"type";s:5:"Event";}}s:6:"source";s:491:" var newTop = evt.layerY - this._shift.picker.y, newLeft = evt.layerX - this._shift.picker.x ; if(evt){ dijit.focus(evt.target); } if(this.animatePoint){ d.fx.slideTo({ node: this.cursorNode, duration: this.slideDuration, top: newTop, left: newLeft, onEnd: d.hitch(this,"_updateColor", true) }).play(); }else{ d.style(this.cursorNode, { left: newLeft + "px", top: newTop + "px" }); this._updateColor(false); }";s:7:"summary";s:76:"set our picker point based on relative x/y coordinates evt.preventDefault();";s:7:"private";b:1;}s:35:"dojox.widget.ColorPicker._handleKey";a:6:{s:9:"prototype";s:24:"dojox.widget.ColorPicker";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:1:"e";a:1:{s:4:"type";s:5:"Event";}}s:6:"source";s:10883:"dojo.provide("dojox.widget.ColorPicker"); dojo.experimental("dojox.widget.ColorPicker"); // level: beta dojo.require("dijit.form._FormWidget"); dojo.require("dojo.dnd.move"); dojo.require("dojo.fx"); dojo.require("dojox.color"); ;(function(d){ var webSafeFromHex = function(hex){ // stub, this is planned later: return hex; } dojo.declare("dojox.widget.ColorPicker", dijit.form._FormWidget, { // summary: a HSV color picker - similar to Photoshop picker // // description: // Provides an interactive HSV ColorPicker similar to // PhotoShop's color selction tool. This is an enhanced // version of the default dijit.ColorPalette, though provides // no accessibility. // // example: // | var picker = new dojox.widget.ColorPicker({ // | // a couple of example toggles: // | animatePoint:false, // | showHsv: false, // | webSafe: false, // | showRgb: false // | }); // // example: // | // | // // showRgb: Boolean // show/update RGB input nodes showRgb: true, // showHsv: Boolean // show/update HSV input nodes showHsv: true, // showHex: Boolean // show/update Hex value field showHex: true, // webSafe: Boolean // deprecated? or just use a toggle to show/hide that node, too? webSafe: true, // animatePoint: Boolean // toggle to use slideTo (true) or just place the cursor (false) on click animatePoint: true, // slideDuration: Integer // time in ms picker node will slide to next location (non-dragging) when animatePoint=true slideDuration: 250, // liveUpdate: Boolean // Set to true to fire onChange in an indeterminate way liveUpdate: false, // PICKER_HUE_H: int // Height of the hue picker, used to calculate positions PICKER_HUE_H: 150, // PICKER_SAT_VAL_H: int // Height of the 2d picker, used to calculate positions PICKER_SAT_VAL_H: 150, // PICKER_SAT_VAL_W: int // Width of the 2d picker, used to calculate positions PICKER_SAT_VAL_W: 150, // value: String // Default color for this component. Only hex values are accepted as incoming/returned // values. Adjust this value with `.attr`, eg: dijit.byId("myPicker").attr("value", "#ededed"); // to cause the points to adjust and the values to reflect the current color. value: "#ffffff", _underlay: d.moduleUrl("dojox.widget","ColorPicker/images/underlay.png"), // don't change to d.moduleUrl, build won't intern it. templatePath: dojo.moduleUrl("dojox.widget","ColorPicker/ColorPicker.html"), postCreate: function(){ this.inherited(arguments); // summary: As quickly as we can, set up ie6 alpha-filter support for our // underlay. we don't do image handles (done in css), just the 'core' // of this widget: the underlay. if(d.isIE < 7){ this.colorUnderlay.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this._underlay+"', sizingMethod='scale')"; this.colorUnderlay.src = this._blankGif.toString(); } // hide toggle-able nodes: if(!this.showRgb){ this.rgbNode.style.display = "none"; } if(!this.showHsv){ this.hsvNode.style.display = "none"; } if(!this.showHex){ this.hexNode.style.display = "none"; } if(!this.webSafe){ this.safePreviewNode.style.visibility = "hidden"; } // this._offset = ((d.marginBox(this.cursorNode).w)/2); this._offset = 0; var cmb = d.marginBox(this.cursorNode); var hmb = d.marginBox(this.hueCursorNode); this._shift = { hue: { x: Math.round(hmb.w / 2) - 1, y: Math.round(hmb.h / 2) - 1 }, picker: { x: Math.floor(cmb.w / 2), y: Math.floor(cmb.h / 2) } }; //setup constants this.PICKER_HUE_H = d.coords(this.hueNode).h; var cu = d.coords(this.colorUnderlay); this.PICKER_SAT_VAL_H = cu.h; this.PICKER_SAT_VAL_W = cu.w; var ox = this._shift.picker.x; var oy = this._shift.picker.y; this._mover = new d.dnd.move.boxConstrainedMoveable(this.cursorNode, { box: { t:0 - oy, l:0 - ox, w:this.PICKER_SAT_VAL_W, h:this.PICKER_SAT_VAL_H } }); this._hueMover = new d.dnd.move.boxConstrainedMoveable(this.hueCursorNode, { box: { t:0 - this._shift.hue.y, l:0, w:0, h:this.PICKER_HUE_H } }); // no dnd/move/move published ... use a timer: d.subscribe("/dnd/move/stop", d.hitch(this, "_clearTimer")); d.subscribe("/dnd/move/start", d.hitch(this, "_setTimer")); }, startup: function(){ this._started = true; this.attr("value", this.value); }, _setValueAttr: function(value){ if(!this._started){ return; } this.setColor(value, true); }, setColor: function(/* String */color, force){ // summary: Set a color on a picker. Usually used to set // initial color as an alternative to passing defaultColor option // to the constructor. var col = dojox.color.fromString(color); this._updatePickerLocations(col); this._updateColorInputs(col); this._updateValue(col, force); }, _setTimer: function(/* d.dnd.Mover */mover){ // FIXME: should I assume this? focus on mouse down so on mouse up dijit.focus(mover.node); d.setSelectable(this.domNode,false); this._timer = setInterval(d.hitch(this, "_updateColor"), 45); }, _clearTimer: function(/* d.dnd.Mover */mover){ clearInterval(this._timer); this._timer = null; this.onChange(this.value); d.setSelectable(this.domNode,true); }, _setHue: function(/* Decimal */h){ // summary: sets a natural color background for the // underlay image against closest hue value (full saturation) // h: 0..360 d.style(this.colorUnderlay, "backgroundColor", dojox.color.fromHsv(h,100,100).toHex()); }, _updateColor: function(){ // summary: update the previewNode color, and input values [optional] var _huetop = d.style(this.hueCursorNode,"top") + this._shift.hue.y, _pickertop = d.style(this.cursorNode,"top") + this._shift.picker.y, _pickerleft = d.style(this.cursorNode,"left") + this._shift.picker.x, h = Math.round(360 - (_huetop / this.PICKER_HUE_H * 360)), col = dojox.color.fromHsv(h, _pickerleft / this.PICKER_SAT_VAL_W * 100, 100 - (_pickertop / this.PICKER_SAT_VAL_H * 100)) ; this._updateColorInputs(col); this._updateValue(col, true); // update hue, not all the pickers if (h!=this._hue) { this._setHue(h); } }, _colorInputChange: function(e){ //summary: updates picker position and inputs // according to rgb, hex or hsv input changes var col, hasit = false; switch (e.target) { //transform to hsv to pixels case this.hexCode: col = dojox.color.fromString(e.target.value); hasit = true; break; case this.Rval: case this.Gval: case this.Bval: col = dojox.color.fromArray([this.Rval.value, this.Gval.value, this.Bval.value]); hasit = true; break; case this.Hval: case this.Sval: case this.Vval: col = dojox.color.fromHsv(this.Hval.value, this.Sval.value, this.Vval.value); hasit = true; break } if(hasit){ this._updatePickerLocations(col); this._updateColorInputs(col); this._updateValue(col, true); } }, _updateValue: function(/* dojox.color.Color */col, /* Boolean */fireChange){ // summary: updates the value of the widget // can cancel reverse onChange by specifying second param var hex = col.toHex(); this.value = this.valueNode.value = hex; // anytime we muck with the color, fire onChange? if(fireChange && (!this._timer || this.liveUpdate)) { this.onChange(hex); } }, _updatePickerLocations: function(/* dojox.color.Color */col){ //summary: update handles on the pickers acording to color values // var hsv = col.toHsv(), ypos = Math.round(this.PICKER_HUE_H - hsv.h / 360 * this.PICKER_HUE_H - this._shift.hue.y), newLeft = Math.round(hsv.s / 100 * this.PICKER_SAT_VAL_W - this._shift.picker.x), newTop = Math.round(this.PICKER_SAT_VAL_H - hsv.v / 100 * this.PICKER_SAT_VAL_H - this._shift.picker.y) ; if (this.animatePoint) { d.fx.slideTo({ node: this.hueCursorNode, duration: this.slideDuration, top: ypos, left: 0 }).play(); d.fx.slideTo({ node: this.cursorNode, duration: this.slideDuration, top: newTop, left: newLeft }).play(); } else { d.style(this.hueCursorNode, "top", ypos + "px"); d.style(this.cursorNode, { left: newLeft + "px", top: newTop + "px" }); } // limit hue calculations to only when it changes if (hsv.h != this._hue) { this._setHue(hsv.h); } }, _updateColorInputs: function(/* dojox.color.Color */col){ //summary: updates color inputs that were changed through other inputs //or by clicking on the picker var hex = col.toHex(); if (this.showRgb) { this.Rval.value = col.r; this.Gval.value = col.g; this.Bval.value = col.b; } if (this.showHsv) { var hsv = col.toHsv(); this.Hval.value = Math.round((hsv.h)); // convert to 0..360 this.Sval.value = Math.round(hsv.s); this.Vval.value = Math.round(hsv.v); } if (this.showHex) { this.hexCode.value = hex; } this.previewNode.style.backgroundColor = hex; if (this.webSafe) { this.safePreviewNode.style.backgroundColor = webSafeFromHex(hex); } }, _setHuePoint: function(/* Event */evt){ // summary: set the hue picker handle on relative y coordinates var ypos = evt.layerY - this._shift.hue.y; if(this.animatePoint){ d.fx.slideTo({ node: this.hueCursorNode, duration:this.slideDuration, top: ypos, left: 0, onEnd: d.hitch(this, "_updateColor", true) }).play(); }else{ d.style(this.hueCursorNode, "top", ypos + "px"); this._updateColor(false); } }, _setPoint: function(/* Event */evt){ // summary: set our picker point based on relative x/y coordinates // evt.preventDefault(); var newTop = evt.layerY - this._shift.picker.y, newLeft = evt.layerX - this._shift.picker.x ; if(evt){ dijit.focus(evt.target); } if(this.animatePoint){ d.fx.slideTo({ node: this.cursorNode, duration: this.slideDuration, top: newTop, left: newLeft, onEnd: d.hitch(this,"_updateColor", true) }).play(); }else{ d.style(this.cursorNode, { left: newLeft + "px", top: newTop + "px" }); this._updateColor(false); } }, _handleKey: function(/* Event */e){ // FIXME: not implemented YET // var keys = d.keys;";s:7:"private";b:1;s:7:"summary";s:0:"";}s:51:"dojox.widget.ColorPicker.colorUnderlay.style.filter";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:42:"dojox.widget.ColorPicker.colorUnderlay.src";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:46:"dojox.widget.ColorPicker.rgbNode.style.display";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:46:"dojox.widget.ColorPicker.hsvNode.style.display";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:46:"dojox.widget.ColorPicker.hexNode.style.display";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:57:"dojox.widget.ColorPicker.safePreviewNode.style.visibility";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:32:"dojox.widget.ColorPicker._offset";a:3:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.widget.ColorPicker._shift";a:3:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.widget.ColorPicker._mover";a:3:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"private";b:1;s:7:"summary";s:0:"";}s:34:"dojox.widget.ColorPicker._hueMover";a:3:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.widget.ColorPicker._started";a:3:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.widget.ColorPicker._timer";a:3:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"private";b:1;s:7:"summary";s:0:"";}s:35:"dojox.widget.ColorPicker.Rval.value";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:35:"dojox.widget.ColorPicker.Gval.value";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:35:"dojox.widget.ColorPicker.Bval.value";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:35:"dojox.widget.ColorPicker.Hval.value";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:35:"dojox.widget.ColorPicker.Sval.value";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:35:"dojox.widget.ColorPicker.Vval.value";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:38:"dojox.widget.ColorPicker.hexCode.value";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:58:"dojox.widget.ColorPicker.previewNode.style.backgroundColor";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:62:"dojox.widget.ColorPicker.safePreviewNode.style.backgroundColor";a:2:{s:8:"instance";s:24:"dojox.widget.ColorPicker";s:7:"summary";s:0:"";}s:12:"dojox.widget";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}