Repository navigation
fix(watermark): align canvas rotation with PDF CCW convention - #15
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
pdfseal | 01f305b | Commit Preview URL Branch Preview URL |
Sep 29 2026, 01:40 PM |
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.
🦭 Pull Request Description
Summary of Changes
Watermark rotation was mirrored: setting -45° in the UI produced a watermark that looked like +45° (and vice versa).
Root cause: PDF user space is Y-up — positive angles rotate counterclockwise (ISO 32000; matches Adobe Acrobat). Canvas 2D is Y-down (screen raster), so a positive angle visually rotates clockwise. The raw user-facing angle was passed to
ctx.rotate()without sign conversion, while the pdf-lib fallback branch (rotate: degrees(rotation)) already followed the PDF convention — the two render paths even disagreed with each other.Fix (sign-only, 3 sites):
src/tools/WatermarkTool.vue— live preview canvas:rotate((-wmAngle * π) / 180)src/tools/WatermarkTool.vue— export stamping canvas: same negationsrc/utils/pipeline/nodes/watermarkNode.js— pipeline Canvas branch:rotate((-rotation * π) / 180), now visually consistent with thedegrees(rotation)fallback in the same fileAfter this change all paths share one convention: positive = counterclockwise, so
-45°renders as\and+45°as/, consistent with Acrobat and pdf-lib. No changes to query-param parsing (anglestill clamped to -90..90) or stored settings.Type of Change
🛡️ Privacy & Quality Checklist
npm test). (vitest:tests/watermark.test.js+tests/toolQueryParams.test.js, 24/24 passed)canvas— the pipeline node falls back to the pdf-lib branch, which was already correct and is covered). Recommend a follow-up e2e visual assertion for angle directions.console.logstatements.Related Issues
Closes #