fix(righttool): fix

This commit is contained in:
zhangheng
2026-04-08 15:14:17 +08:00
parent 9787259b89
commit 1d5e75ab7c
7 changed files with 1755 additions and 190 deletions

View File

@@ -50,6 +50,7 @@ interface PaperState {
initScope: paper.PaperScope,
initGroup: paper.Group
) => void
setGroup: (group: paper.Group | null) => void
setRasterPath: (paperRaster: paper.Path) => void
setRasterScale: (id: string, scale: number) => void
setRasterSize: (id: string, size: [number, number]) => void
@@ -180,6 +181,8 @@ interface PaperState {
getItemsById: (id: number) => Array<paper.Path | paper.CompoundPath>
setContinuePolygonTarget: (target: ContinuePolygonTarget | null) => void
setLoadingData: (flag: boolean) => void
resizeGhostRequestToken: number
requestResizeGhost: () => void
}
interface PositionStore {
@@ -208,6 +211,7 @@ const initialPaperState = {
rasterScale: {},
rasterSize: {},
reciprocalRasterScale: {},
resizeGhostRequestToken: 0,
}
const handleDelete = () => {
const group = usePaperStore.getState().group!
@@ -529,6 +533,7 @@ export const usePaperStore = create<PaperState>((set) => ({
rasterScale: initialPaperState.rasterScale,
rasterSize: initialPaperState.rasterSize,
reciprocalRasterScale: initialPaperState.reciprocalRasterScale,
resizeGhostRequestToken: initialPaperState.resizeGhostRequestToken,
continuePolygonTarget: null,
currentMousePosition: [0, 0],
loadingData: false,
@@ -544,6 +549,12 @@ export const usePaperStore = create<PaperState>((set) => ({
el: initEl,
}))
},
setGroup: (group) => {
set((state: PaperState) => ({
...state,
group,
}))
},
setRasterPath: (rasterPath) => {
set((state: PaperState) => ({
...state,
@@ -577,6 +588,11 @@ export const usePaperStore = create<PaperState>((set) => ({
...state,
loadingData: flag,
})),
requestResizeGhost: () =>
set((state: PaperState) => ({
...state,
resizeGhostRequestToken: state.resizeGhostRequestToken + 1,
})),
setContinuePolygonTarget: (target) =>
set((state: PaperState) => ({
...state,