fix(tool): scale
This commit is contained in:
@@ -329,10 +329,6 @@ const LabelPage = ({
|
||||
const activeRasterScale = usePaperStore(
|
||||
(state) => state.rasterScale[activeImage] ?? 1
|
||||
)
|
||||
const activeRasterSize = usePaperStore(
|
||||
(state) => state.rasterSize[activeImage] ?? null
|
||||
)
|
||||
const currentGroup = usePaperStore((state) => state.group)
|
||||
const {
|
||||
setDescOperations,
|
||||
metaOperation,
|
||||
@@ -347,22 +343,6 @@ const LabelPage = ({
|
||||
viewScale: scale,
|
||||
})
|
||||
}, [activeRasterScale, scale])
|
||||
const scaleOffsets = useMemo(() => {
|
||||
if (!currentGroup || !activeRasterSize?.[0] || !activeRasterSize?.[1]) {
|
||||
return {
|
||||
offsetX: 0,
|
||||
offsetY: 0,
|
||||
}
|
||||
}
|
||||
|
||||
const displayedWidth = activeRasterSize[0] * displayedImageScale
|
||||
const displayedHeight = activeRasterSize[1] * displayedImageScale
|
||||
|
||||
return {
|
||||
offsetX: displayedWidth / 2 - currentGroup.position.x,
|
||||
offsetY: displayedHeight / 2 - currentGroup.position.y,
|
||||
}
|
||||
}, [activeRasterSize, currentGroup, displayedImageScale])
|
||||
|
||||
const asyncGetProjectDetail = useCallback(async () => {
|
||||
if (projectId) {
|
||||
@@ -2727,8 +2707,6 @@ const LabelPage = ({
|
||||
style={{ overflow: "hidden" }}>
|
||||
<ScaleComponent
|
||||
options={{
|
||||
offsetX: scaleOffsets.offsetX,
|
||||
offsetY: scaleOffsets.offsetY,
|
||||
scale: displayedImageScale,
|
||||
}}
|
||||
mode="horizontal"
|
||||
@@ -2736,8 +2714,6 @@ const LabelPage = ({
|
||||
<Flex h="calc(100% - 32px)">
|
||||
<ScaleComponent
|
||||
options={{
|
||||
offsetX: scaleOffsets.offsetX,
|
||||
offsetY: scaleOffsets.offsetY,
|
||||
scale: displayedImageScale,
|
||||
}}
|
||||
mode="vertical"
|
||||
|
||||
Reference in New Issue
Block a user