From 5e8abc7b6a8ec01d3ce89f42baaf63cc57e91ee0 Mon Sep 17 00:00:00 2001 From: Tangjinxia <1119518763@qq.com> Date: Wed, 3 Nov 2021 19:33:40 +0800 Subject: [PATCH] =?UTF-8?q?CHART-21632=20fix:=E4=B8=8E=E4=BA=A4=E4=BA=92?= =?UTF-8?q?=E6=B2=9F=E9=80=9A=EF=BC=8C=E8=87=AA=E5=8A=A8/=E9=80=8F?= =?UTF-8?q?=E6=98=8E=E6=8C=89=E9=92=AE=E5=86=8D=E6=AC=A1=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=8F=96=E6=B6=88=E9=80=89=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../colorpicker/editor.colorpicker.hex.js | 30 ++++--------------- .../colorpicker/editor.colorpicker.js | 30 ++++--------------- 2 files changed, 12 insertions(+), 48 deletions(-) diff --git a/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js b/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js index 6aa07afe8..83b7b9462 100644 --- a/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js +++ b/src/case/colorchooser/colorpicker/editor.colorpicker.hex.js @@ -72,20 +72,9 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, { listeners: [{ eventName: BI.ColorChooserShowButton.EVENT_CHANGE, action: function () { - if (this.isSelected()) { - self.lastColor = self.getValue(); - self.setValue("transparent"); - } else { - if (self.lastColor === "transparent") { - self.lastColor = ""; - } - self.setValue(self.lastColor || "#ffffff"); - } - if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || - self._isEmptyRGB()) { - self.colorShow.element.css("background-color", self.getValue()); - self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); - } + var value = self.getValue(); + self.setValue("transparent"); + (value !== "transparent") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); } }], ref: function (_ref) { @@ -101,16 +90,9 @@ BI.HexColorPickerEditor = BI.inherit(BI.Widget, { listeners: [{ eventName: BI.ColorChooserShowButton.EVENT_CHANGE, action: function () { - if (this.isSelected()) { - self.lastColor = self.getValue(); - self.setValue(""); - } else { - self.setValue(self.lastColor || "#ffffff"); - } - if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || self._isEmptyRGB()) { - self.colorShow.element.css("background-color", self.getValue()); - self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); - } + var value = self.getValue(); + self.setValue(""); + (value !== "") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); } }], ref: function (_ref) { diff --git a/src/case/colorchooser/colorpicker/editor.colorpicker.js b/src/case/colorchooser/colorpicker/editor.colorpicker.js index 4be3375a4..9d0dbbca0 100644 --- a/src/case/colorchooser/colorpicker/editor.colorpicker.js +++ b/src/case/colorchooser/colorpicker/editor.colorpicker.js @@ -72,16 +72,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, { title: BI.i18nText("BI-Basic_Auto") }); this.none.on(BI.IconButton.EVENT_CHANGE, function () { - if (this.isSelected()) { - self.lastColor = self.getValue(); - self.setValue(""); - } else { - self.setValue(self.lastColor || "#ffffff"); - } - if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || self._isEmptyRGB()) { - self.colorShow.element.css("background-color", self.getValue()); - self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); - } + var value = self.getValue(); + self.setValue(""); + (value !== "") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); }); this.transparent = BI.createWidget({ @@ -94,20 +87,9 @@ BI.ColorPickerEditor = BI.inherit(BI.Widget, { title: BI.i18nText("BI-Transparent_Color") }); this.transparent.on(BI.IconButton.EVENT_CHANGE, function () { - if (this.isSelected()) { - self.lastColor = self.getValue(); - self.setValue("transparent"); - } else { - if (self.lastColor === "transparent") { - self.lastColor = ""; - } - self.setValue(self.lastColor || "#ffffff"); - } - if ((self.R.isValid() && self.G.isValid() && self.B.isValid()) || - self._isEmptyRGB()) { - self.colorShow.element.css("background-color", self.getValue()); - self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); - } + var value = self.getValue(); + self.setValue("transparent"); + (value !== "transparent") && self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); }); BI.createWidget({