Added automatic setting change for drawing when erased all

This commit is contained in:
Mitchell McCaffrey 2020-06-21 16:32:53 +10:00
parent 0bec582116
commit aebc0f9267

View File

@ -1,4 +1,4 @@
import React from "react";
import React, { useEffect } from "react";
import { Flex, IconButton } from "theme-ui";
import ColorControl from "./ColorControl";
@ -24,6 +24,13 @@ function DrawingToolSettings({
onToolAction,
disabledActions,
}) {
// Change to brush if on erase and it gets disabled
useEffect(() => {
if (settings.type === "erase" && disabledActions.includes("erase")) {
onSettingChange({ type: "brush" });
}
}, [disabledActions, settings, onSettingChange]);
return (
<Flex sx={{ alignItems: "center" }}>
<ColorControl