mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-14 10:34:06 +02:00
Closes #6518 # Cause of the bug This is a fix to the #6518 issue. The bug happened because the link toolbar was rendered inside the PDF page layer. That layer can be affected by the viewer/page rotation transform, so the toolbar was laid out using local page coordinates and then visually transformed together with the page. As a result, the placement logic could calculate a position that was correct in the page’s local coordinate space, such as above or below the link, but the parent transform would rotate or shift that result after layout. On rotated pages, this could make the toolbar appear on the wrong side, inverted, or misaligned relative to the link. More specifically, in the PDF that exposed the bug, the page content appears to have been authored upside down and then corrected with a 180-degree page/viewer rotation so it looks normal to the user. Because the toolbar was rendered inside the same transformed page layer, it inherited that 180-degree rotation as well. The PDF content looked upright because the rotation was part of how the page was displayed, but the toolbar is viewer UI and should not be rotated with the page. As a result, the tooltip appeared upside down even though the PDF itself looked correct. # Description of Changes Fixes the inverted link tooltip/toolbar positioning in rotated PDF viewer pages. The link toolbar is now rendered through a body portal and positioned from the link element’s real viewport bounds, so page rotation transforms no longer flip or misalign it. The update also keeps the toolbar within the viewport during scroll, resize, zoom, and rotation changes, preserves the hover delay between the link and toolbar, centralizes the z-index in a shared constant, and improves label sizing to avoid clipped text. Note: The link hover styling was also changed from an underline to a subtle rectangular highlight based on the PDF link annotation bounds. <!-- Please provide a summary of the changes, including: - What was changed - Why the change was made - Any challenges encountered Closes #(issue_number) --> --- ## Checklist ### General - [X] I have read the [Contribution Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md) - [X] I have read the [Stirling-PDF Developer Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md) (if applicable) - [ ] I have read the [How to add new languages to Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md) (if applicable) - [X] I have performed a self-review of my own code - [X] My changes generate no new warnings ### Documentation - [ ] I have updated relevant docs on [Stirling-PDF's doc repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/) (if functionality has heavily changed) - [ ] I have read the section [Add New Translation Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags) (for new translation tags only) ### Translations (if applicable) - [ ] I ran [`scripts/counter_translation.py`](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/docs/counter_translation.md) ### UI Changes (if applicable) - [X] Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR) UI behaviour before the changes : <img width="1256" height="868" alt="Captura de tela de 2026-06-16 00-12-10" src="https://github.com/user-attachments/assets/321edbb3-42a2-4bc3-96ad-3ccc70a355b8" /> <img width="762" height="496" alt="Captura de tela de 2026-06-16 00-11-46" src="https://github.com/user-attachments/assets/be4c1af4-5488-4a54-9b6f-675e3bea73b8" /> <img width="1256" height="868" alt="Captura de tela de 2026-06-16 00-12-57" src="https://github.com/user-attachments/assets/60f44cd5-c772-44a8-97c8-bde135764e53" /> UI behaviour after the changes : <img width="1256" height="868" alt="Captura de tela de 2026-06-16 00-22-02" src="https://github.com/user-attachments/assets/dda77bda-0780-4807-a70d-3bbc60683e5a" /> <img width="1256" height="868" alt="Captura de tela de 2026-06-16 00-23-07" src="https://github.com/user-attachments/assets/5745c37e-438a-4bbe-ba1e-c6f2098421de" /> <img width="1256" height="868" alt="Captura de tela de 2026-06-16 00-23-24" src="https://github.com/user-attachments/assets/85932541-4a6f-48e4-879f-41f34a6d79e6" /> ### Testing (if applicable) - [X] I have run `task check` to verify linters, typechecks, and tests pass - [X] I have tested my changes locally. Refer to the [Testing Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#7-testing) for more details. --------- Co-authored-by: James Brunton <[email protected]> Co-authored-by: Anthony Stirling <[email protected]>