fix: clear maskImage when switching back to rectangle shape
- Explicitly set maskImage=undefined for rectangle mode - Force re-mount EChartsBase on wordcloud shape change via React key - Prevents stale mask from previous shape persisting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f13ebe97be
commit
abe696deb5
|
|
@ -272,9 +272,8 @@ export function buildWordcloudOption(
|
||||||
data: wordData,
|
data: wordData,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (maskImage) {
|
// Always set maskImage explicitly — undefined clears previous mask
|
||||||
series.maskImage = maskImage;
|
series.maskImage = maskImage ?? undefined;
|
||||||
}
|
|
||||||
|
|
||||||
option.series = [series];
|
option.series = [series];
|
||||||
return option;
|
return option;
|
||||||
|
|
|
||||||
|
|
@ -38,8 +38,11 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ chart, data, chart
|
||||||
default:
|
default:
|
||||||
const borderRadius = chart.style?.background?.borderRadius ?? 0;
|
const borderRadius = chart.style?.background?.borderRadius ?? 0;
|
||||||
const overflow = borderRadius > 0 ? 'hidden' as const : undefined;
|
const overflow = borderRadius > 0 ? 'hidden' as const : undefined;
|
||||||
|
// Force re-mount when wordcloud shape changes (plugin caches mask internally)
|
||||||
|
const wcShape = (chart.style as any)?.wordcloud?.shape ?? 'default';
|
||||||
|
const echartsKey = chart.type === 'wordcloud' ? `${chartId}-${wcShape}` : chartId;
|
||||||
return echartsOption
|
return echartsOption
|
||||||
? <EChartsBase chartId={chartId} option={echartsOption} style={{ width: '100%', height: '100%', minHeight: 250, borderRadius, overflow }} />
|
? <EChartsBase key={echartsKey} chartId={chartId} option={echartsOption} style={{ width: '100%', height: '100%', minHeight: 250, borderRadius, overflow }} />
|
||||||
: <div style={{ padding: 16, color: '#999', textAlign: 'center' }}>请绑定数据字段</div>;
|
: <div style={{ padding: 16, color: '#999', textAlign: 'center' }}>请绑定数据字段</div>;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue