fix(shortcut): h

This commit is contained in:
zhangheng
2026-04-16 15:39:17 +08:00
parent 1f9436864b
commit 8b89c37a1a
2 changed files with 75 additions and 1 deletions

View File

@@ -1,6 +1,8 @@
import paper from "paper"
import { useLabelStore, useObjectStore } from "../store"
import { useOtherToolsStore } from "../useOtherToolsStore"
import { usePaperStore } from "../usePaperStore"
import { usePaperSupportStore } from "../usePaperSupportStore"
import { useTopToolsStore } from "../useTopToolsStore"
const getTagVisibility = (tagCategory?: string) => {
@@ -22,6 +24,32 @@ const setSelectedItemFalse = (id: number) => {
})
}
const clearHiddenObjectSelectionState = (imageId: string, objectId: number) => {
const { selectedPath, updateSelectedPath } = useObjectStore.getState()
if (selectedPath[imageId]?.includes(objectId)) {
updateSelectedPath(imageId, "DELETE", objectId)
usePaperSupportStore.getState().clearAll()
}
const otherToolsState = useOtherToolsStore.getState()
if (
otherToolsState.showContextMenu &&
otherToolsState.imageId === imageId &&
otherToolsState.id === objectId
) {
otherToolsState.setShowContextMenu({
showContextMenu: false,
position: {
top: 0,
left: 0,
},
imageId: "",
operationId: "",
id: 0,
})
}
}
const syncObjectItemsVisibility = (objectId: number, hide: boolean) => {
const sameIdItems = usePaperStore.getState().getItemsById(objectId)
if (!sameIdItems?.length) return
@@ -51,6 +79,7 @@ export const toggleObjectHideByShortcut = (
updatePathStatus(imageId + objectId, "HIDE", hide)
syncObjectItemsVisibility(objectId, hide)
setSelectedItemFalse(objectId)
clearHiddenObjectSelectionState(imageId, objectId)
const operationChildren = storeLabel.get(imageId)?.get(operationId) || []
const hasVisibleChild = operationChildren.some((child) => {