fix(righttool): fix

This commit is contained in:
zhangheng
2026-04-08 15:14:17 +08:00
parent 9787259b89
commit 1d5e75ab7c
7 changed files with 1755 additions and 190 deletions

View File

@@ -158,7 +158,7 @@ const TopTools = (
renderPolygons,
} = props
const { backUrl, basePath } = useBackUrlStore()
const { mode, loadingData } = usePaperStore()
const { mode, loadingData, requestResizeGhost } = usePaperStore()
const router = useRouter()
const user_id = usePermissionStore.getState().user_id
@@ -232,6 +232,32 @@ const TopTools = (
const autoSaveGap = useIntervalStore((state) => state.autoSaveGap)
const setAutoSaveGap = useIntervalStore((state) => state.setAutoSaveGap)
const visibleRightPanelCount = useMemo(() => {
return [
showTaskList,
showGroupList,
showDescList &&
!!projectDetail &&
[5, 6].includes(projectDetail.label_type),
showObjectList,
].filter(Boolean).length
}, [projectDetail, showDescList, showGroupList, showObjectList, showTaskList])
const toggleRightPanel = useCallback(
(visible: boolean, setter: (val: boolean) => void) => {
const nextVisible = !visible
const nextCount = visibleRightPanelCount + (nextVisible ? 1 : -1)
if (
(visibleRightPanelCount === 0 && nextCount === 1) ||
(visibleRightPanelCount === 1 && nextCount === 0)
) {
requestResizeGhost()
}
setter(nextVisible)
},
[requestResizeGhost, visibleRightPanelCount]
)
// 当前是否可以操作功能按键
const currentEditAuth = useMemo(() => {
if (!taskDetail) return false
@@ -2432,7 +2458,7 @@ const TopTools = (
c={!showTaskList ? "gray" : "var(--mantine-color-text)"}
style={{ width: "auto", display: "flex", gap: 4 }}
onClick={() => {
setShowTaskList(!showTaskList)
toggleRightPanel(showTaskList, setShowTaskList)
}}>
<ClipboardList style={{ width: 20, height: 20 }} />
<Text size="xs"></Text>
@@ -2452,7 +2478,7 @@ const TopTools = (
c={!showGroupList ? "gray" : "var(--mantine-color-text)"}
style={{ width: "auto", display: "flex", gap: 4 }}
onClick={() => {
setShowGroupList(!showGroupList)
toggleRightPanel(showGroupList, setShowGroupList)
}}>
<GroupIcon style={{ width: 20, height: 20 }} />
<Text size="xs"></Text>
@@ -2463,7 +2489,7 @@ const TopTools = (
c={!showDescList ? "gray" : "var(--mantine-color-text)"}
style={{ width: "auto", display: "flex", gap: 4 }}
onClick={() => {
setShowDescList(!showDescList)
toggleRightPanel(showDescList, setShowDescList)
}}>
<BadgeInfoIcon style={{ width: 20, height: 20 }} />
<Text size="xs"></Text>
@@ -2474,7 +2500,7 @@ const TopTools = (
c={!showObjectList ? "gray" : "var(--mantine-color-text)"}
style={{ width: "auto", display: "flex", gap: 4 }}
onClick={() => {
setShowObjectList(!showObjectList)
toggleRightPanel(showObjectList, setShowObjectList)
}}>
<Component style={{ width: 20, height: 20 }} />
<Text size="xs"></Text>