Removed rounding causing images to scale on viewer (#3237)

# Description of Changes

Please provide a summary of the changes, including:

- What was changed

Removed forced rounding up of image sizes when added to a pdf. 
- Why the change was made

This was originally added as part of [pull
2433](https://github.com/Stirling-Tools/Stirling-PDF/pull/2433) to aid
with redaction. I assume it was added so that redactions always round up
to cover every considered pixel.

This rounding-up logic had issues on certain browsers. 


Closes #(3199)

---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
This commit is contained in:
ConnorYoh 2025-03-25 17:57:58 +00:00 committed by GitHub
parent 948fa5ff6c
commit c9853f6d5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6385,8 +6385,8 @@ function setLayerDimensions(div, viewport, mustFlip = false, mustRotate = true)
const useRound = util_FeatureTest.isCSSRoundSupported; const useRound = util_FeatureTest.isCSSRoundSupported;
const w = `var(--scale-factor) * ${pageWidth}px`, const w = `var(--scale-factor) * ${pageWidth}px`,
h = `var(--scale-factor) * ${pageHeight}px`; h = `var(--scale-factor) * ${pageHeight}px`;
const widthStr = useRound ? `round(up, ${w}, 1px)` : `calc(${w})`, const widthStr = useRound ? `round(${w}, 1px)` : `calc(${w})`,
heightStr = useRound ? `round(up, ${h}, 1px)` : `calc(${h})`; heightStr = useRound ? `round(${h}, 1px)` : `calc(${h})`;
if (!mustFlip || viewport.rotation % 180 === 0) { if (!mustFlip || viewport.rotation % 180 === 0) {
style.width = widthStr; style.width = widthStr;
style.height = heightStr; style.height = heightStr;