From ae9f5505eb01efdfd6a7a6ac9d84b77aa741052d Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期五, 11 十月 2024 14:05:45 +0800 Subject: [PATCH] # --- zy-acs-flow/src/map/settings/MapSettings.jsx | 34 +++++++++++++++++++++++++--------- 1 files changed, 25 insertions(+), 9 deletions(-) diff --git a/zy-acs-flow/src/map/settings/MapSettings.jsx b/zy-acs-flow/src/map/settings/MapSettings.jsx index 65a703a..8770a27 100644 --- a/zy-acs-flow/src/map/settings/MapSettings.jsx +++ b/zy-acs-flow/src/map/settings/MapSettings.jsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { useForm, Controller } from 'react-hook-form'; import { Box, @@ -16,10 +16,14 @@ } from '@mui/material'; import MuiInput from '@mui/material/Input'; import { useTranslate } from 'react-admin'; +import * as Tool from '../tool'; +import ConfirmButton from '../../page/components/ConfirmButton'; +import CopyDrawer from './CopyDrawer'; const MapSettings = (props) => { - const { sprite, onSubmit } = props; + const { sprite, setSpriteSettings, onSubmit, width } = props; const translate = useTranslate(); + const [copyVisible, setCopyVisible] = useState(false); const { control, handleSubmit, reset, watch } = useForm({ defaultValues: { @@ -30,27 +34,24 @@ rotation: (sprite?.rotation * 180) / Math.PI || 0, copyDirection: 'right', copyCount: 1, - // 鍏朵粬榛樿鍊�... }, }); - // 鐩戝惉鎵�鏈夊瓧娈电殑鍙樺寲 const watchAllFields = watch(); useEffect(() => { if (sprite) { + setCopyVisible(false); reset({ x: sprite.position.x, y: sprite.position.y, scaleX: sprite.scale.x, scaleY: sprite.scale.y, rotation: (sprite.rotation * 180) / Math.PI, - // 璁剧疆鍏朵粬瀛楁鐨勫垵濮嬪�� }); } }, [sprite, reset]); - // 鏇存柊绮剧伒灞炴�х殑鍑芥暟 const updateSprite = (data) => { if (sprite) { sprite.position.x = data.x; @@ -58,7 +59,6 @@ sprite.scale.x = data.scaleX; sprite.scale.y = data.scaleY; sprite.rotation = (data.rotation * Math.PI) / 180; - // 鏇存柊鍏朵粬灞炴��... } }; @@ -307,7 +307,9 @@ </Grid> <Grid item xs={12}> <Stack direction="row" spacing={2}> - <Button variant="contained" color="primary"> + <Button variant="contained" color="primary" onClick={() => { + setCopyVisible(true); + }}> {translate('page.map.settings.map.copy.execute')} </Button> <Button variant="text" color="primary"> @@ -315,6 +317,14 @@ </Button> </Stack> </Grid> + + <CopyDrawer + open={copyVisible} + onCancel={() => { + setCopyVisible(false); + }} + width={width} + /> <Grid item xs={12}> <Divider /> @@ -328,9 +338,15 @@ </Grid> <Grid item xs={12}> <Stack direction="row" spacing={2}> - <Button variant="outlined" color="error"> + <Button variant="outlined" color="error" onClick={() => { + Tool.getMapContainer().removeChild(sprite); + setSpriteSettings(null); + Tool.removeSelectedEffect(); + reset(); + }}> {translate('ra.action.delete')} </Button> + {/* <ConfirmButton /> */} </Stack> </Grid> </Grid> -- Gitblit v1.9.1