From 625b43c5952a0c602e28e27d441c5484f2f487a3 Mon Sep 17 00:00:00 2001 From: xujiang Date: Fri, 23 Oct 2020 08:58:27 +0800 Subject: [PATCH] =?UTF-8?q?:hammer:=20=E9=87=8D=E6=9E=84=E7=94=BB=E5=B8=83?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=A4=8D=E4=BD=8D=E6=8E=A7=E4=BB=B6,=20?= =?UTF-8?q?=E6=8B=86=E6=88=90=E5=8D=95=E7=8B=AC=E7=BB=84=E4=BB=B6=E4=BB=A5?= =?UTF-8?q?=E5=87=8F=E5=B0=8F=E4=B8=BB=E6=96=87=E4=BB=B6=E4=BB=A3=E7=A0=81?= =?UTF-8?q?,=E6=8F=90=E9=AB=98=E7=BB=B4=E6=8A=A4=E6=80=A7,=E5=90=8E?= =?UTF-8?q?=E6=9C=9F=E7=BB=B4=E6=8A=A4=E5=BB=BA=E8=AE=AE=E5=8D=95=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=A1=8C=E6=95=B0=E4=B8=8D=E8=83=BD=E8=B6=85=E8=BF=87?= =?UTF-8?q?300=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/editor/Container.tsx | 47 +++++-------------- .../components/CanvasControl/index.less | 37 +++++++++++++++ .../editor/components/CanvasControl/index.tsx | 43 +++++++++++++++++ src/pages/editor/index.less | 37 --------------- 4 files changed, 93 insertions(+), 71 deletions(-) create mode 100644 src/pages/editor/components/CanvasControl/index.less create mode 100644 src/pages/editor/components/CanvasControl/index.tsx diff --git a/src/pages/editor/Container.tsx b/src/pages/editor/Container.tsx index e9b818a..fa5117d 100644 --- a/src/pages/editor/Container.tsx +++ b/src/pages/editor/Container.tsx @@ -11,6 +11,7 @@ import { } from '@ant-design/icons'; import { connect } from 'dva'; import HeaderComponent from './components/Header'; +import CanvasControl from './components/CanvasControl'; import SourceBox from './SourceBox'; import TargetBox from './TargetBox'; import Calibration from 'components/Calibration'; @@ -184,6 +185,7 @@ const Container = (props: { dispatch(ActionCreators.redo()); }; }, [dispatch]); + const undohandler = useMemo(() => { return () => { dispatch(ActionCreators.undo()); @@ -381,6 +383,11 @@ const Container = (props: { } }; }, []); + + const updateDrag = useCallback(() => { + setDragState({ x: 0, y: 0 }); + }, []); + const mousemovefn = useMemo(() => { return (e: React.MouseEvent) => { if (diffmove.move) { @@ -509,40 +516,12 @@ const Container = (props: { allType={allType} /> {/* TODO ζš‚ζ—Άιšθ— */} - {/*
- setDragState({ x: 0, y: 0 })} /> -
*/} - {/*
{render}
*/} -
- - + - - {scaleNum * 100}% - - - - - - - - - setDragState({ x: 0, y: 0 })} /> - -
- {/*
- -
*/} + {renderRight}
): void; + updateDrag(event: MouseEvent): void; +} + +const CanvasControl = (props: CanvasControlProps) => { + const { scaleNum, handleSlider, backSize, updateDrag } = props; + return ( +
+ + + + + {scaleNum * 100}% + + - + + + + + + + +
+ ); +}; + +export default CanvasControl; diff --git a/src/pages/editor/index.less b/src/pages/editor/index.less index 00a0af6..2137dc5 100644 --- a/src/pages/editor/index.less +++ b/src/pages/editor/index.less @@ -192,43 +192,6 @@ bottom: 380px; right: 5px; } - .sliderWrap { - position: absolute; - display: inline-block; - right: 10px; - bottom: 10px; - height: 32px; - line-height: 30px; - background: #ffffff; - box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.1); - border-radius: 4px; - color: #4a4a4a; - .slider { - position: absolute; - right: 30px; - bottom: 95px; - font-size: 14px; - } - .sliderBtn { - cursor: pointer; - user-select: none; - display: inline; - font-size: 14px; - color: #4a4a4a; - } - span { - margin: 0 8px; - } - .backSize { - cursor: pointer; - color: #4a4a4a; - &::before { - content: '|'; - color: #dbdbdb; - margin-right: 7px; - } - } - } } .attrSetting { width: 304px;