Add dragging and rotating state management to simulation store; enhance PointsCreator and VehicleUI components

This commit is contained in:
2025-05-02 11:54:40 +05:30
parent 928c683a79
commit 96530b981f
3 changed files with 93 additions and 23 deletions

View File

@@ -114,4 +114,36 @@ export const useSelectedAction = create<SelectedActionState>()(
});
},
}))
);
interface IsDraggingState {
isDragging: "start" | "end" | null;
setIsDragging: (state: "start" | "end" | null) => void;
}
export const useIsDragging = create<IsDraggingState>()(
immer((set) => ({
isDragging: null,
setIsDragging: (state) => {
set((s) => {
s.isDragging = state;
});
},
}))
);
interface IsRotatingState {
isRotating: "start" | "end" | null;
setIsRotating: (state: "start" | "end" | null) => void;
}
export const useIsRotating = create<IsRotatingState>()(
immer((set) => ({
isRotating: null,
setIsRotating: (state) => {
set((s) => {
s.isRotating = state;
});
},
}))
);