naturalcrit / homebrewery

Create authentic looking D&D homebrews using only markdown
https://homebrewery.naturalcrit.com
MIT License
1.1k stars 326 forks source link

BrewRenderer toolbar zoom level affects Print sizing #3744

Closed G-Ambatte closed 1 month ago

G-Ambatte commented 1 month ago

When using the zoom function of the new BrewRenderer toolbar, attempting to print the brew results in pages at the zoomed size, not the intended print size. Possibly could be fixed by adding an @media print rule of zoom: 100% to override the toolbar's zoom setting (or whatever property it been uses to achieve this effect).

G-Ambatte commented 1 month ago

Investigation shows that the zoom property is set as an inline style on the .brewRenderer .pages element. However, experimentally, it appears that we can overwrite this by changing the print styling to the following:

@media print {
    .brewRenderer .pages {
        margin: 0px;
        zoom: 100% !important;
    }
}
Gazook89 commented 1 month ago

I thought for sure we already had this done in brewRenderer.less, but maybe it got lost in some merges or maybe it just didn't make it in:

https://github.com/naturalcrit/homebrewery/blob/cd0bf9c947b6537763535358fcd2fe8558651e8d/client/homebrew/brewRenderer/brewRenderer.less#L34C1-L45C2

Edit: at least it was discussed: https://github.com/naturalcrit/homebrewery/pull/3499#issuecomment-2307610694

G-Ambatte commented 1 month ago

I noticed some weird margins the other day, and didn't think anything further of it at the time. It came back up today because I was working on a A3 battle map that I had printed before, which of course zoomed out to fit in the Brew Renderer, and despite multiple attempts to print, I could not get it to fill the entire printed page today. It was only after I went back to the brew and thought about what was different today that I realized that it was the zoom level. Returning to 100% zoom, it immediately printed correctly.

At the very least, it's a one line fix.