Skip to content

PB-1522 : DPI responsive print margin#1311

Merged
pakb merged 1 commit intodevelopfrom
feat-PB-1522-dpi-responsive-print-margin
Apr 28, 2025
Merged

PB-1522 : DPI responsive print margin#1311
pakb merged 1 commit intodevelopfrom
feat-PB-1522-dpi-responsive-print-margin

Conversation

@pakb
Copy link
Contributor

@pakb pakb commented Apr 28, 2025

We will move the generation of margin in the viewer, instead of dealing with that on the backend. This is because it's way easier to keep the "true-to-scale" when shrinking the map viewport (and let it recalculate everything) instead of resizing the flatten map and thus changing the scale of the image.

Test link

@pakb pakb marked this pull request as ready for review April 28, 2025 06:44
@cypress
Copy link

cypress bot commented Apr 28, 2025

web-mapviewer    Run #5142

Run Properties:  status check passed Passed #5142  •  git commit 9bb7effbd7: Merge pull request #1311 from geoadmin/feat-PB-1522-dpi-responsive-print-margin
Project web-mapviewer
Branch Review develop
Run status status check passed Passed #5142
Run duration 01m 23s
Commit git commit 9bb7effbd7: Merge pull request #1311 from geoadmin/feat-PB-1522-dpi-responsive-print-margin
Committer Pascal Barth
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 48
View all changes introduced in this branch ↗︎

We will move the generation of margin in the viewer, instead of dealing with that on the backend. This is because it's way easier to keep the "true-to-scale" when shrinking the map viewport (and let it recalculate everything) instead of resizing the flatten map and thus changing the scale of the image.

Using CSS padding instead of margin, so that we respect the A4 size we previously calculated (if we use margin, it will extend the "page" size and break the A4 layout)
@pakb pakb force-pushed the feat-PB-1522-dpi-responsive-print-margin branch from ae7672c to 82d0bb3 Compare April 28, 2025 09:36
@pakb pakb requested a review from rebert April 28, 2025 09:36

export const PRINT_DEFAULT_DPI = 96

export const PRINT_MARGIN_IN_MILLIMETERS = 4
Copy link
Contributor

Choose a reason for hiding this comment

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

PRINT_PADDING_IN_MILIMETERS ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's technically a print margin (that's how you call it on the print dialog). But I'm using padding under the hood so that I don't break the layout

Copy link
Contributor

@rebert rebert left a comment

Choose a reason for hiding this comment

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

Nice - and the true to scale is still working

@pakb pakb merged commit 9bb7eff into develop Apr 28, 2025
6 checks passed
@pakb pakb deleted the feat-PB-1522-dpi-responsive-print-margin branch April 28, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants