naturalcrit / homebrewery

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

Preview render doesn't match page size #142

Closed calculuschild closed 7 years ago

calculuschild commented 8 years ago

Browser Type/Version: Google Chrome Version 51.0.2704.84 m

Operating System: Windows 7 64x

Issue Description: The preview on the right pane seems to have some code telling it to hide or display each page as it comes into view when scrolling up and down. When using an irregular page size (e.g., landscape dimensions), this hide/render code seems to still be using the old dimensions; now that the page is much shorter vertically, the pages toward the bottom don't render until scrolled off the top of the screen. Kind of hard to explain. Maybe just look at my project and watch what happens when you scroll down the preview on the right.

Brew code to reproduce:

Here's my brew: http://homebrewery.naturalcrit.com/edit/HJxJgrVMN I changed the dimensions as below:

<style>
.phb{
    width : 297mm;
    height : 230mm;
    padding : 6mm;
}
</style>

image Image not rendering

image Ah! There it finally rendered as I scrolled up farther. Pages lower down get worse.

calculuschild commented 8 years ago

Hope this made sense. It looks like something in your brewRenderer.jsx file where you determine viewablePageNumber. My guess is its because you use

Line 33 --- viewablePageNumber : Math.floor(e.target.scrollTop / PAGE_HEIGHT)

which relies on a predefined PAGE_HEIGHT. If the actual page height is different than this (as is my case) then the page that renders isn't necessarily the page in view.

calculuschild commented 7 years ago

This was fixed with 2.6.0.