mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 13:38:22 +00:00
* feat(webui): render pdf pages via live canvas with selectable text Replace the rasterize-to-PNG pipeline in the PDF viewer with direct canvas rendering that tracks the current zoom, so text stays crisp when zoomed in, and overlay a pdf.js TextLayer that makes text natively selectable when not in draw mode. - pdf-viewer: render pages onto a live canvas at a zoom-proportional scale (debounced, memory-capped) instead of a fixed 2x PNG snapshot - pdf-viewer: add pdf.js TextLayer overlay per page, transformed in lockstep with the Konva stage so spans stay aligned while panning and zooming - drawing-canvas: accept an optional live canvas element and force a layer redraw when it is swapped - add text-layer.css with the minimal pdf.js text layer styles - add e2e spec verifying text selection in view mode and that draw mode routes drags to the canvas * fix(webui): show pdf text selection highlight above the page canvas The pdf.js text layer was stacked below the opaque Konva page canvas, so the native selection highlight was painted underneath it and invisible (selection itself worked). Move the overlay above the canvas and gate its pointer-events on draw mode: auto when not drawing (select text), none in draw mode so drags reach the Konva stage below (draw markup). Verified with screenshot pixel analysis: the selected region now renders the highlight (blue) where it was pure grayscale before. * fix(webui): transparent selection background for pdf text layer br elements * fix(webui): stop pdf text selection over-selecting in empty space The text layer container was user-selectable (user-select: auto), so when a drag's caret moved into empty space Chromium targeted the container and extended the selection to a container-content boundary, selecting across rows (e.g. dragging from line 1 into the gap selected lines 1-2). Make the container user-select: none while keeping the text spans user-select: text, so the caret clamps to the nearest selectable text and the selection stays put when dragging into empty space. * fix(webui): deselect pdf text when clicking empty space With user-select: none on the text layer container, Chromium no longer clears the selection when clicking non-selectable areas. Clear it manually on mousedown over the container or <br> (not a text span) so clicking empty space between lines or outside text deselects, matching native behavior.