Skip to content

Commit

Permalink
Refactors variables names
Browse files Browse the repository at this point in the history
Issue: documentacao-e-tarefas/desenvolvimento_e_infra#593

Signed-off-by: Jhon <[email protected]>
  • Loading branch information
JhonathanLepidus committed Jul 17, 2023
1 parent 1b8ffcb commit 71775bb
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions templates/block.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
document.addEventListener("DOMContentLoaded", function() {ldelim}
var keywords = {$keywords};
var totalWeight = 0;
var width = 300;
var height = 200;
var blockWidth = 300;
var blockHeight = 200;
var transitionDuration = 200;
var length_keywords = keywords.length;
var layout = d3.layout.cloud();
layout.size([width, height])
layout.size([blockWidth, blockHeight])
.words(keywords)
.fontSize(function(d)
{ldelim}
Expand All @@ -37,7 +37,7 @@
.on('end', draw);
var svg = d3.select("#wordcloud").append("svg")
.attr("viewBox", "0 0 " + width + " " + height)
.attr("viewBox", "0 0 " + blockWidth + " " + blockHeight)
.attr("width", '100%');
function update() {ldelim}
Expand All @@ -53,23 +53,23 @@
update();
function draw(words, bounds) {ldelim}
var w = layout.size()[0],
h = layout.size()[1];
var width = layout.size()[0],
height = layout.size()[1];
scaling = bounds
? Math.min(
w / Math.abs(bounds[1].x - w / 2),
w / Math.abs(bounds[0].x - w / 2),
h / Math.abs(bounds[1].y - h / 2),
h / Math.abs(bounds[0].y - h / 2),
width / Math.abs(bounds[1].x - width / 2),
width / Math.abs(bounds[0].x - width / 2),
height / Math.abs(bounds[1].y - height / 2),
height / Math.abs(bounds[0].y - height / 2),
) / 2
: 1;
svg
.append("g")
.attr(
"transform",
"translate(" + [w >> 1, h >> 1] + ")scale(" + scaling + ")",
"translate(" + [width >> 1, height >> 1] + ")scale(" + scaling + ")",
)
.selectAll("text")
.data(words)
Expand Down

0 comments on commit 71775bb

Please sign in to comment.