feat: display the color itself instead of gray if there's only one color in the handle (#6980)
refactor: Improve handle color rendering with unique color handling
This commit is contained in:
parent
0f034ca1c5
commit
339e4d28c1
1 changed files with 12 additions and 6 deletions
|
|
@ -278,11 +278,17 @@ const HandleRenderComponent = memo(function HandleRenderComponent({
|
|||
const isNullHandle =
|
||||
filterPresent && !(openHandle || ownDraggingHandle || ownFilterHandle);
|
||||
|
||||
// Create a Set from colorName to remove duplicates
|
||||
const colorNameSet = new Set(colorName || []);
|
||||
const uniqueColorCount = colorNameSet.size;
|
||||
const firstUniqueColor =
|
||||
colorName && colorName.length > 0 ? colorName[0] : "";
|
||||
|
||||
const handleColorName = connectedEdge
|
||||
? connectedColor
|
||||
: colorName!.length > 1
|
||||
: uniqueColorCount > 1
|
||||
? "secondary-foreground"
|
||||
: "datatype-" + colorName![0];
|
||||
: "datatype-" + firstUniqueColor;
|
||||
|
||||
const handleColor = isNullHandle
|
||||
? dark
|
||||
|
|
@ -290,15 +296,15 @@ const HandleRenderComponent = memo(function HandleRenderComponent({
|
|||
: "hsl(var(--accent-gray-foreground)"
|
||||
: connectedEdge
|
||||
? "hsl(var(--datatype-" + connectedColor + "))"
|
||||
: colorName!.length > 1
|
||||
: uniqueColorCount > 1
|
||||
? "hsl(var(--secondary-foreground))"
|
||||
: "hsl(var(--datatype-" + colorName![0] + "))";
|
||||
: "hsl(var(--datatype-" + firstUniqueColor + "))";
|
||||
|
||||
const accentForegroundColorName = connectedEdge
|
||||
? "hsl(var(--datatype-" + connectedColor + "-foreground))"
|
||||
: colorName!.length > 1
|
||||
: uniqueColorCount > 1
|
||||
? "hsl(var(--input))"
|
||||
: "hsl(var(--datatype-" + colorName![0] + "-foreground))";
|
||||
: "hsl(var(--datatype-" + firstUniqueColor + "-foreground))";
|
||||
|
||||
const currentFilter = left
|
||||
? {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue