fix(shortcut): h
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user