Skip to content

Pictures: Change Picture replaces the selected picture (#115) - #204

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
justinjohn0306:issue-115-change-picture
Oct 14, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
justinjohn0306:issue-115-change-picture

Conversation

@justinjohn0306

Copy link
Copy Markdown
Contributor

Fixes #115 (the replace-from-a-local-file part).

Bug: Picture Format ▸ Change Picture ran app.insertPictureDialog, so it inserted a second picture instead of replacing the selected one. The engine already had picture.change; nothing in the UI called it.

  • New UI command app.changePictureDialog: file picker → picture.change. The picture keeps its position, size, effects and other formatting (crop resets, since the new image has its own proportions).
  • The ribbon button uses it, and the canvas right-click menu shows Change Picture… when a picture is selected.
  • Web: the browser picker delivers the file later through the inbox, so the pending change is remembered for that one pick.

Not in this PR: replacing from an icon or from the clipboard (the other two sources in the issue).

Verified: new change_picture_replaces_the_selected_picture test covering the desktop and web picker paths; cargo test -p deckcraft-ui-egui, clippy -D warnings, cargo fmt --check.

🤖 Generated with Claude Code

The Picture Format ▸ Change Picture button ran the insert-picture dialog,
so it added a second picture instead of replacing the selected one. A new
app.changePictureDialog picks a file and runs picture.change, which keeps
the picture's position, size and formatting; the canvas right-click menu
offers it on pictures too. On the web, where the file arrives later
through the inbox, the pending change is remembered for that pick.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@echelon

echelon commented Oct 14, 2026

Copy link
Copy Markdown
Member

Thank you for this contribution, @justinjohn0306! It has landed on main and will ship in the next DeckCraft release.

If you haven't already, please come join us on Discord: https://discord.gg/artcraft

h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 14, 2026
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
…told#228)

* Split: keep only the resources each part draws (storytold#204)

In a book whose pages share one resource dictionary, every split part carried every XObject the source listed: a part saved out at the source's size although its pages drew a fraction of the images. extract_pages now walks each part's content (form XObjects included) and drops the /XObject entries no page names; the garbage-collecting rewrite on save then drops the objects themselves. Tests cover a one-page part that must lose the other page's image and a part that needs both.

* Split/Extract pruning never drops an XObject something might still draw

A resources dictionary is left untouched when one of its pages has content
that can't be decoded, when a form nests past the depth limit, or when it
lists a Type 3 font without its own /Resources (its glyphs draw through
the page's). Regression tests fail without this.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Mohammed Munzir <Mohammed.Munzir@iga.gov.bh>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Feature - Replace image

3 participants