kora hai 1 ano
pai
achega
da2050471a
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  1. 3 2
      js/word_cloud.js

+ 3 - 2
js/word_cloud.js

@@ -130,7 +130,7 @@ function doWordCloud(words){
         .append("svg")
         .attr("id", "wordcloudNetwork")
         .attr("preserveAspectRatio", "xMinYMin meet")
-        .attr("viewBox", "0 0 " + width + " " + height+'"')
+        .attr("viewBox", "0 0 " + width + " " + height)
         .classed("svg-content", true)
         .attr("width", width)
         .attr("height", height)
@@ -235,7 +235,7 @@ function createWordCloud(words, parameters){
         let fontSize = word.fontSize;
         let width = wordBB.width;
         let height = wordBB.height;
-        let multiplier = 0.1 + 0.4*(maxFontSize-fontSize)/(maxFontSize-minFontSize);
+        let multiplier = 0.1 + 0.4*Math.max((maxFontSize-fontSize)/(maxFontSize-minFontSize), allBooms/(20*(ind+1)));
         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)
@@ -271,6 +271,7 @@ function createWordCloud(words, parameters){
     }
     console.log('Attempted:', attempts);
     console.log('Placed:', rectObjs.length);
+    console.log('booms!', allBooms);
 
     const rectTexts = [];
     rectObjs.forEach(rect => rectTexts.push(rect.printCoords(false, maxFontSize, minFontSize)));