import React from 'react';
import { Button, Flex } from 'antd';
import '@/themes/truncateText.css';
import { useDispatch } from 'react-redux';
import { setAction } from '@/states/view/functionAreaSlice';
import { switchToMeasurementPanel, switchToMorePanel, switchToAdvancedProcessingPanel, switchToRectCropPanel } from '@/states/panelSwitchSliceForView';
import Icon from '@/components/Icon';
import { showNotImplemented } from '@/utils/notificationHelper';
const FunctionButton = ({
title,
action,
iconName,
}: {
title: string;
action: string;
iconName: string;
}) => {
const dispatch = useDispatch();
const handleButtonClick = () => {
if (action === 'AddMask' ||
action === 'Delete Digital Mask' ||
action === 'Crop Selected Area' ||
['Delete Mask',
'Image Comparison', 'Zoom Image', 'Reset Cursor', 'Pan', 'Snapshot',
].includes(action)
) {
showNotImplemented('');
return;
}
if (action === 'Image Measurement') {
// 切换到测量面板
dispatch(switchToMeasurementPanel());
} else if (action === 'Rectangle Crop') {
// 切换到矩形裁剪面板
dispatch(switchToRectCropPanel());
} else if (action === 'More') {
// 切换到更多功能面板
dispatch(switchToMorePanel());
} else if (action === 'Advanced Processing') {
// 切换到高级图像处理面板
dispatch(switchToAdvancedProcessingPanel());
} else {
// 其他功能按钮保持原有逻辑
dispatch(setAction(action));
}
};
return (
}
style={{
width: '1.5rem',
height: '1.5rem',
padding: 0, // 关键
//minWidth: 44, // 保险
//overflow: 'hidden', // 超出的文字裁掉
}}
title={title}
className="truncate-text"
>
{/* {title} */}
);
};
const FunctionArea = () => {
return (
);
};
export default FunctionArea;