|
@@ -7,6 +7,7 @@ import { switchToMeasurementPanel, switchToMorePanel, switchToAdvancedProcessing
|
|
|
import Icon from '@/components/Icon';
|
|
|
import { showNotImplemented } from '@/utils/notificationHelper';
|
|
|
import { useAppSelector } from '@/states/store';
|
|
|
+import { useButtonAvailability } from '@/utils/useButtonAvailability';
|
|
|
|
|
|
const FunctionButton = ({
|
|
|
title,
|
|
@@ -18,8 +19,14 @@ const FunctionButton = ({
|
|
|
iconName: string;
|
|
|
}) => {
|
|
|
const dispatch = useDispatch();
|
|
|
-const themeType = useAppSelector((state) => state.theme.themeType);
|
|
|
+ const themeType = useAppSelector((state) => state.theme.themeType);
|
|
|
+ const { disabled } = useButtonAvailability(action);
|
|
|
+
|
|
|
const handleButtonClick = () => {
|
|
|
+ if (disabled) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (action === 'AddMark' ||
|
|
|
action === 'Delete Digital Mask' ||
|
|
|
action === 'Crop Selected Area' ||
|
|
@@ -52,6 +59,7 @@ const themeType = useAppSelector((state) => state.theme.themeType);
|
|
|
return (
|
|
|
<Button
|
|
|
onClick={handleButtonClick}
|
|
|
+ disabled={disabled}
|
|
|
icon={
|
|
|
<Icon
|
|
|
module="module-process"
|
|
@@ -69,7 +77,7 @@ const themeType = useAppSelector((state) => state.theme.themeType);
|
|
|
//minWidth: 44, // 保险
|
|
|
//overflow: 'hidden', // 超出的文字裁掉
|
|
|
}}
|
|
|
- title={title}
|
|
|
+ title={disabled ? `${title} (多分格模式下不可用)` : title}
|
|
|
className="truncate-text"
|
|
|
>
|
|
|
{/* {title} */}
|