Skip to content

Commit

Permalink
fix crop box for reference over 2 pages
Browse files Browse the repository at this point in the history
  • Loading branch information
kermitt2 committed Aug 30, 2021
1 parent 605da3d commit 332c1b3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions grobid-service/src/main/resources/web/grobid/grobid.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,18 @@ var grobid = (function($) {
else {
//if (pos && (pos.length > 0)) {
var theFirstPos = pos[0];
// we can't visualize over two pages, so we take as theLastPos the last coordinate position on the page of theFirstPos

var theLastPos = pos[pos.length-1];
if (theLastPos.p != theFirstPos.p) {
var k = 2;
while (pos.length-k>0) {
theLastPos = pos[pos.length-k];
if (theLastPos.p == theFirstPos.p)
break;
k++;
}
}
theBibPos.p = theFirstPos.p;
theBibPos.w = Math.max(theFirstPos.w, theLastPos.w);
theBibPos.h = Math.max(Math.abs(theLastPos.y - theFirstPos.y), theFirstPos.h) + Math.max(theFirstPos.h, theLastPos.h);
Expand Down

0 comments on commit 332c1b3

Please sign in to comment.