|
@@ -142,8 +142,6 @@ function doWordCloud(words){
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// THE ACTUAL CLOUD
|
|
|
svg = document.getElementById('wordcloudNetwork');
|
|
|
console.log(svg);
|
|
@@ -226,7 +224,7 @@ function createWordCloud(words, parameters){
|
|
|
//for(let ind=0;ind<3;ind++){
|
|
|
|
|
|
// Control vars
|
|
|
- if(allBooms>=50*(ind+1)) break;
|
|
|
+ if(allBooms>=20*(ind+1)) break;
|
|
|
attempts++;
|
|
|
let boom = false;
|
|
|
|
|
@@ -235,10 +233,10 @@ function createWordCloud(words, parameters){
|
|
|
let id0 = "word"+ind;
|
|
|
let wordBB = document.getElementById(id0).getBoundingClientRect();
|
|
|
let fontSize = word.fontSize;
|
|
|
- let width = wordBB.width*1;
|
|
|
- let height = wordBB.height*1;
|
|
|
+ let width = wordBB.width;
|
|
|
+ let height = wordBB.height;
|
|
|
let multiplier = 0.1 + 0.4*(maxFontSize-fontSize)/(maxFontSize-minFontSize);
|
|
|
- let xR = Math.floor(actualUsefulWidth/2 + randomRange(-multiplier*actualUsefulWidth, multiplier*actualUsefulWidth));
|
|
|
+ let xR = Math.floor(actualUsefulWidth/2-width/2 + randomRange(-multiplier*actualUsefulWidth, multiplier*actualUsefulWidth));
|
|
|
let yR = Math.floor(actualUsefulHeight/2 + randomRange(-multiplier*actualUsefulHeight, multiplier*actualUsefulHeight));
|
|
|
//console.log('x', 'y', xR, yR)
|
|
|
let angle;
|
|
@@ -268,7 +266,7 @@ function createWordCloud(words, parameters){
|
|
|
ind--;
|
|
|
continue;
|
|
|
}
|
|
|
-// allBooms = 0;
|
|
|
+ allBooms = 0;
|
|
|
rectObjs.push(newRect);
|
|
|
}
|
|
|
console.log('Attempted:', attempts);
|