Repository navigation
Edit: crop an existing page image with its handles - #2002
Merged
Merged
Conversation
ImageChange::Crop(rect) keeps the part of a page image inside rect (user space) with a clipping path placed just inside the scope that holds the image (or a new q … Q around its Do); a clipping path already at the scope's start, the picture's earlier crop, is replaced, so a crop can grow back. The pixels are never scaled, and a later move or resize wraps the scope, so the crop moves with the picture. ImageEdit::Crop (undo label "Crop image"), image_edit action crop. In the window, right-click ▸ Crop Image puts the selected picture in crop mode: eight handles trim (the inside pans), the part that goes is dimmed, Enter or Done applies, Esc or Cancel leaves; Remove Crop shows the whole picture again. Rows in every language, their checksums in ATTRIBUTION.toml, parity edit.image-crop shipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ATTRIBUTION.toml: the 21 language files' sha256 recomputed from the merged files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lacks
JetBrains Mono has no 'ѝ', so primary_ui_fonts_cover_latin_and_cyrillic_catalogs
failed; the hint is reworded ("with its handles" -> "with the handles").
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # ATTRIBUTION.toml # crates/engine/src/tests.rs # crates/ui-egui/src/i18n/ar.tsv # crates/ui-egui/src/i18n/bg.tsv # crates/ui-egui/src/i18n/cs.tsv # crates/ui-egui/src/i18n/de.tsv # crates/ui-egui/src/i18n/el.tsv # crates/ui-egui/src/i18n/es.tsv # crates/ui-egui/src/i18n/fr.tsv # crates/ui-egui/src/i18n/hu.tsv # crates/ui-egui/src/i18n/it.tsv # crates/ui-egui/src/i18n/ja.tsv # crates/ui-egui/src/i18n/kk.tsv # crates/ui-egui/src/i18n/lt.tsv # crates/ui-egui/src/i18n/pl.tsv # crates/ui-egui/src/i18n/pt-br.tsv # crates/ui-egui/src/i18n/ru.tsv # crates/ui-egui/src/i18n/sl.tsv # crates/ui-egui/src/i18n/te.tsv # crates/ui-egui/src/i18n/tr.tsv # crates/ui-egui/src/i18n/uk.tsv # crates/ui-egui/src/i18n/zh-hans.tsv # crates/ui-egui/src/i18n/zh-hant.tsv # crates/ui-egui/tests/editing.rs
Member
|
Thank you @regendorf-ux for cropping existing page images with handles! It's merged into main now. If you haven't already, please come and join us on Discord: https://discord.gg/artcraft |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
edit.image-cropwas partial ("for added images: trim each side, clipped"). Images already on thepage can now be cropped too:
ImageChange::Crop([f64; 4])(edit/src/images.rs): the part to keep, in user space, becomes am l l l h W nclipping path - the box's corners mapped by the inverse of the scope's matrix - placedjust inside the scope that holds the image (the private-crop scope from Resize exclusive image crops across nested states and content streams #1269), or a new
q … Qaround the
Do. A clipping path already at the scope's start (the picture's earlier crop) isreplaced, so a crop can grow back. The pixels are never scaled, and a later move or resize wraps the
scope, so the crop travels with the picture.
ImageEdit::Crop(undo label "Crop image"); toolimage_editactioncropwithrect(top-left-origin points, the part to keep).
edit_text_ui.rs): right-click a selected picture ▸ Crop Image puts it in crop mode(
CropMode, exported): eight handles trim (the inside pans), the part that goes is dimmed, Enter orDone applies, Esc or Cancel leaves; Remove Crop (enabled when the picture is cropped) shows the whole
picture again.
ATTRIBUTION.toml; parityedit.image-crop→ shipped, with what is still missing.How you verified it
Re-run on 2026-10-14 at 9beb327, after merging
mainat v0.8.0 (9931329) into the branch:cargo fmt --all --checkcargo clippy --workspace --all-targets -- -D warnings: cleancargo nextest run --workspace -E 'package(pdfcraft-automation) | package(pdfcraft-edit) | package(pdfcraft-engine) | package(pdfcraft-ui-egui)'(every test of the crates this PR changes): 1677 run, 1677 passedcargo xtask assets,cargo xtask parityandcargo xtask layers: okRunning every ui-egui test caught
primary_ui_fonts_cover_latin_and_cyrillic_catalogsfailing: the Bulgarian crop hint used "ѝ", which JetBrains Mono lacks. The hint is reworded without it (9beb327).Tests. New behaviour, so the tests exercise APIs this PR adds.
cropping_an_existing_image_clips_it_and_moves_with_it(engine): the crop clips the rendered picture, a later move carries the crop, cropping again can grow it
back, and a box with no area is refused.
cropping_a_picture_with_its_handles(ui-egui):dragging the bottom-right handle and pressing Enter crops; Esc leaves crop mode without a change.
editing_page_images_through_tools(automation) gains a crop step.Anything a reviewer should look at first
wording; a native speaker's review of those rows would be welcome.
belongs with a larger Properties change.
the original file is left as it is.
image-specific interactive crop in the same files (
edit/src/images.rs,edit_text_ui.rs). This PR isonly the crop:
ImageChange::Cropwith its edit, tool and handles, tested on its own. Whichever youprefer is fine; if feat: Acrobat UI parity for image editing, text formatting, and UI stabilization and Bug Fixes #2155's crop lands first I'll rebase this down to what it adds, or close it.
Never-crash
unwrap/expect/panic!outside testsunsafeProvenance
observation of Acrobat's crop handles
Security
Parity and reach
parity/acrobat-features.tomlupdated with what is still missingimage_editactioncrop🤖 Generated with Claude Code