fix(annotations): correct signature frame mapping by filtering by pageIndex
- Updated `mapSignature` to filter signature annotations by `pageIndex` when finding nearest elements. - Ensures correct association of frames and signature data for each page. - Prevents errors caused by cross-page annotation references.
This commit is contained in:
@@ -331,7 +331,9 @@ function mapSignature(iJSON) {
|
||||
|
||||
// frames
|
||||
...iJSON.annotations.filter(annot => annot.description === 'FRAME').map((annot) => {
|
||||
const preElement = findNearest(annot, e => e.bbox[0], e => e.bbox[1], ...iJSON.annotations.filter(field => field.id.includes("signature")));
|
||||
const preElement = findNearest(annot, e => e.bbox[0], e => e.bbox[1], iJSON.annotations.filter(
|
||||
field => field.id.includes("signature") && field.pageIndex === annot.pageIndex
|
||||
));
|
||||
const idPartsOfPre = preElement.id.split('#');
|
||||
return {
|
||||
elementId: Number(idPartsOfPre[2]),
|
||||
@@ -343,7 +345,9 @@ function mapSignature(iJSON) {
|
||||
|
||||
// signatures
|
||||
...iJSON.annotations.filter(annot => annot.isSignature).map(annot => {
|
||||
const preElement = findNearest(annot, e => e.bbox[0], e => e.bbox[1], ...iJSON.annotations.filter(field => field.id.includes("signature")));
|
||||
const preElement = findNearest(annot, e => e.bbox[0], e => e.bbox[1], iJSON.annotations.filter(
|
||||
field => field.id.includes("signature") && field.pageIndex === annot.pageIndex
|
||||
));
|
||||
const idPartsOfPre = preElement.id.split('#');
|
||||
|
||||
let value;
|
||||
|
||||
Reference in New Issue
Block a user