Commit 2154d843 authored by Albert Gräf's avatar Albert Gräf
Browse files

Cosmetic changes.

parent 82cc5883
...@@ -544,24 +544,20 @@ void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state) ...@@ -544,24 +544,20 @@ void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state)
scalar_getbasexy(x, &basex, &basey); scalar_getbasexy(x, &basex, &basey);
scalar_getrect(&x->sc_gobj, glist, &x1, &y1, &x2, &y2); scalar_getrect(&x->sc_gobj, glist, &x1, &y1, &x2, &y2);
x1--; x2++; y1--; y2++;
if (glist_istoplevel(glist)) if (glist_istoplevel(glist))
{ {
t_float xorig = glist_xtopixels(glist, 0); t_float xorig = glist_xtopixels(glist, 0);
t_float yorig = glist_ytopixels(glist, 0); t_float yorig = glist_ytopixels(glist, 0);
t_float xscale = glist_xtopixels(glist, 1) - xorig; t_float xscale = glist_xtopixels(glist, 1) - xorig;
t_float yscale = glist_ytopixels(glist, 1) - yorig; t_float yscale = glist_ytopixels(glist, 1) - yorig;
// the bbox is in scaled canvas coordinates, but // unscaled x/y coordinates
// gui_scalar_draw_select_rect expects them in unscaled units, so
// we undo the scaling (as well as the translation of the origin)
// here
t_float u1 = (x1 - xorig) / xscale; t_float u1 = (x1 - xorig) / xscale;
t_float v1 = (y1 - yorig) / yscale; t_float v1 = (y1 - yorig) / yscale;
t_float u2 = (x2 - xorig) / xscale; t_float u2 = (x2 - xorig) / xscale;
t_float v2 = (y2 - yorig) / yscale; t_float v2 = (y2 - yorig) / yscale;
// undoing the scaling will reverse the order of coordinates if // make sure that these are in the right order,
// the corresponding scale factor is negative, so we put them back // gui_scalar_draw_select_rect expects them that way
// into ascending order if necessary; gui_scalar_draw_select_rect
// expects them that way
if (u2 < u1) { if (u2 < u1) {
t_float u = u2; t_float u = u2;
u2 = u1; u1 = u; u2 = u1; u1 = u;
...@@ -573,9 +569,7 @@ void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state) ...@@ -573,9 +569,7 @@ void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state)
gui_vmess("gui_scalar_draw_select_rect", "xsiffffff", gui_vmess("gui_scalar_draw_select_rect", "xsiffffff",
glist_getcanvas(glist), tagbuf, glist_getcanvas(glist), tagbuf,
state, state,
// the actual selection rectangle is 1 unit larger than the u1, v1, u2, v2,
// bbox at each border
u1-1.0, v1-1.0, u2+1.0, v2+1.0,
basex, basex,
basey); basey);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment