ref: 815fa1c7a7f469e01c594d0c4b570972d0db76df
parent: 0281f3466bd385123ea7608832e8bc6deb54dd78
author: phil9 <telephil9@gmail.com>
date: Tue Mar 22 18:08:09 EDT 2022
fix links coordinates computation
--- a/dview.c
+++ b/dview.c
@@ -19,6 +19,7 @@
struct Link
{
+ Box *b;
Rectangle r;
char text[255];
};
@@ -85,6 +86,7 @@
inlink = 1;
break;
case '}':
+ links[nlinks].b = b;
links[nlinks].r = Rpt(lp, addpt(p, Pt(0, font->height)));
links[nlinks].text[cl] = '\0';
nlinks += 1;
@@ -120,6 +122,8 @@
totalh += Dy(b->r) + Padding;
}
scrollsize = 10*totalh/100.0;
+ for(i = 0; i < nlinks; i++)
+ links[i].r = rectaddpt(links[i].r, links[i].b->sr.min);
}
void
@@ -141,6 +145,7 @@
}
free(defs);
}
+ offset = 0;
nlinks = 0;
defs = d;
nboxes = dvlen(defs);
@@ -224,7 +229,7 @@
{
int i;
- p = subpt(p, addpt(boxr.min, Pt(0, offset)));
+ p = addpt(p, Pt(0, offset));
for(i = 0; i < nlinks; i++){
if(ptinrect(p, links[i].r)){
nbsendp(chan, strdup(links[i].text));