From 012257bb60191fa9879dfac732db4dc12abf896c Mon Sep 17 00:00:00 2001 From: zhangheng Date: Mon, 20 Apr 2026 09:45:21 +0800 Subject: [PATCH] style(code): format --- .../label/components/PaperContainer.tsx | 16 +++++++++++----- components/label/useKeyBoardStore.tsx | 6 ++---- components/label/usePaperStore.ts | 19 ++++++++----------- components/label/utils/objectVisibility.ts | 5 ++++- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/components/label/components/PaperContainer.tsx b/components/label/components/PaperContainer.tsx index c6856b3..247c7b1 100644 --- a/components/label/components/PaperContainer.tsx +++ b/components/label/components/PaperContainer.tsx @@ -499,9 +499,7 @@ const PaperContainer = ( showTags, showTagsConfigs, } = useTopToolsStore() - const showShortcutGuide = useKeyboardStore( - (state) => state.showShortcutGuide - ) + const showShortcutGuide = useKeyboardStore((state) => state.showShortcutGuide) const shortcutGuidePosition = useKeyboardStore( (state) => state.shortcutGuidePosition ) @@ -4311,13 +4309,21 @@ const PaperContainer = ( border: "1px solid light-dark(rgba(34,139,230,0.12), rgba(114,192,252,0.14))", }}> - + 快捷键说明 - 默认靠左显示,可拖动;按 ? 快速开关 + 默认靠左显示,可拖动;按{" "} + + ? + {" "} + 快速开关 ()( [sectionId]: !state.shortcutGuideCollapsedSections[sectionId], }, })), - setDrawAction: (mode) => - set((state) => ({ ...state, drawAction: mode })), + setDrawAction: (mode) => set((state) => ({ ...state, drawAction: mode })), setSelectedObjectEditTarget: (target) => set((state) => ({ ...state, selectedObjectEditTarget: target })), - setCopyDataIds: (ids) => - set((state) => ({ ...state, copyDataIds: ids })), + setCopyDataIds: (ids) => set((state) => ({ ...state, copyDataIds: ids })), }), { name: "keyboard-store", diff --git a/components/label/usePaperStore.ts b/components/label/usePaperStore.ts index b158c07..e562da9 100644 --- a/components/label/usePaperStore.ts +++ b/components/label/usePaperStore.ts @@ -902,9 +902,7 @@ const isPaperObjectType = (type: unknown) => typeof type === "string" && PAPER_OBJECT_TYPES.includes(type as (typeof PAPER_OBJECT_TYPES)[number]) -const syncPaperObjectStrokeScaling = ( - item: paper.Item | null | undefined -) => { +const syncPaperObjectStrokeScaling = (item: paper.Item | null | undefined) => { if (!(item instanceof paper.Path || item instanceof paper.CompoundPath)) { return } @@ -947,9 +945,13 @@ export const ensureEditablePaperPathSelected = (objectId: number) => { if (!objectPaths.length) return null - const editablePaths = objectPaths.filter((item) => !item.data?.isHollowPolygon) + const editablePaths = objectPaths.filter( + (item) => !item.data?.isHollowPolygon + ) const activePath = - editablePaths.find((item) => item.data?.selected) || editablePaths[0] || null + editablePaths.find((item) => item.data?.selected) || + editablePaths[0] || + null objectPaths.forEach((item) => { item.data.selected = item === activePath @@ -6721,12 +6723,7 @@ export const usePaperStore = create((set) => ({ } return circle }, - getBuffPath: ( - item: paper.Segment, - index: number, - id: number, - color: any - ) => { + getBuffPath: (item: paper.Segment, index: number, id: number, color: any) => { if (!item.next) return null const hitStrokeColor = clonePaperColor(color) || new paper.Color("#fff") hitStrokeColor.alpha = 0.001 diff --git a/components/label/utils/objectVisibility.ts b/components/label/utils/objectVisibility.ts index 9b43cf1..7b025c5 100644 --- a/components/label/utils/objectVisibility.ts +++ b/components/label/utils/objectVisibility.ts @@ -1,7 +1,10 @@ import paper from "paper" import { useLabelStore, useObjectStore } from "../store" import { useOtherToolsStore } from "../useOtherToolsStore" -import { ensureEditablePaperPathSelected, usePaperStore } from "../usePaperStore" +import { + ensureEditablePaperPathSelected, + usePaperStore, +} from "../usePaperStore" import { usePaperSupportStore } from "../usePaperSupportStore" import { useTopToolsStore } from "../useTopToolsStore"