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:
hailin 2026-04-05 21:53:54 -07:00
parent f13ebe97be
commit abe696deb5
2 changed files with 6 additions and 4 deletions

View File

@ -272,9 +272,8 @@ export function buildWordcloudOption(
data: wordData,
};
if (maskImage) {
series.maskImage = maskImage;
}
// Always set maskImage explicitly — undefined clears previous mask
series.maskImage = maskImage ?? undefined;
option.series = [series];
return option;

View File

@ -38,8 +38,11 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ chart, data, chart
default:
const borderRadius = chart.style?.background?.borderRadius ?? 0;
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
? <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>;
}
};