mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 06:34:13 +00:00
feat: edit menu - cut and clear selection
This commit is contained in:
parent
5b8a859f60
commit
feb82f2b17
4 changed files with 54 additions and 3 deletions
|
|
@ -4,10 +4,12 @@ interface Context {
|
|||
tool: Tool;
|
||||
radius: number;
|
||||
selectedBlock: string;
|
||||
selectionBoxBounds: BoundingBox;
|
||||
cssCursor: string;
|
||||
setTool: React.Dispatch<React.SetStateAction<Tool>>;
|
||||
setRadius: React.Dispatch<React.SetStateAction<number>>;
|
||||
setSelectedBlock: React.Dispatch<React.SetStateAction<string>>;
|
||||
setSelectionBoxBounds: React.Dispatch<React.SetStateAction<BoundingBox>>;
|
||||
setCssCursor: React.Dispatch<React.SetStateAction<string>>;
|
||||
}
|
||||
|
||||
|
|
@ -21,6 +23,7 @@ export const ToolProvider = ({ children }: Props) => {
|
|||
const [tool, setTool] = useState<Tool>("hand");
|
||||
const [radius, setRadius] = useState(1);
|
||||
const [selectedBlock, setSelectedBlock] = useState("stone");
|
||||
const [selectionBoxBounds, setSelectionBoxBounds] = useState<BoundingBox>({ minX: 0, minY: 0, maxX: 0, maxY: 0 });
|
||||
const [cssCursor, setCssCursor] = useState("crosshair");
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -39,7 +42,20 @@ export const ToolProvider = ({ children }: Props) => {
|
|||
}, [tool]);
|
||||
|
||||
return (
|
||||
<ToolContext.Provider value={{ tool, radius, selectedBlock, cssCursor, setTool, setRadius, setSelectedBlock, setCssCursor }}>
|
||||
<ToolContext.Provider
|
||||
value={{
|
||||
tool,
|
||||
radius,
|
||||
selectedBlock,
|
||||
selectionBoxBounds,
|
||||
cssCursor,
|
||||
setTool,
|
||||
setRadius,
|
||||
setSelectedBlock,
|
||||
setSelectionBoxBounds,
|
||||
setCssCursor,
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
</ToolContext.Provider>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue