From 2fbab8881b50bd87f0931ba260e5371f9837691b Mon Sep 17 00:00:00 2001 From: zhangjinlong Date: Thu, 8 Oct 2020 17:12:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201=E3=80=81=E9=BB=98=E8=AE=A4=E5=B7=A6?= =?UTF-8?q?=E4=BE=A7=E5=B1=95=E5=BC=80=202=E3=80=81=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=EF=BC=8C=E5=8F=B3=E4=BE=A7=E5=B1=95=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/editor/Container.tsx | 7 ++++++- src/pages/editor/SourceBox.tsx | 2 ++ src/pages/editor/models/editorModal.js | 8 ++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/pages/editor/Container.tsx b/src/pages/editor/Container.tsx index 1aa32de..5744b7b 100644 --- a/src/pages/editor/Container.tsx +++ b/src/pages/editor/Container.tsx @@ -43,7 +43,7 @@ const Container = (props: { dispatch?: any; }) => { const [scaleNum, setScale] = useState(1); - const [collapsed, setCollapsed] = useState(true); + const [collapsed, setCollapsed] = useState(false); const [rightColla, setRightColla] = useState(true); const { pstate, cstate, dispatch } = props; const pointData = pstate ? pstate.pointData : []; @@ -193,6 +193,11 @@ const Container = (props: { } //待修改 // eslint-disable-next-line react-hooks/exhaustive-deps }, []); + useEffect(() => { + if (pstate.curPoint && pstate.curPoint.status === 'inToCanvas' && rightColla) { + changeRightColla(false); + } + }, [pstate.curPoint]); const allType = useMemo(() => { let arr: string[] = []; diff --git a/src/pages/editor/SourceBox.tsx b/src/pages/editor/SourceBox.tsx index 6554964..e27a1cf 100644 --- a/src/pages/editor/SourceBox.tsx +++ b/src/pages/editor/SourceBox.tsx @@ -55,6 +55,7 @@ const SourceBox = memo((props: SourceBoxProps) => { id: uuid(6, 10), item, point: { i: `x-${pointData.length}`, x: 0, y: gridY, w, h: item.h, isBounded: true }, + status: 'inToCanvas', }, }); } else { @@ -71,6 +72,7 @@ const SourceBox = memo((props: SourceBoxProps) => { h: item.h, isBounded: true, }, + status: 'inToCanvas', }, }); } diff --git a/src/pages/editor/models/editorModal.js b/src/pages/editor/models/editorModal.js index 2ad5d7e..28f2552 100644 --- a/src/pages/editor/models/editorModal.js +++ b/src/pages/editor/models/editorModal.js @@ -1,3 +1,11 @@ +/* + * @Description: + * @Version: 2.0 + * @Autor: dragon + * @Date: 2020-09-24 10:11:24 + * @LastEditors: dragon + * @LastEditTime: 2020-10-08 16:12:26 + */ const pointData = localStorage.getItem('userData') || '[]'; function overSave(name, data) {