@@ -25,15 +25,14 @@ import DownloadApi from "../../api/DownloadApi";
2525class Controls extends React . Component {
2626 // Triggers download functionality of the network graph
2727 downloadSVG = ( ) => {
28- const general_transform = `translate(5, 5)` ;
28+ const netowrk_transform = `translate(5, 5)` ;
2929 var graph_element = document . getElementById ( "main_group" ) ; // Get the main SVG Element
3030 var graph_bBox = graph_element . getBBox ( ) ;
3131 var graph_width = graph_bBox . width * this . props . group_transform . scale ; // Calculate the width of this Element
3232 var graph_height = graph_bBox . height * this . props . group_transform . scale ; // Calculate the height of this Element
3333 var graph_text = graph_element . innerHTML ; // Get the inner elements of the svg
34- const graph_transform = `scale(${
35- this . props . group_transform . scale
36- } ) translate(${ - graph_bBox . x } , ${ - graph_bBox . y } )`; // Set the transform for the graph to match the scaling and be centred
34+ const graph_transform = `scale(${ this . props . group_transform . scale
35+ } ) translate(${ - graph_bBox . x } , ${ - graph_bBox . y } )`; // Set the transform for the graph to match the scaling and be centred
3736 var graph_downloadable = "" ;
3837 if ( this . props . preferences . no_colors . value ) {
3938 // No colors should be used, so textures need to be included.
@@ -46,7 +45,7 @@ class Controls extends React.Component {
4645 "'>" +
4746 defs_element . innerHTML +
4847 "<g transform='" +
49- general_transform +
48+ netowrk_transform +
5049 "'><g transform='" +
5150 graph_transform +
5251 "'>" +
@@ -60,35 +59,35 @@ class Controls extends React.Component {
6059 "' height='" +
6160 ( graph_height + 10 ) +
6261 "'><g transform='" +
63- general_transform +
62+ netowrk_transform +
6463 "'><g transform='" +
6564 graph_transform +
6665 "'>" +
6766 graph_text +
6867 "</g></g></svg>" ; // Wrap together the svg code for the Graph
6968 }
7069
70+ const lgnd_transform = `translate(25, 5)` ;
7171 var legend_element = document . getElementById ( "legend_group" ) ; // Get the legend SVG Element
7272 var bBox = legend_element . getBBox ( ) ;
73- var legend_width = bBox . width * 1.0 * this . props . legend_transform . scale ; // Calculate the width of this Element
74- var legend_height = bBox . height * 1.0 * this . props . legend_transform . scale ; // Calculate the height of this Element
73+ var legend_width = bBox . width * this . props . legend_transform . scale ; // Calculate the width of this Element
74+ var legend_height = bBox . height * this . props . legend_transform . scale ; // Calculate the height of this Element
7575 var legend_text = legend_element . innerHTML ; // Get the inner elements of the svg
76- const legend_transform = `scale(${
77- this . props . legend_transform . scale
78- } ) translate(${ - bBox . x } , ${ - bBox . y } )`; // Set the transform for the legend to match the scaling and be centred
76+ const legend_transform = `scale(${ this . props . legend_transform . scale
77+ } ) translate(${ - bBox . x } , ${ - bBox . y } )`; // Set the transform for the legend to match the scaling and be centred
7978 var legend_downloadable = "" ;
8079 if ( this . props . preferences . no_colors . value ) {
8180 // No colors should be used, so textures need to be included.
8281 var defs_element_legend = document . getElementById ( "main_defs" ) ; // Get the main SVG Element
8382 legend_downloadable =
8483 "<svg version='1.1' baseProfile='full' xmlns='http://www.w3.org/2000/svg' width='" +
85- ( legend_width + 10 ) +
84+ ( legend_width + 50 ) +
8685 "' height='" +
8786 ( legend_height + 10 ) +
8887 "'>" +
8988 defs_element_legend . innerHTML +
9089 "<g transform='" +
91- general_transform +
90+ lgnd_transform +
9291 "'><g transform='" +
9392 legend_transform +
9493 "'>" +
@@ -97,11 +96,11 @@ class Controls extends React.Component {
9796 } else {
9897 legend_downloadable =
9998 "<svg version='1.1' baseProfile='full' xmlns='http://www.w3.org/2000/svg' width='" +
100- ( legend_width + 10 ) +
99+ ( legend_width + 50 ) +
101100 "' height='" +
102101 ( legend_height + 10 ) +
103102 "'><g transform='" +
104- general_transform +
103+ lgnd_transform +
105104 "'><g transform='" +
106105 legend_transform +
107106 "'>" +
0 commit comments