Skip to content

Commit f4f1a70

Browse files
committed
Addition of a toggle action to show/hide node labels
1 parent d1579ed commit f4f1a70

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ node_modules/
1111
bower_components/
1212
/.project
1313
/data.txt
14+
/.README.md.html

functree/static/src/js/functree.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,29 @@ const FuncTree = class {
387387
window.open(url, '_blank');
388388
}
389389
})
390+
// Toggle/Untoggle labels
391+
actions.push({
392+
name: 'Toggle label',
393+
iconClass: 'fa-toggle-off',
394+
onClick: function() {
395+
const selectedLabel = d3.select('#label-' + nodeId)
396+
if (selectedLabel.empty()) {
397+
const selectedNode = d3.select('#' + nodeId)
398+
d3.select("#labels")
399+
.append('g')
400+
.attr('id', 'label-' + nodeId)
401+
.attr('transform', selectedNode .attr("transform"))
402+
.append('text')
403+
.attr('text-anchor', 'middle')
404+
.attr('font-family', 'arial, sans-serif')
405+
.attr('font-size', 4)
406+
.attr('fill', '#555')
407+
.text(selectedNode.attr("data-original-title").replace(/\[.*\] /, ''))
408+
} else {
409+
selectedLabel.remove()
410+
}
411+
}
412+
})
390413

391414
}
392415
//escape space in the selector

functree/templates/about.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ <h3>Publications</h3>
2525
<hr />
2626
<h3>Change log</h3>
2727
<br />
28+
<h5>Version 0.7.6.2 (dev)</h5>
29+
<ul>
30+
<li>Addition of a toggle action to show/hide node labels
31+
<li>Addition of a description to the database selection
32+
</ul>
2833
<h5>Version 0.7.6.1 (2019-01-18)</h5>
2934
<ul>
30-
<li>Addition of a help section on the functree explorer page, and improvement of the main documentation.
35+
<li>Addition of a help section on the Functree explorer page, and improvement of the main documentation.
3136
</ul>
3237
<h5>Version 0.7.6 (2019-01-15)</h5>
3338
<ul>

0 commit comments

Comments
 (0)