Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function ReactWordCloud({
options,
size: initialSize,
words,
initRender,
...rest
}) {
const [ref, selection, size] = useResponsiveSvgSelection(
Expand All @@ -55,6 +56,7 @@ function ReactWordCloud({
selection,
size,
words,
initRender,
});
}
}, [maxWords, callbacks, options, selection, size, words]);
Expand Down
10 changes: 10 additions & 0 deletions src/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export function layout({
selection,
size,
words,
initRender,
}) {
const MAX_LAYOUT_ATTEMPTS = 10;
const SHRINK_FACTOR = 0.95;
Expand Down Expand Up @@ -217,6 +218,15 @@ export function layout({
minFontSize,
);

if (attempts === 1 && initRender) {
render({
callbacks,
options,
random,
selection,
words: computedWords,
})
}
draw([minFontSize, maxFontSize], attempts + 1);
} else {
render({
Expand Down