Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/operations/edit-pdf/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,14 @@ export default function EditPdf() {

const updateAnno = (id, patch) => setAnnos((prev) => prev.map((a) => (a.id === id ? { ...a, ...patch } : a)))
// Apply a style change to the currently-selected annotation (if any).
const patchSelected = (patch) => selectedId && updateAnno(selectedId, patch)
// Goes through `commit` (not `updateAnno`) so style edits land in undo
// history. `updateAnno` stays raw on purpose: it also serves drag/resize
// `onChange`, which fires many updates per gesture.
const patchSelected = (patch) => {
if (!selectedId) return
const id = selectedId
commit((prev) => prev.map((a) => (a.id === id ? { ...a, ...patch } : a)))
}

// ── erase (delete added items under the cursor) ──
const distToSeg = (px, py, x1, y1, x2, y2) => {
Expand Down
Loading