fix(pdf-editor): a page of solid text had nowhere to start an area selection
A band starts from the space between things, so that a drag across words still selects words to copy. On a page that is wall-to-wall text there is no such space, and the gesture simply did nothing — which is how it failed on a real document at 276% zoom, where every candidate starting point had a line of text under it. Alt-drag starts a band anywhere, text or not. The select hint says so.
This commit is contained in:
parent
cdad2907cb
commit
333f7988a8
3 changed files with 6 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "pdf-editor",
|
"id": "pdf-editor",
|
||||||
"name": "PDF Editor",
|
"name": "PDF Editor",
|
||||||
"version": "0.8.0",
|
"version": "0.8.1",
|
||||||
"description": "Open a PDF in a full tab: read it, mark it up with highlight, underline, strike-through, pen, shapes, arrows, text and a drawn signature, then move, resize, restyle or delete anything you placed. Reorder, rotate or drop pages, fill in form fields, redact for real, and save a new copy. Build a PDF from pictures, one page each, or join several PDFs into one. Marks are written into the saved file as real PDF content. The original is never touched.",
|
"description": "Open a PDF in a full tab: read it, mark it up with highlight, underline, strike-through, pen, shapes, arrows, text and a drawn signature, then move, resize, restyle or delete anything you placed. Reorder, rotate or drop pages, fill in form fields, redact for real, and save a new copy. Build a PDF from pictures, one page each, or join several PDFs into one. Marks are written into the saved file as real PDF content. The original is never touched.",
|
||||||
"author": "Silent Mode",
|
"author": "Silent Mode",
|
||||||
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYgMmg4bDYgNnYxMmEyIDIgMCAwIDEtMiAySDZhMiAyIDAgMCAxLTItMlY0YTIgMiAwIDAgMSAyLTJ6IiBmaWxsPSIjZGMyNjI2Ii8+PHBhdGggZD0iTTE0IDJ2Nmg2eiIgZmlsbD0iIzk5MWIxYiIvPjx0ZXh0IHg9IjEyIiB5PSIxNyIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9InN5c3RlbS11aSwtYXBwbGUtc3lzdGVtLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iNS41IiBmb250LXdlaWdodD0iODAwIiBmaWxsPSIjZmZmIj5QREY8L3RleHQ+PC9zdmc+",
|
"icon": "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZD0iTTYgMmg4bDYgNnYxMmEyIDIgMCAwIDEtMiAySDZhMiAyIDAgMCAxLTItMlY0YTIgMiAwIDAgMSAyLTJ6IiBmaWxsPSIjZGMyNjI2Ii8+PHBhdGggZD0iTTE0IDJ2Nmg2eiIgZmlsbD0iIzk5MWIxYiIvPjx0ZXh0IHg9IjEyIiB5PSIxNyIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZm9udC1mYW1pbHk9InN5c3RlbS11aSwtYXBwbGUtc3lzdGVtLHNhbnMtc2VyaWYiIGZvbnQtc2l6ZT0iNS41IiBmb250LXdlaWdodD0iODAwIiBmaWxsPSIjZmZmIj5QREY8L3RleHQ+PC9zdmc+",
|
||||||
|
|
|
||||||
|
|
@ -507,7 +507,7 @@ $("redact-ok").addEventListener("click", () => closeModal(true));
|
||||||
$("redact-cancel").addEventListener("click", () => closeModal(null));
|
$("redact-cancel").addEventListener("click", () => closeModal(null));
|
||||||
|
|
||||||
const TOOL_HINTS = {
|
const TOOL_HINTS = {
|
||||||
select: "Click a mark, or drag an area around several. Shift-click adds one, Ctrl+A takes the page.",
|
select: "Click a mark, or drag an area around several — Alt-drag to start one on top of text. Shift-click adds one, Ctrl+A takes the page.",
|
||||||
highlight: "Drag across text to highlight it.",
|
highlight: "Drag across text to highlight it.",
|
||||||
underline: "Drag across text to underline it.",
|
underline: "Drag across text to underline it.",
|
||||||
strikeout: "Drag across text to strike it through.",
|
strikeout: "Drag across text to strike it through.",
|
||||||
|
|
|
||||||
|
|
@ -313,8 +313,10 @@ export class Tools {
|
||||||
if (e.target?.closest?.(".annotationLayer")) return;
|
if (e.target?.closest?.(".annotationLayer")) return;
|
||||||
// ...or on the document's own words, where a drag means selecting
|
// ...or on the document's own words, where a drag means selecting
|
||||||
// them to copy. A band is started from the space between things,
|
// them to copy. A band is started from the space between things,
|
||||||
// which is where a hand reaches for one anyway.
|
// which is where a hand reaches for one anyway — except on a page
|
||||||
if (span) return;
|
// that is wall-to-wall text and has no such space, which is what
|
||||||
|
// Alt is for.
|
||||||
|
if (span && !e.altKey) return;
|
||||||
this.drag = { kind: "marquee", uid: hit.uid, x0: x, y0: y, x, y,
|
this.drag = { kind: "marquee", uid: hit.uid, x0: x, y0: y, x, y,
|
||||||
cx: e.clientX, cy: e.clientY, moved: false };
|
cx: e.clientX, cy: e.clientY, moved: false };
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue