()
| 93 | } |
| 94 | |
| 95 | const DrawingColorLine: React.FC = () => { |
| 96 | const [userColorList, setUserColorList] = useState<Color[]>([]); |
| 97 | const [currentDrawColor, setCurrentDrawColor] = useState<Color>(Color.Transparent); |
| 98 | |
| 99 | useEffect(() => { |
| 100 | ColorManager.getUserEntityFillColors().then((colors) => { |
| 101 | setUserColorList(colors); |
| 102 | }); |
| 103 | setCurrentDrawColor(new Color(...Settings.autoFillPenStrokeColor)); |
| 104 | }, []); |
| 105 | |
| 106 | const handleChangeColor = (color: Color) => { |
| 107 | Settings.autoFillPenStrokeColor = color.toArray(); |
| 108 | setCurrentDrawColor(color.clone()); |
| 109 | }; |
| 110 | |
| 111 | return ( |
| 112 | <div className="flex max-w-64 overflow-x-auto"> |
| 113 | {userColorList.map((color) => { |
| 114 | return ( |
| 115 | <div |
| 116 | className={cn( |
| 117 | "outline-accent-foreground size-4 cursor-pointer hover:outline-3 hover:-outline-offset-3", |
| 118 | currentDrawColor.equals(color) && "outline-2 -outline-offset-2", |
| 119 | )} |
| 120 | key={color.toString()} |
| 121 | style={{ |
| 122 | backgroundColor: `rgba(${color.r}, ${color.g}, ${color.b}, ${color.a})`, |
| 123 | }} |
| 124 | onClick={() => { |
| 125 | handleChangeColor(color); |
| 126 | }} |
| 127 | /> |
| 128 | ); |
| 129 | })} |
| 130 | </div> |
| 131 | ); |
| 132 | }; |
nothing calls this directly
no test coverage detected