Fix the z-order of ink drawings relative to the other editors - #21608
Fix the z-order of ink drawings relative to the other editors#21608mughalfrazk wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #21608 +/- ##
=======================================
Coverage 89.84% 89.85%
=======================================
Files 263 263
Lines 66772 66828 +56
=======================================
+ Hits 59993 60048 +55
- Misses 6779 6780 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
2acada9 to
66dae65
Compare
|
Hi @timvandermeij, the |
|
You can ignore the Windows failure indeed if it's one of the ones from https://github.com/mozilla/pdf.js/issues?q=is%3Aissue%20state%3Aopen%20label%3Aintermittent; those are known intermittents. |
66dae65 to
05f3b19
Compare
|
Hi @timvandermeij, tests were cleared, i rebased to resolve conflicts, waiting approval for another run |
When an ink drawing and an image/stamp overlap, the editor always painted the image on top, whatever order they were created in. Saving and reopening the PDF showed the correct order, so the preview didn't match the final rendering.
The drawings are SVGs living in the canvas wrapper, whereas the other editors are divs living in the annotation editor layer. Both layers are siblings in the page and neither creates a stacking context, so their children compete directly, and the SVGs had no z-index at all.
The SVGs now carry the z-index of the editor they belong to, both when they're created and when it changes. The in-progress drawing uses the z-index its editor will be given once the drawing session ends, so that the stroke doesn't jump when the pointer is released.
Since the SVGs are now stacked with the editors, they're also hit-tested before the annotation editor layer, so they must not swallow the pointer events used to draw: they're purely visual, the editor div being what handles the interactions.
Fixes #21401.