fix: use pageEl bounding rect instead of canvas for create conversion

This commit is contained in:
Research Assistant 2026-05-20 19:17:44 +08:00
parent be7e0eab92
commit 7baf7a7548

View file

@ -812,7 +812,7 @@ function setupSelectionCapture(containerEl, vaultPath, pdfPath) {
var ar = cv.clientWidth / cv.clientHeight;
if (ar > 0.65 && ar < 0.75) { pdfW = 595; pdfH = 842; }
}
var cvRect = cv ? cv.getBoundingClientRect() : containerEl.getBoundingClientRect();
var cvRect = pageEl.getBoundingClientRect();
var zoomX = pdfW / cvRect.width, zoomY = pdfH / cvRect.height;
// Compute per-line rects using getClientRects for shaped highlights
var clientRects = range.getClientRects();