libdraw: fix wrong menusel() calculation for menuhit() (noticable with small fonts)

the text for a menu entry is drawn from:

y = textr.min.y + i*(font->height+Vspacing);

but we calculated the item from:

r = insetrect(textr);
i = (p.y - r.min.y) / (font->height+Vspacing);

the insetrect is wrong.
This commit is contained in:
cinap_lenrek 2013-01-08 03:45:49 +01:00
parent 4041ea394b
commit 7295fa71a4
2 changed files with 0 additions and 2 deletions

View file

@ -68,7 +68,6 @@ menurect(Rectangle r, int i)
static int
menusel(Rectangle r, Point p)
{
r = insetrect(r, Margin);
if(!ptinrect(p, r))
return -1;
return (p.y-r.min.y)/(font->height+Vspacing);

View file

@ -69,7 +69,6 @@ menurect(Rectangle r, int i)
static int
menusel(Rectangle r, Point p)
{
r = insetrect(r, Margin);
if(!ptinrect(p, r))
return -1;
return (p.y-r.min.y)/(font->height+Vspacing);