Simplify conditional and fix color calculation

This commit is contained in:
Maximilian Harz 2025-02-06 11:43:53 +01:00
parent 7e326590bb
commit a949df25c2
2 changed files with 4 additions and 5 deletions

View File

@ -210,12 +210,12 @@ export const Layer = ({
let color2 = markerDefaultColor2 let color2 = markerDefaultColor2
if (item.color) { if (item.color) {
color1 = item.color color1 = item.color
} else if (itemTags && itemTags[0]) { } else if (itemTags[0]) {
color1 = itemTags[0].color color1 = itemTags[0].color
} }
// What is happening here?? Why do we depend on itemColorField? if (itemTags[0] && item.color) {
if (itemTags && itemTags[0] && item.layer?.hasColor) color2 = itemTags[0].color color2 = itemTags[0].color
else if (itemTags && itemTags[1]) { } else if (itemTags[1]) {
color2 = itemTags[1].color color2 = itemTags[1].color
} }
return ( return (

View File

@ -18,7 +18,6 @@ export interface LayerProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
api?: ItemsApi<any> api?: ItemsApi<any>
itemType: ItemType itemType: ItemType
hasColor?: boolean
onlyOnePerOwner?: boolean onlyOnePerOwner?: boolean
customEditLink?: string customEditLink?: string
customEditParameter?: string customEditParameter?: string