Skip to content
Snippets Groups Projects
Commit dfc91700 authored by Ivica Ico Bukvic's avatar Ivica Ico Bukvic
Browse files

fixed bug where gop element with hidden text still did not allow resizing...

fixed bug where gop element with hidden text still did not allow resizing below the width of the text
parent 7a3f43b7
No related branches found
No related tags found
No related merge requests found
...@@ -497,7 +497,6 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv) ...@@ -497,7 +497,6 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
x->move_offset_y = 0; x->move_offset_y = 0;
x->move_vis = 0; x->move_vis = 0;
//TODO: figure out why pd creates 2 invisible canvases at start-up
x->u_queue = canvas_undo_init(x); x->u_queue = canvas_undo_init(x);
return(x); return(x);
...@@ -1816,27 +1815,30 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo ...@@ -1816,27 +1815,30 @@ void canvasgop__clickhook(t_scalehandle *sh, t_floatarg f, t_floatarg xxx, t_flo
// check if the text is not hidden // check if the text is not hidden
// if so make minimum width and height based retrieved from getrect // if so make minimum width and height based retrieved from getrect
if (!x->gl_hidetext && x->gl_owner) { if (!x->gl_hidetext)
gobj_getrect((t_gobj*)x, x->gl_owner, &x1, &y1, &x2, &y2); {
if (x2-x1 > x->gl_pixwidth) x->gl_pixwidth = x2-x1; if (x->gl_owner) {
if (y2-y1 > x->gl_pixheight) x->gl_pixheight = y2-y1; gobj_getrect((t_gobj*)x, x->gl_owner, &x1, &y1, &x2, &y2);
} else { if (x2-x1 > x->gl_pixwidth) x->gl_pixwidth = x2-x1;
// WARNING: ugly hack trying to replicate rtext_senditup if we have no parent if (y2-y1 > x->gl_pixheight) x->gl_pixheight = y2-y1;
// later consider instead of hardwiring values pulling these more intelligently from } else {
// a common place THIS SHOULD BE LATER MERGED WITH GRPAH_GETRECT // WARNING: ugly hack trying to replicate rtext_senditup if we have no parent
int fw = sys_fontwidth(x->gl_font); // later consider instead of hardwiring values pulling these more intelligently from
int fh = sys_fontheight(x->gl_font); // a common place THIS SHOULD BE LATER MERGED WITH GRPAH_GETRECT
int tcols = strlen(x->gl_name->s_name) - 3; int fw = sys_fontwidth(x->gl_font);
int th = fh + fh * (tcols/60) + 4; int fh = sys_fontheight(x->gl_font);
if (tcols > 60) tcols = 60; int tcols = strlen(x->gl_name->s_name) - 3;
int tw = fw * tcols + 4; int th = fh + fh * (tcols/60) + 4;
if (tw + x1 > x2) if (tcols > 60) tcols = 60;
x2 = tw + x1; int tw = fw * tcols + 4;
if (th + y1 > y2) if (tw + x1 > x2)
y2 = th + y1; x2 = tw + x1;
if (x2-x1 > x->gl_pixwidth) x->gl_pixwidth = x2-x1; if (th + y1 > y2)
if (y2-y1 > x->gl_pixheight) x->gl_pixheight = y2-y1; y2 = th + y1;
//fprintf(stderr,"graph_getrect->text_getrect %d=%d %d=%d\n", fw, x2, fh, y2); if (x2-x1 > x->gl_pixwidth) x->gl_pixwidth = x2-x1;
if (y2-y1 > x->gl_pixheight) x->gl_pixheight = y2-y1;
//fprintf(stderr,"graph_getrect->text_getrect %d=%d %d=%d\n", fw, x2, fh, y2);
}
} }
canvas_dirty(x, 1); canvas_dirty(x, 1);
......
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