diff --git a/_src/ui/colorbutton.js b/_src/ui/colorbutton.js index 6bb3d90ae185c57fec6f863978831ddb1b88a400..7a5986259016cc4d3d16c152e892e40108c8b4da 100644 --- a/_src/ui/colorbutton.js +++ b/_src/ui/colorbutton.js @@ -25,18 +25,9 @@ }, onpicknocolor: function (t, color){ me._onPickNoColor(color); - }, - onchangeheight:function(){ - var color = this.getPreview().style.backgroundColor, - popbody = me.popup.getDom("body"); - domUtils.setStyle(popbody,"height",me.popup.getDom("content").offsetHeight+"px"); - me.setColor(color); } }), - editor:me.editor, - onhide:function(){ - this.content.toggleAdv(1); - } + editor:me.editor }); this.initSplitButton(); }, @@ -45,7 +36,7 @@ this._SplitButton_postRender(); this.getDom('button_body').appendChild( uiUtils.createElementByHtml('
') - ); + ); this.getDom().className += ' edui-colorbutton'; }, setColor: function (color){ diff --git a/_src/ui/colorpicker.js b/_src/ui/colorpicker.js index f78b3748942b15f9c0d02aa76a43e31c2af7e690..9cb29afba220ae6aa3714f897b4299271473fe23 100644 --- a/_src/ui/colorpicker.js +++ b/_src/ui/colorpicker.js @@ -2,7 +2,6 @@ ///import uicore (function (){ var utils = baidu.editor.utils, - uiUtils = baidu.editor.ui.uiUtils, UIBase = baidu.editor.ui.UIBase, ColorPicker = baidu.editor.ui.ColorPicker = function (options){ this.initOptions(options); @@ -11,28 +10,9 @@ }; ColorPicker.prototype = { - hue:360, - ishide : true, - saturation:100, - brightness:100, getHtmlTpl: function (){ return genColorPicker(this.noColorText,this.editor); }, - getPad:function(){ - return this.getDom("pad"); - }, - getSliderMain:function(){ - return this.getDom("sliderMain"); - }, - getThumb:function(){ - return this.getDom("thumb"); - }, - getPreview:function(){ - return this.getDom('preview'); - }, - getAdv:function(){ - return this.getDom("adv"); - }, _onTableClick: function (evt){ var tgt = evt.target || evt.srcElement; var color = tgt.getAttribute('data-color'); @@ -44,214 +24,20 @@ var tgt = evt.target || evt.srcElement; var color = tgt.getAttribute('data-color'); if (color) { - this.getPreview().style.backgroundColor = color; + this.getDom('preview').style.backgroundColor = color; } }, _onTableOut: function (){ - this.getPreview().style.backgroundColor = ''; + this.getDom('preview').style.backgroundColor = ''; }, _onPickNoColor: function (){ this.fireEvent('picknocolor'); - }, - _onShowAdv:function(){ - if(browser.ie && browser.version<=6){ - alert("您的浏览器版本太低,请使用高级版本的浏览器") - return; - } - this.toggleAdv(); - }, - toggleAdv:function(ishide){ - var obj = this.getDom("togglehandle"); - if(ishide&&this.ishide){ - return; - } - this.getAdv().style.display=this.ishide?"block":"none"; - domUtils.removeClasses(obj,["arrow_down","arrow_up"]); - this.ishide?domUtils.addClass(obj,"arrow_up"):domUtils.addClass(obj,"arrow_down"); - this.ishide = !this.ishide; - this.fireEvent("changeheight"); - }, - _onPadDotMouseDown:function(evt){ - var me = this; - uiUtils.startDrag(evt, { - ondragstart: function (){}, - ondragmove: function (x, y,evt){ - me._onClickPad(evt); - }, - ondragstop:function(){} - }); - }, - /** - * 校准value值,保证它在合理范围内 - * @private - * @param {Number} x 范围上限,被校准的数值不能超过这个数值. - * @param {Number} y 需要校准的数值. - * @return {Number} 校准过的数值. - */ - _adjustValue: function(x, y) { - return Math.max(0, Math.min(x, y)); - }, - _onClickPad:function(evt){ - var me = this, - paddot = me.getDom("paddot"), - pdrect = uiUtils.getClientRect(paddot), - rect = uiUtils.getClientRect(me.getPad()), - evtoffset = uiUtils.getViewportOffsetByEvent(evt); - //计算鼠标坐标相对调色板左上角距离 - me.padDotY = me._adjustValue(rect.height, evtoffset.top - rect.top); - me.padDotX = me._adjustValue(rect.width, evtoffset.left - rect.left); - - me.safeSetOffset(paddot,{ - top: me.padDotY-pdrect.height/2 , - left: me.padDotX-pdrect.width/2 - }); - - me.saturation = parseInt(100 * me.padDotX / rect.width, 10); //根据调色块top值计算饱和度 - me.brightness = parseInt(100 * (rect.height - me.padDotY) / rect.height, 10); //根据调色块left值计算亮度 - me._setNewColor(); - - }, - /** - * 将rgb格式转成hex格式 - * @private - * @param {Object} rgb rgb格式颜色值. - * @return {String} hex格式颜色值. - */ - _RGBToHex: function(rgb) { - var hex = [rgb.r.toString(16), rgb.g.toString(16), rgb.b.toString(16)]; - for(var i= 0;i'+editor.getLang("themeColor")+' | |||||||||
'+editor.getLang("standardColor")+' | |||||||||
':''; + '"' + + '>':''; } - html += ' |