Skip to content

Feature/improve custom rotate#631

Open
quhxl wants to merge 2 commits intoalam00000:mainfrom
quhxl:feature/improve-custom-rotate
Open

Feature/improve custom rotate#631
quhxl wants to merge 2 commits intoalam00000:mainfrom
quhxl:feature/improve-custom-rotate

Conversation

@quhxl
Copy link
Copy Markdown

@quhxl quhxl commented Apr 3, 2026

Description

This PR improves the usability of the "Rotate by Custom Degrees" tool by addressing two limitations:

  • Larger previews: Increased thumbnail height (h-36 to h-64) and reduced grid density to improve visual feedback when adjusting small rotation angles.
  • Floating-point support: Replaced parseInt with parseFloat, added step="0.1" to inputs, and implemented rounding to 1 decimal place for more precise control.

Fixes #630

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

🧪 How Has This Been Tested?

Please describe how you tested your changes so that maintainers can verify them. Include enough detail for someone else to reproduce your tests.

Checklist:

  • Verified output manually
  • Tested with relevant sample documents or data
  • Wrote Vite Test Case (if applicable)

Test details:

  • Uploaded scanned PDFs with slight skew (~0.5°–2°)
  • Applied fractional rotations (e.g. 1.2, -0.8)

Checklist:

  • I have signed the Contributor License Agreement (CLA) or my organization has signed the Corporate CLA
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • UI/UX Changes
    • Increased per-page thumbnail height for improved visibility.
    • Adjusted thumbnail grid to show fewer columns on smaller screens and increased spacing between items.
  • New Features
    • Rotation controls now accept and apply decimal angles, with 0.1° step precision and values normalized to one decimal place.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 3, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e95b70ab-1c4f-4a43-a2cf-272963614761

📥 Commits

Reviewing files that changed from the base of the PR and between ec178bd and 0ed5e95.

📒 Files selected for processing (1)
  • src/js/logic/rotate-custom-page.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/js/logic/rotate-custom-page.ts

📝 Walkthrough

Walkthrough

Increased thumbnail preview size and adjusted grid layout; enabled floating-point rotation inputs with 0.1-degree steps and one-decimal rounding for both per-page and batch rotation controls.

Changes

Cohort / File(s) Summary
Thumbnail Preview Size
src/pages/rotate-custom.html, src/js/logic/rotate-custom-page.ts
Increased thumbnail container height (h-36h-64) and changed grid columns/gap (grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-6).
Floating-Point Angle Support
src/js/logic/rotate-custom-page.ts, src/pages/rotate-custom.html
Replaced integer parsing (parseInt) with decimal parsing (parseFloat), set numeric inputs step="0.1", implemented rounding to one decimal place on increment/decrement/apply flows, and normalized input values and pageState.rotations to one-decimal precision.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I hopped in to tweak the view,
Thumbnails taller, crisp and true.
Angles now a silky glide,
0.1 steps, one-decimal pride.
Nibbles of precision — joy anew! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and overly broad, using generic language like 'improve' without clearly specifying what is being improved about the custom rotate feature. Consider a more specific title such as 'Add floating-point support and larger previews to custom rotate tool' to better convey the main improvements.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The PR description comprehensively covers the changes, issue reference, type of change, and testing performed, matching the template structure and requirements.
Linked Issues check ✅ Passed The PR successfully addresses both objectives from issue #630: floating-point input support (parseFloat, step=0.1, rounding to 1 decimal) and larger previews (h-64, reduced grid density).
Out of Scope Changes check ✅ Passed All changes directly align with the two objectives in issue #630: thumbnail sizing, grid layout adjustments, and floating-point input support are all in scope.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@quhxl
Copy link
Copy Markdown
Author

quhxl commented Apr 3, 2026

I have read the CLA Document and I hereby sign the CLA

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/js/logic/rotate-custom-page.ts`:
- Around line 152-153: The parseFloat usage in the apply handlers (e.g., where
you read input.value and set pageState.rotations[pageIndex]) accepts
NaN/Infinity and un-normalized numbers; fix by validating the parsed value with
Number.isFinite and normalizing to one decimal place before assignment (e.g.,
parse -> Number.isFinite check -> round to one decimal such as Math.round(value
* 10) / 10) and fallback to 0 when invalid; apply the same change to both the
handler that sets pageState.rotations[pageIndex] and the other apply path around
the code referenced near line 393 so all typed angles enforce finite values and
one-decimal precision.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a57585cb-7a59-42ec-9602-678c7aec094f

📥 Commits

Reviewing files that changed from the base of the PR and between ed6e6c0 and 7f9c352.

📒 Files selected for processing (3)
  • docs/tools/rotate-custom.md
  • src/js/logic/rotate-custom-page.ts
  • src/pages/rotate-custom.html

Comment thread src/js/logic/rotate-custom-page.ts Outdated
@quhxl quhxl force-pushed the feature/improve-custom-rotate branch from 7f9c352 to ec178bd Compare April 3, 2026 13:34
github-actions Bot added a commit that referenced this pull request Apr 3, 2026
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) Improve usability of "Rotate by Custom Degrees"

1 participant