Skip to content

Commit

Permalink
Adjust edge positioning if there is a graph title
Browse files Browse the repository at this point in the history
Fix whitespace
  • Loading branch information
cyanpencil committed Jul 28, 2018
1 parent f491e4b commit bdd0ff6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions libr/cons/canvas_line.c
Expand Up @@ -106,6 +106,7 @@ static bool apply_line_style(RConsCanvas *c, int x, int y, int x2, int y2,

R_API void r_cons_canvas_line_diagonal (RConsCanvas *c, int x, int y, int x2, int y2, RCanvasLineStyle *style) {
if (x == x2 || y == y2) {
style->dot_style = DOT_STYLE_NORMAL;
r_cons_canvas_line_square (c, x, y +1, x2, y2, style);
return;
}
Expand Down
21 changes: 10 additions & 11 deletions libr/core/graph.c
Expand Up @@ -2818,25 +2818,24 @@ static void agraph_print_edges(RAGraph *g) {
b_x_inc = R_EDGES_X_INC + 2 * (in_nth + 1);

bx = b->is_dummy ? b->x : (b->x + b_x_inc);
ay = a->y + a->h + 1;
ay = a->y + a->h;
by = b->y - 1;


if (many && !g->is_callgraph) {
int t = R_EDGES_X_INC + 2 * (neighbours->length + 1);
ax = a->is_dummy ? a->x : (a->x + a->w/2 + (t/2 - a_x_inc));
bendpoint = bx < ax ? neighbours->length - out_nth : out_nth;
} else {
ax = a->is_dummy ? a->x : (a->x + a_x_inc);
bendpoint = tm->edgectr - 1;
bendpoint = tm->edgectr;
}

if (!a->is_dummy && itn == neighbours->head && out_nth == 0 && bx > ax) {
ax += (many && !g->is_callgraph) ? 0 : 4;
}
if (a->h < a->layer_height) {
r_cons_canvas_line (g->can, ax, ay, ax, ay + a->layer_height - a->h, &style);
ay = a->y + a->layer_height + 1;
ay = a->y + a->layer_height;
style.symbol = LINE_NOSYM_VERT;
}
if (by >= ay) {
Expand Down Expand Up @@ -3228,19 +3227,19 @@ static int agraph_print(RAGraph *g, int is_interactive, RCore *core, RAnalFuncti
r_config_set_i (core->config, "asm.bytes", asm_bytes);
r_config_set_i (core->config, "asm.cmt.right", asm_cmt_right);
}
if (preEdges) {
agraph_print_edges (g);
}
if (g->title && *g->title) {
g->can->sy ++;
agraph_print_nodes (g);
g->can->sy --;
} else {
agraph_print_nodes (g);
}
if (preEdges) {
agraph_print_edges (g);
}
agraph_print_nodes (g);
if (!preEdges) {
agraph_print_edges (g);
}
if (g->title && *g->title) {
g->can->sy --;
}
/* print the graph title */
(void) G (-g->can->sx, -g->can->sy);
W (g->title);
Expand Down

0 comments on commit bdd0ff6

Please sign in to comment.