Skip to content

Run hide actions and widget trigger actions in the annotation layer - #683

Merged
Velli20 merged 1 commit into
mainfrom
annotation-hide-actions
Oct 31, 2026
Merged

Velli20 merged 1 commit into
mainfrom
annotation-hide-actions

Conversation

@Velli20

@Velli20 Velli20 commented Oct 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • Decode /S /Hide actions (/T field names or object references, /H), flatten /Next chains into AnnotationAction::Sequence, and read widget /AA pointer and focus triggers (E X D U Fo Bl) plus each widget's partial field names. The new fields are #[serde(default)], so existing sidecars still load.
  • Add the Core operation SetHidden { hidden, shown } and the change event Change::VisibilityUpdated. A Hide action sets or clears each target's /F Hidden flag as one revision. Targets already in the requested state are skipped, so repeating an action commits nothing.
  • AnnotationOverlay::perform_action(id, trigger) replaces set_optional_content_state at every layer:
    • Hide steps commit the Core edit.
    • SetOCGState steps change optional content visibility.
    • All other steps come back in ActionReceipt::host_actions for the host.
  • Entries list the triggers that have an action. The web layer reports activation, pointer enter/exit, press/release and focus/blur for those triggers. A checkbox or radio also runs its /A action after its value is saved.

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings, cargo fmt --check
  • cargo test for pdf-annotation-core, pdf-web, pdf-renderer, pdf-document, pdf-object-reader
  • cargo xtask annotation-types --check, cargo xtask web-canvas --profile debug
  • Overlay check on a hide/show form (two push buttons whose Hide chains cover 9 checkboxes and 9 radios):
    • Hide Form leaves only the 2 buttons visible.
    • Hovering Show Form (cursor-enter action) brings the visible count back to 11.
    • Clicking Show Form brings it back to 20, and the widgets that reappear are editable.
  • Browser click-through in the web-canvas example
  • CI tsc check of crates/pdf-web/js

🤖 Generated with Claude Code

Decode /S /Hide actions, flatten /Next chains into an action sequence,
and read widget /AA pointer and focus triggers along with each widget's
partial field names. AnnotationOverlay::perform_action runs the action a
trigger selects: hide steps commit one SetHidden Core edit that sets or
clears the targets' hidden flag, optional content steps change
visibility, and the remaining steps return to the host. It replaces
set_optional_content_state.

Entries list the triggers that have an action, and the web layer reports
activation, pointer enter/exit, press/release, and focus/blur for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Velli20
Velli20 merged commit b4184a7 into main Oct 31, 2026
10 checks passed
@Velli20
Velli20 deleted the annotation-hide-actions branch October 31, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant