lib/rsyntaxtree/svg_graph.rb in rsyntaxtree-1.2.6 vs lib/rsyntaxtree/svg_graph.rb in rsyntaxtree-1.2.7

- old
+ new

@@ -24,11 +24,10 @@ @fontsize = params[:fontsize] @linewidth = params[:linewidth] @transparent = params[:transparent] @color = params[:color] @fontstyle = params[:fontstyle] - @margin = params[:margin].to_i @polyline = params[:polyline] @line_styles = "<line style='stroke:#{@col_line}; stroke-width:#{@linewidth + LINE_SCALING}; stroke-linejoin:round; stroke-linecap:round;' x1='X1' y1='Y1' x2='X2' y2='Y2' />\n" @polyline_styles = "<polyline style='stroke:#{@col_line}; stroke-width:#{@linewidth + LINE_SCALING}; fill:none; stroke-linejoin:round; stroke-linecap:round;' points='CHIX CHIY MIDX1 MIDY1 MIDX2 MIDY2 PARX PARY' />\n" @polygon_styles = "<polygon style='fill: none; stroke: black; stroke-width:#{@linewidth + LINE_SCALING}; stroke-linejoin:round;stroke-linecap:round;' points='X1 Y1 X2 Y2 X3 Y3' />\n" @@ -39,16 +38,18 @@ @global = global end def svg_data metrics = parse_list - @height = metrics[:height] + @margin * 2 - @width = metrics[:width] + @margin * 2 - x1 = 0 - @margin - y1 = 0 - @margin - x2 = @width + @margin * 2 - y2 = @height + @margin * 2 + @height = metrics[:height] + @global[:height_connector_to_text] / 2 + @width = metrics[:width] + @global[:h_gap_between_nodes] / 2 + + x1 = 0 + y1 = 0 + x2 = @width + @global[:h_gap_between_nodes] / 2 + y2 = @height + @global[:height_connector_to_text] / 2 + extra_lines = @extra_lines.join("\n") as2 = @global[:h_gap_between_nodes] * 1.0 as4 = as2 * 3