fixed colour painting and eraser

This commit is contained in:
2025-11-23 22:36:08 +00:00
parent 68711b9087
commit c5fe6754c3
8 changed files with 71 additions and 20 deletions

View File

@@ -1,4 +1,4 @@
import ColourPicker from "./colourPicker";
import ColourPicker from "./ColourPicker";
import type { Region } from "../../../types/types";
type RegionSelectorProps = {
@@ -6,6 +6,8 @@ type RegionSelectorProps = {
selectedRegionIndex: number;
onSelectRegion: (index: number) => void;
onChangeRegionColour: (index: number, colour: string) => void;
isErasing: boolean;
onSelectErasing: (isErasing: boolean) => void;
};
const RegionSelector = ({
@@ -13,7 +15,13 @@ const RegionSelector = ({
selectedRegionIndex,
onSelectRegion,
onChangeRegionColour,
isErasing,
onSelectErasing,
}: RegionSelectorProps) => {
const handleChange = () => {
onSelectErasing(!isErasing);
};
return (
<div>
<div>
@@ -29,6 +37,10 @@ const RegionSelector = ({
<ColourPicker colour={region.brushColour} setColour={(c: string) => onChangeRegionColour(idx, c)} />
</div>
))}
<label htmlFor="">
<input type="checkbox" onChange={handleChange} checked={isErasing} />
Eraser
</label>
</div>
</div>
);