I noticed a timing issue where height is set as NaNpx and figure out it was down to the use of image.naturalHeight in the scrollAt* functions.
naturalHeight won't be set if the image isn't loaded yet.
I moved the code setting the height & width in a function resizePanes() and call it again after images are loaded.
I also noticed scrollAtRight and scrollAtLeft were the same. So I propose to reduce that duplication.
Same for scrollAtRight and scrollAtBottom.
Feel free to disagree with "this optimization".
I noticed a timing issue where
height
is set asNaNpx
and figure out it was down to the use of image.naturalHeight in the scrollAt* functions.naturalHeight won't be set if the image isn't loaded yet.
I moved the code setting the height & width in a function resizePanes() and call it again after images are loaded.
I also noticed scrollAtRight and scrollAtLeft were the same. So I propose to reduce that duplication. Same for scrollAtRight and scrollAtBottom. Feel free to disagree with "this optimization".