From 8b052f65e991c28b5ef4aa490917d2624cad4f62 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 10 十月 2024 17:00:38 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/map/settings/index.jsx       |    3 ++-
 zy-acs-flow/src/map/settings/MapSettings.jsx |   10 ++++++++--
 zy-acs-flow/src/map/MapPage.jsx              |    1 +
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/zy-acs-flow/src/map/MapPage.jsx b/zy-acs-flow/src/map/MapPage.jsx
index ea07aa5..a0688d7 100644
--- a/zy-acs-flow/src/map/MapPage.jsx
+++ b/zy-acs-flow/src/map/MapPage.jsx
@@ -332,6 +332,7 @@
                     setSettingsVisible(false);
                 }}
                 sprite={spriteSettings}
+                setSpriteSettings={setSpriteSettings}
                 width={570}
             />
 
diff --git a/zy-acs-flow/src/map/settings/MapSettings.jsx b/zy-acs-flow/src/map/settings/MapSettings.jsx
index 65a703a..2e3e7a6 100644
--- a/zy-acs-flow/src/map/settings/MapSettings.jsx
+++ b/zy-acs-flow/src/map/settings/MapSettings.jsx
@@ -16,9 +16,10 @@
 } from '@mui/material';
 import MuiInput from '@mui/material/Input';
 import { useTranslate } from 'react-admin';
+import * as Tool from '../tool';
 
 const MapSettings = (props) => {
-    const { sprite, onSubmit } = props;
+    const { sprite, setSpriteSettings, onSubmit } = props;
     const translate = useTranslate();
 
     const { control, handleSubmit, reset, watch } = useForm({
@@ -328,7 +329,12 @@
                 </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>
                     </Stack>
diff --git a/zy-acs-flow/src/map/settings/index.jsx b/zy-acs-flow/src/map/settings/index.jsx
index a8c78a4..810312a 100644
--- a/zy-acs-flow/src/map/settings/index.jsx
+++ b/zy-acs-flow/src/map/settings/index.jsx
@@ -6,7 +6,7 @@
 import MapSettings from './MapSettings';
 
 const Settings = (props) => {
-    const { open, onCancel, sprite, width = PAGE_DRAWER_WIDTH, title } = props;
+    const { open, onCancel, sprite, width = PAGE_DRAWER_WIDTH, title, setSpriteSettings } = props;
     const theme = useTheme();
     const themeMode = theme.palette.mode;
     const translate = useTranslate();
@@ -77,6 +77,7 @@
                                         {activeTab === 0 && (
                                             <MapSettings
                                                 sprite={sprite}
+                                                setSpriteSettings={setSpriteSettings}
                                                 onSubmit={() => {
                                                     alert('MapSettings')
                                                 }}

--
Gitblit v1.9.1