in src/common/LegendMarker.tsx [17:46]
export default function LegendMarker({ marker, disable = false, item }: LegendMarkerProps) {
const { symbol, style } = marker;
if (['line', 'smooth', 'hv', 'circle'].includes(typeof symbol === 'string' ? symbol : symbol?.name)) {
return (
<div
style={{
width: (symbol || symbol?.name) === 'circle' ? (style?.r * 2 ?? 6) : 8,
height: (symbol || symbol?.name) === 'circle' ? (style?.r * 2 ?? 6) : 2,
background: item?.marker?.dataFill ?? style.stroke ?? style.fill,
opacity: disable ? 0.3 : 1,
borderRadius: (symbol || symbol?.name) === 'circle' ? '50%' : 0
}}
></div>
);
} else {
// 处理渐变
const fill = style?.fill?.startsWith('l(') ? style.fill.split(' ')?.[1]?.slice(2, 9) : style.fill;
return (
<div
style={{
width: 8,
height: 8,
background: symbol?.name === 'symbol' ? style?.stroke ?? fill : fill,
opacity: disable ? 0.3 : 1,
}}
></div>
);
}
}