Skip to content

fix(signature): compute upload crop default size in image pixels - #9555

Open
no84by wants to merge 1 commit into
LibreSign:mainfrom
no84by:fix/upload-crop-default-size
Open

no84by wants to merge 1 commit into
LibreSign:mainfrom
no84by:fix/upload-crop-default-size

Conversation

@no84by

@no84by no84by commented Nov 18, 2026

Copy link
Copy Markdown

Resolves: #9526

Part of #9048

Summary

In the signature dialog, tab "Upload", the cropper received :default-size as an object computed from the container width (screen pixels). vue-advanced-cropper reads an object defaultSize as image pixels, so on a real photo or scan the initial crop frame covered only a few percent of the image.

The default size is now passed in the documented function form and computed from the loaded image: the largest stencil that fits the image at the configured signature aspect ratio. The aspect ratio behaviour is unchanged. When no signature size is configured, no defaultSize is passed and the library default applies. The calculation lives in a small pure helper, fitStencilToImage.

How to test

  1. Open the account page, section "Signature", create a new signature.
  2. Select the "Upload" tab and choose an image larger than about 1000 px wide (phone photo or scan).
  3. The initial crop frame covers the image at the signature aspect ratio instead of a tiny box.

Validation evidence

  • Focused regression/acceptance test
  • Relevant lint/type/static-analysis checks
  • Broader suite required by the changed surface
  • CI reviewed

Ran: vitest run for the new helper spec and src/tests/components/Draw (79 tests passed), eslint on the changed files, vue-tsc --noEmit.

UI / Front-end changes

  • Initial crop frame is computed in image pixels

  • Screenshots before/after added for user-visible changes

  • Tested in relevant browsers when applicable

  • Component/unit (Vitest) and/or E2E (Playwright) tests added or updated

  • Accessibility verified when applicable

  • Design review approved when applicable

  • Documentation updated when applicable

Checklist

  • I have read and followed the contribution guide.
  • The diff does not contain unrelated refactors or generated changes.
  • Commits follow Conventional Commits where applicable.
  • All commits include the required DCO sign-off.

AI (if applicable)

  • The content of this PR was partially or fully generated using AI

vue-advanced-cropper reads an object defaultSize as image pixels, but the
upload tab derived it from the container width in screen pixels, so the
initial crop frame was tiny on any real photo or scan.

Pass the documented function form instead and fit the largest stencil that
matches the configured signature aspect ratio inside the loaded image.

Signed-off-by: no84by <50858621+no84by@users.noreply.github.com>
@no84by

no84by commented Nov 18, 2026

Copy link
Copy Markdown
Author

Screenshots (test instance on main 7a8403d vs this branch, light and dark theme):

Upload tab with a 3000x2000 image: default crop frame

Before (light) After (light)
before after
Before (dark) After (dark)
before after

This branch has not been deployed

No deployments
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.

Signature upload: crop frame is fixed at 350×100 *image pixels*, so it is tiny on any real photo or scan

1 participant