mirror of
https://github.com/celogeek/go-comic-converter.git
synced 2025-05-24 15:52:38 +02:00
Compare commits
3 Commits
47205b16be
...
fee8a037dc
Author | SHA1 | Date | |
---|---|---|---|
fee8a037dc | |||
7e3f0d4fcc | |||
0c09c85763 |
@ -1,4 +1,4 @@
|
||||
// Package options manage options with default value from config.
|
||||
// Package converter options manage options with default value from config.
|
||||
package converter
|
||||
|
||||
import (
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Package profiles manage supported profiles for go-comic-converter.
|
||||
// Package converter profiles manage supported profiles for go-comic-converter.
|
||||
package converter
|
||||
|
||||
import (
|
||||
|
@ -312,9 +312,10 @@ func (e EPUB) computeAspectRatio(epubParts []epubPart) float64 {
|
||||
return bestAspectRatio
|
||||
}
|
||||
|
||||
func (e EPUB) computeViewPort(epubParts []epubPart) {
|
||||
func (e EPUB) computeViewPort(epubParts []epubPart) (int, int) {
|
||||
if e.Image.View.AspectRatio == -1 {
|
||||
return //keep device size
|
||||
//keep device size
|
||||
return e.Image.View.Width, e.Image.View.Height
|
||||
}
|
||||
|
||||
// readjusting view port
|
||||
@ -325,9 +326,9 @@ func (e EPUB) computeViewPort(epubParts []epubPart) {
|
||||
|
||||
viewWidth, viewHeight := int(float64(e.Image.View.Height)/bestAspectRatio), int(float64(e.Image.View.Width)*bestAspectRatio)
|
||||
if viewWidth > e.Image.View.Width {
|
||||
e.Image.View.Height = viewHeight
|
||||
return e.Image.View.Width, viewHeight
|
||||
} else {
|
||||
e.Image.View.Width = viewWidth
|
||||
return viewWidth, e.Image.View.Height
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,7 +446,7 @@ func (e EPUB) Write() error {
|
||||
Json: e.Json,
|
||||
})
|
||||
|
||||
e.computeViewPort(epubParts)
|
||||
e.Image.View.Width, e.Image.View.Height = e.computeViewPort(epubParts)
|
||||
for i, part := range epubParts {
|
||||
ext := filepath.Ext(e.Output)
|
||||
suffix := ""
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Package epuboptions EPUBOptions for EPUB creation.
|
||||
// Package epuboptions for EPUB creation.
|
||||
package epuboptions
|
||||
|
||||
type EPUBOptions struct {
|
||||
|
@ -227,7 +227,7 @@ func (o Content) getSpineAuto() []tag {
|
||||
)
|
||||
}
|
||||
}
|
||||
for _, img := range o.Images {
|
||||
for i, img := range o.Images {
|
||||
if (img.DoublePage || img.Part == 1) && o.ImageOptions.Manga == isOnTheRight {
|
||||
spine = append(spine, tag{
|
||||
"itemref",
|
||||
@ -242,6 +242,8 @@ func (o Content) getSpineAuto() []tag {
|
||||
tagAttrs{"idref": img.PageKey(), "properties": img.Position},
|
||||
"",
|
||||
})
|
||||
// save position, img is a value type
|
||||
o.Images[i] = img
|
||||
}
|
||||
if o.ImageOptions.Manga == isOnTheRight {
|
||||
spine = append(spine, tag{
|
||||
|
Loading…
x
Reference in New Issue
Block a user