fix(preview): PDF resize sticks to the cursor (#295 follow-up) #316
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/pdf-preview-resize"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
Resizing the preview panel and releasing the mouse doesn't end the drag — the panel keeps tracking the cursor. PDF-only.
Root cause
The divider drag adds
mousemove/mouseuplisteners ondocument; theuphandler removes them onmouseup. PDF is the only preview rendered in an<iframe>(renderPvBody:if (ext === "pdf") … createElement("iframe")) — images/video/audio/text are same-document elements. When the drag cursor passes over the PDF iframe,mouseupfires inside the iframe's browsing context and never reaches the parentdocument, soupnever runs,moveis never removed, and the panel keeps resizing. Images/video/etc. don't capture events, which is why only PDF sticks.Fix
Set
#pvbody { pointer-events: none }for the duration of the drag (onmousedown, cleared inup). With the iframe non-interactive, the drag's mouse events reach the parentdocumentandmouseupfires normally. Two-line change, targets the root cause.Verified:
node --checkon the page scripts. (Automated browser testing of iframe event-capture isn't feasible without a real browser — this needs a live click-drag-over-a-PDF to confirm, which is the operator's check.)Also confirms the finding on #297: office formats (docx/xlsx/pptx) are not previewed today — they fall through to the "No preview" card. That's the still-open #297 feature, not a regression.