From ab5e8c39a3c523a4b5cb01e6a51db490bcfc16d0 Mon Sep 17 00:00:00 2001 From: huangchen1031 Date: Thu, 19 Sep 2024 14:04:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(color-picker):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=B8=90=E5=8F=98=E6=A8=A1=E5=BC=8F=E4=B8=8B=EF=BC=8C=E6=98=8E?= =?UTF-8?q?=E5=BA=A6=E6=BB=91=E5=9D=97=E5=92=8C=E6=B8=90=E5=8F=98=E6=BB=91?= =?UTF-8?q?=E5=9D=97=E9=A2=9C=E8=89=B2=E4=B8=8D=E8=81=94=E5=8A=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/color-picker/components/panel/linear-gradient.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/color-picker/components/panel/linear-gradient.tsx b/src/color-picker/components/panel/linear-gradient.tsx index e1694ee381..8f68809f6c 100644 --- a/src/color-picker/components/panel/linear-gradient.tsx +++ b/src/color-picker/components/panel/linear-gradient.tsx @@ -30,12 +30,14 @@ const LinearGradient = (props) => { const [selectedId, setSelectedId] = useState(props.color.gradientSelectedId); const selectedRef = useRef(props.color.gradientSelectedId); const colors = useRef(cloneDeep(color.gradientColors)); + const [colorsState, setColorsState] = useState(colors.current); useEffect(() => { degree.current = color?.gradientDegree; setSelectedId(color.gradientSelectedId); selectedRef.current = color.gradientSelectedId; colors.current = cloneDeep(color.gradientColors); + setColorsState(colors.current); }, [color.gradientColors, color?.gradientDegree, color.gradientSelectedId, color.value, color.saturation]); const updateSliderRect = () => { @@ -83,6 +85,7 @@ const LinearGradient = (props) => { return; } colors.current = value; + setColorsState(value); handleChange('colors', value, isEnded); }, [props.disabled, handleChange], @@ -228,7 +231,7 @@ const LinearGradient = (props) => { e.stopPropagation(); }; - const allGradientColors = [...colors.current]; + const allGradientColors = [...colorsState]; const { color: leftColor } = genGradientPoint(0, allGradientColors[0]?.color); const { color: rightColor } = genGradientPoint(100, allGradientColors[allGradientColors.length - 1]?.color); @@ -253,7 +256,7 @@ const LinearGradient = (props) => { background: thumbBackground, }} > - {colors.current.map((t) => { + {colorsState.map((t) => { const left = `${Math.round(t.left * 100) / 100}%`; return (
  • Date: Mon, 23 Sep 2024 11:29:05 +0800 Subject: [PATCH 2/2] chore: update common --- src/_common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_common b/src/_common index fe449a2ad4..ddf8006355 160000 --- a/src/_common +++ b/src/_common @@ -1 +1 @@ -Subproject commit fe449a2ad4a247e0abb49e995f459c19644d8bbf +Subproject commit ddf8006355ee1a42a91b7c10f090389071bc7eaf