split double page if necessary

This commit is contained in:
Celogeek 2023-01-15 15:38:24 +01:00
parent e8f806141e
commit 259bf6bb7b
Signed by: celogeek
GPG Key ID: E6B7BDCFC446233A

View File

@ -154,7 +154,14 @@ func LoadImages(path string, options *ImageOptions) ([]*Image, error) {
dst.Bounds().Dy(),
}
if options.AutoSplitDoublePage && src.Bounds().Dx() > src.Bounds().Dy() {
// Auto split double page
// Except for cover
// Only if the src image have width > height and is bigger than the view
if img.Id > 0 &&
options.AutoSplitDoublePage &&
src.Bounds().Dx() > src.Bounds().Dy() &&
src.Bounds().Dx() > options.ViewHeight &&
src.Bounds().Dy() > options.ViewWidth {
gifts := NewGiftSplitDoublePage(options)
for i, g := range gifts {
part := i + 1