#
luxiaotao1123
2024-10-10 99cc3bb108a9ced40b126778da8bbd34963549b5
zy-acs-flow/src/map/MapPage.jsx
@@ -28,10 +28,10 @@
let player;
const Map = () => {
    const theme = useTheme();
    const themeMode = theme.palette.mode;
    const notify = useNotification();
    const translate = useTranslate();
    const theme = useTheme();
    const themeMode = theme.palette.mode;
    const mapRef = useRef();
    const contentRef = useRef();
@@ -39,8 +39,11 @@
    const [mapContainer, setMapContainer] = useState(null);
    const [mode, setMode] = useState(MapMode.OBSERVER_MODE);
    const [deviceVisible, setDeviceVisible] = React.useState(false);
    const [deviceVisible, setDeviceVisible] = useState(false);
    const [settingsVisible, setSettingsVisible] = useState(false);
    const [spriteSettings, setSpriteSettings] = useState(null);
    const prevSpriteSettingsRef = React.useRef();
    useEffect(() => {
        Tool.patchRaLayout('0px');
@@ -50,6 +53,7 @@
            setMapContainer(player.mapContainer);
            Tool.setApp(player.app);
            Tool.setMapContainer(player.mapContainer);
            Tool.setThemeMode(themeMode);
            Http.setNotify(notify);
            await Http.fetchMapData(0);
@@ -103,6 +107,10 @@
                player.activateMapMultiSelect((selectedSprites, restartFn) => {
                    console.log(selectedSprites);
                });
                mapContainer.children.forEach(child => {
                    Tool.beSettings(child, setSpriteSettings);
                })
                break
            default:
                break
@@ -126,6 +134,26 @@
        Tool.beMovable(sprite);
    };
    // watch spriteSettings
    useEffect(() => {
        if (!mapContainer) {
            return;
        }
        console.log(spriteSettings);
        prevSpriteSettingsRef.current = spriteSettings;
        if (spriteSettings && prevSpriteSettings !== spriteSettings) {
            Tool.removeSelectedEffect();
        }
        if (spriteSettings) {
            Tool.showSelectedEffect(spriteSettings)
            setSettingsVisible(true);
        } else {
            Tool.removeSelectedEffect();
        }
    }, [spriteSettings, mapContainer])
    const prevSpriteSettings = prevSpriteSettingsRef.current;
    const actions = [
        { icon: <FileCopyIcon />, name: '复制' },
        { icon: <SaveIcon />, name: '保存' },