New networkmaps in progress... (Added button to hide and show node labels)

This commit is contained in:
Arturo Gonzalez 2016-10-11 11:48:03 +02:00
parent 9157c76ba0
commit aa8c99c2d4
2 changed files with 38 additions and 0 deletions

View File

@ -1238,8 +1238,16 @@ function show_networkmap($id = 0, $user_readonly = false, $nodes_and_relations =
<img id="image_arrow_minimap" src="images/minimap_open_arrow.png" />
</a>
</div>';
echo '<div id="hide_labels" style="position: absolute; right: 0px; top: 0px;">
<a title="' . __('Hide Labels') . '" href="javascript: hide_labels();">
<img id="image_hide_show_labels" src="images/delete.png" />
</a>
</div>';
echo '</div>';
?>
<style type="text/css">
.node {

View File

@ -872,6 +872,35 @@ function add_agent_node(agents) {
}
}
function hide_labels() {
if (show_labels) {
hide_labels_function();
}
else {
show_labels_function();
}
}
function hide_labels_function() {
show_labels = false;
//Change the image arrow
$("#hide_labels > a").attr("title", "Show Labels");
$("#image_hide_show_labels").attr("src", "images/refresh.png");
d3.selectAll(".node_text").style("display", "none");
}
function show_labels_function() {
show_labels = true;
console.log("PINTA");
//Change the image arrow
$("#hide_labels > a").attr("title", "Hide Labels");
$("#image_hide_show_labels").attr("src", "images/delete.png");
d3.selectAll(".node_text").style("display", "");
}
function toggle_minimap() {
if (show_minimap) {
function_close_minimap();
@ -1919,6 +1948,7 @@ function init_graph(parameter_object) {
window.minimap_w = 0;
window.minimap_h = 0;
window.show_minimap = false;
window.show_labels = true;
window.context_minimap;
window.holding_area_dimensions = [200, 200];