#10195 Fixed minimap drawing

This commit is contained in:
Daniel Maya 2023-02-15 10:49:31 +01:00
parent f56b6435d7
commit cac9f67153
4 changed files with 59 additions and 6 deletions

View File

@ -1189,6 +1189,10 @@ class NetworkMap
$head .= 'overlap="scalexy";';
}
if ($layout == 'spring1' || $layout == 'spring2') {
$head .= 'sep="'.$node_sep.'";';
}
if ($layout == 'flat') {
$head .= 'ranksep="'.$rank_sep.'";';
}
@ -3498,6 +3502,7 @@ class NetworkMap
url_background_grid: url_background_grid,
refresh_time: '.$this->mapOptions['refresh_time'].',
font_size: '.$this->mapOptions['font_size'].',
method: '.$this->map['generation_method'].',
base_url_homedir: "'.ui_get_full_url(false).'"
});
init_drag_and_drop();

View File

@ -1126,6 +1126,10 @@ function networkmap_open_graph(
$head .= 'overlap="scalexy";';
}
if ($layout == 'spring1' || $layout == 'spring2') {
$head .= 'sep="'.$node_sep.'";';
}
if ($layout === 'flat') {
$head .= 'ranksep="'.$rank_sep.'";';
} else if ($layout === 'spring2') {

View File

@ -55,10 +55,30 @@ function draw_minimap() {
var relation_min_nodes = minimap_relation;
var relation_minimap_w = 2;
var relation_minimap_h = 2;
if (graph.nodes.length > 100) {
if (graph.nodes.length > 100 && graph.nodes.length < 500) {
relation_min_nodes = 0.01;
relation_minimap_w = (graph.nodes.length / 100) * 2.5;
relation_minimap_h = 1.5;
} else if (graph.nodes.length >= 500 && graph.nodes.length < 1000) {
if (typeof method != "undefined" && method == 4) {
relation_min_nodes = 0.002;
relation_minimap_w = (graph.nodes.length / 500) * 2.5;
relation_minimap_h = 3;
} else {
relation_min_nodes = 0.008;
relation_minimap_w = (graph.nodes.length / 500) * 2.5;
relation_minimap_h = 3;
}
} else if (graph.nodes.length >= 1000) {
if (typeof method != "undefined" && method == 4) {
relation_min_nodes = 0.001;
relation_minimap_w = (graph.nodes.length / 1000) * 4.5;
relation_minimap_h = 4;
} else {
relation_min_nodes = 0.0015;
relation_minimap_w = (graph.nodes.length / 1000) * 3.5;
relation_minimap_h = 3.5;
}
}
//Draw the items and lines
@ -1792,10 +1812,30 @@ function init_minimap() {
var relation_minimap_w = 2;
var relation_minimap_h = 2;
if (graph.nodes.length > 100) {
if (graph.nodes.length > 100 && graph.nodes.length < 500) {
relation_min_nodes = 0.01;
relation_minimap_w = (graph.nodes.length / 100) * 2.5;
relation_minimap_h = 1.5;
} else if (graph.nodes.length >= 500 && graph.nodes.length < 1000) {
if (typeof method != "undefined" && method == 4) {
relation_min_nodes = 0.002;
relation_minimap_w = (graph.nodes.length / 500) * 2.5;
relation_minimap_h = 3;
} else {
relation_min_nodes = 0.008;
relation_minimap_w = (graph.nodes.length / 500) * 2.5;
relation_minimap_h = 3;
}
} else if (graph.nodes.length >= 1000) {
if (typeof method != "undefined" && method == 4) {
relation_min_nodes = 0.001;
relation_minimap_w = (graph.nodes.length / 1000) * 4.5;
relation_minimap_h = 4;
} else {
relation_min_nodes = 0.0015;
relation_minimap_w = (graph.nodes.length / 1000) * 3.5;
relation_minimap_h = 3.5;
}
}
$("#minimap_" + networkmap_id).bind("mousemove", function(event) {
@ -3092,6 +3132,10 @@ function init_graph(parameter_object) {
window.refresh_time = parameter_object.refresh_time;
}
if (typeof parameter_object.method != "undefined") {
window.method = parameter_object.method;
}
var rect_center_x = graph.nodes[0].x;
var rect_center_y = graph.nodes[0].y;

View File

@ -57,10 +57,10 @@ if ($new_networkmap) {
$offset_x = '';
$offset_y = '';
$scale_z = 0.5;
$node_sep = 10;
$rank_sep = 1.0;
$node_sep = 0.25;
$rank_sep = 0.5;
$mindist = 1.0;
$kval = 5;
$kval = 0.3;
$refresh_time = 300;
}
@ -565,7 +565,7 @@ $(document).ready(function() {
$("#form_editor-kval")
.css('display', 'none');
$("#form_editor-nodesep")
.css('display', '');
.css('display', 'none');
}
else if (method == 'neato') {
$("#form_editor-ranksep")