Skip to content
Snippets Groups Projects
Commit 7d51676a authored by Mathieu L Bouchard's avatar Mathieu L Bouchard
Browse files

fix bug in graph_bounds when graph area is 0. Also don't call redraw when bounds have not changed.

parent 3361da40
No related branches found
No related tags found
No related merge requests found
...@@ -596,18 +596,19 @@ void canvas_resortoutlets(t_canvas *x) ...@@ -596,18 +596,19 @@ void canvas_resortoutlets(t_canvas *x)
static void graph_bounds(t_glist *x, t_floatarg x1, t_floatarg y1, static void graph_bounds(t_glist *x, t_floatarg x1, t_floatarg y1,
t_floatarg x2, t_floatarg y2) t_floatarg x2, t_floatarg y2)
{ {
x->gl_x1 = x1; if (x1==x2 || y1==y2) {
x->gl_x2 = x2;
x->gl_y1 = y1;
x->gl_y2 = y2;
if (x->gl_x2 == x->gl_x1 ||
x->gl_y2 == x->gl_y1)
{
error("graph: empty bounds rectangle"); error("graph: empty bounds rectangle");
x1 = y1 = 0; x1 = y1 = 0;
x2 = y2 = 1; x2 = y2 = 1;
} }
glist_redraw(x); if (x->gl_x1!=x1 || x->gl_y1!=y1 || x->gl_x2!=x2 || x->gl_y2!=y2) {
printf("%f %f %f %f %f %f %f %f\n",x->gl_x1,x1,x->gl_y1,y1,x->gl_x2,x2,x->gl_y2,y2);
x->gl_x1 = x1;
x->gl_x2 = x2;
x->gl_y1 = y1;
x->gl_y2 = y2;
glist_redraw(x);
}
} }
static void graph_xticks(t_glist *x, static void graph_xticks(t_glist *x,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment