mirror of
https://github.com/trafficlunar/blockmatic.git
synced 2026-06-28 06:34:13 +00:00
fix: re-add switching to eraser when using pencil tool with air block
This commit is contained in:
parent
58c30b22bf
commit
e5aaf1486c
2 changed files with 9 additions and 6 deletions
|
|
@ -45,7 +45,7 @@ function Canvas() {
|
|||
const { settings } = useContext(SettingsContext);
|
||||
const { missingTexture } = useContext(TexturesContext);
|
||||
const { isDark } = useContext(ThemeContext);
|
||||
const { tool, radius, setTool } = useContext(ToolContext);
|
||||
const { tool, radius, selectedBlock, setTool } = useContext(ToolContext);
|
||||
|
||||
const textures = useTextures(version);
|
||||
const blockData = useBlockData(version);
|
||||
|
|
@ -125,8 +125,14 @@ function Canvas() {
|
|||
eraser: eraserTool,
|
||||
};
|
||||
|
||||
// Switch to eraser tool if selected block is air when using pencil
|
||||
if (tool === "pencil" && selectedBlock === "air") {
|
||||
eraserTool.use();
|
||||
return;
|
||||
}
|
||||
|
||||
tools[tool]?.use();
|
||||
}, [tool, moveTool, lassoTool, pencilTool, eraserTool, rectangleSelectTool]);
|
||||
}, [tool, selectedBlock, moveTool, lassoTool, pencilTool, eraserTool, rectangleSelectTool]);
|
||||
|
||||
const onMouseMove = useCallback(
|
||||
(e: React.MouseEvent) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue