MCPcopy
hub / github.com/graphif/project-graph / DrawingColorLine

Function DrawingColorLine

app/src/components/toolbar-content.tsx:95–132  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93}
94
95const 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};

Callers

nothing calls this directly

Calls 4

cnFunction · 0.90
handleChangeColorFunction · 0.85
equalsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected