ajslater / codex

Codex is a web based comic archive browser and reader
GNU General Public License v3.0
210 stars 8 forks source link

Feature request: enlarge-to-screen setting #167

Closed ToxicFrog closed 1 year ago

ToxicFrog commented 2 years ago

For most professionally produced comics the main problem is the pages being larger than the screen, but there's a lot of indie stuff, archived webcomics, old scanlations, etc that is drawn or scanned at a lower resolution and is smaller than the screen size on modern displays. When viewing these in Codex it results in a small page floating in a sea of blackness. It would be nice to have an option in Codex to enlarge these to the screen.

The following CSS is not production-ready and won't work on PDFs, but accomplishes this for CBZs by hijacking the existing "fit to" logic to expand small images as well as shrinking large ones:

img.page.fitToScreen {
  height: 100vh;
  width: 100vw;
  object-fit: contain;
}

img.page.fitToHeight {
  height: 100vh;
  object-fit: contain;
}

img.page.fitToWidth {
  width: 100vw;
  object-fit: contain;
}
ajslater commented 2 years ago

v0.10.5 has changed the shrink-to-screen setting into a fit-to-screen setting that should enlarge small pages.

ToxicFrog commented 1 year ago

As of 0.14 this is back to behaving as shrink-to-screen.

Updated fix:

div.page img.fitToScreen,
div.pdfPage.fitToScreen > div > canvas {
  height: 100vh !important;
  width: 100vw !important;
  object-fit: contain;
}

div.page img.fitToHeight,
div.pdfPage.fitToHeight > div > canvas {
  height: 100vh !important;
  object-fit: contain;
}

div.page img.fitToWidth,
div.pdfPage.fitToHeight > div > canvas {
    width: 100vw !important;
  object-fit: contain;
}
ajslater commented 1 year ago

I think I've mostly solved this in v1.0.0. Like 85% solved. There are some tradeoffs, but with any luck your use case falls into the solved part.

ToxicFrog commented 1 year ago

Seems fixed for my uses!