mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-05-22 01:42:00 +00:00
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:
parent
948fa5ff6c
commit
c9853f6d5d
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user