style(code): format

This commit is contained in:
zhangheng
2026-04-20 10:33:59 +08:00
parent 821859bfb7
commit 4a3930abac
4 changed files with 38 additions and 279 deletions

View File

@@ -59,12 +59,12 @@ import { useTopToolsStore } from "../useTopToolsStore"
import { buildSubAttributeFormValues, checkCommentsIsSame } from "../util"
import { safeClone } from "../utils/clone"
import { labelTypeMap } from "../utils/constants"
import { filterMultiPolygonByAreaThreshold } from "../utils/geometry/areaFilter"
import {
contoursToMultiPolygon,
multiPolygonToStoredContours,
paperShapeToMultiPolygon,
} from "../utils/geometry/booleanAdapter"
import { filterMultiPolygonByAreaThreshold } from "../utils/geometry/areaFilter"
import { adjustPoints } from "../utils/paperjs"
import AssistShapeComponent from "./AssistShapeComponent"
import CrosshairComponent from "./CrosshairComponent"
@@ -1177,11 +1177,9 @@ const PaperContainer = (
const getMinAreaBySizeThreshold = useCallback(
(sizeThreshold: number) => {
const normalizedSizeThreshold = Math.max(
0,
Number(sizeThreshold) || 0
)
const currentScale = usePaperStore.getState().rasterScale[activeImage] ?? 1
const normalizedSizeThreshold = Math.max(0, Number(sizeThreshold) || 0)
const currentScale =
usePaperStore.getState().rasterScale[activeImage] ?? 1
return (
normalizedSizeThreshold *
normalizedSizeThreshold *
@@ -1274,14 +1272,17 @@ const PaperContainer = (
return
}
const { geometry, removedOuterCount: currentRemovedOuterCount, removedHoleCount: currentRemovedHoleCount } =
filterMultiPolygonByAreaThreshold({
geometry: contoursToMultiPolygon({
outerContours: oldData[1],
holeContours: oldData[3],
}),
minArea,
})
const {
geometry,
removedOuterCount: currentRemovedOuterCount,
removedHoleCount: currentRemovedHoleCount,
} = filterMultiPolygonByAreaThreshold({
geometry: contoursToMultiPolygon({
outerContours: oldData[1],
holeContours: oldData[3],
}),
minArea,
})
if (!currentRemovedOuterCount && !currentRemovedHoleCount) {
return
@@ -1291,12 +1292,10 @@ const PaperContainer = (
removedHoleCount += currentRemovedHoleCount
if (!geometry.length) {
nextLabel
.get(activeImage)
?.set(
operationId,
operationData.filter((item) => item[0] !== selectedId)
)
nextLabel.get(activeImage)?.set(
operationId,
operationData.filter((item) => item[0] !== selectedId)
)
removedObjectCount += 1
removedPathIds.push(selectedId)
removedParentGroupIds.push(oldData[2]?.parentGroupId)
@@ -1344,7 +1343,9 @@ const PaperContainer = (
labelData: nextLabel,
})
removedPathIds.forEach((pathId) => {
useObjectStore.getState().updateSelectedPath(activeImage, "DELETE", pathId)
useObjectStore
.getState()
.updateSelectedPath(activeImage, "DELETE", pathId)
})
}
@@ -1375,7 +1376,9 @@ const PaperContainer = (
}
function filterBySizeThreshold() {
const sizeThreshold = Number(useTopToolsStore.getState().auxiliarySizeThreshold)
const sizeThreshold = Number(
useTopToolsStore.getState().auxiliarySizeThreshold
)
if (!Number.isFinite(sizeThreshold) || sizeThreshold <= 0) {
notifications.show({
@@ -1407,8 +1410,7 @@ const PaperContainer = (
loading: true,
autoClose: false,
})
const { strokeColor, fillColor, blankColor } =
getSupportPreviewColors()
// const { strokeColor, fillColor, blankColor } = getSupportPreviewColors()
const currentScale =
usePaperStore.getState().rasterScale[activeImage] ?? 1
@@ -1503,7 +1505,8 @@ const PaperContainer = (
.map((contour: any, index: number) => {
if (hollows[index]) return null
return normalizeContour(contour).map(
([x, y]) => [x * currentScale, y * currentScale] as [number, number]
([x, y]) =>
[x * currentScale, y * currentScale] as [number, number]
)
})
.filter(
@@ -1513,7 +1516,8 @@ const PaperContainer = (
.map((contour: any, index: number) => {
if (!hollows[index]) return null
return normalizeContour(contour).map(
([x, y]) => [x * currentScale, y * currentScale] as [number, number]
([x, y]) =>
[x * currentScale, y * currentScale] as [number, number]
)
})
.filter(
@@ -1545,7 +1549,12 @@ const PaperContainer = (
}
}
},
[activeImage, getSupportPreviewColors, projectDetail, renderSupportPreviewGeometry]
[
activeImage,
// getSupportPreviewColors,
projectDetail,
renderSupportPreviewGeometry,
]
)
// const renderTrackingAnnotation = useCallback(async () => {

View File

@@ -242,9 +242,8 @@ const TopTools = (
setMagnetFlag,
} = useTopToolsStore()
const [nodeSizeInput, setNodeSizeInput] = useState<number | string>(nodeSize)
const [auxiliarySizeThresholdInput, setAuxiliarySizeThresholdInput] = useState<
number | string
>(auxiliarySizeThreshold)
const [auxiliarySizeThresholdInput, setAuxiliarySizeThresholdInput] =
useState<number | string>(auxiliarySizeThreshold)
const { pathGroupMap } = useRightToolsStore()
const isAutoSave = useIntervalStore((state) => state.isAutoSave)