Compare commits

..

No commits in common. "fee8a037dc16faf9e58d3f64191b5080593e883e" and "47205b16be1896ed318fa61304ed90bffd844d74" have entirely different histories.

5 changed files with 9 additions and 12 deletions

View File

@ -1,4 +1,4 @@
// Package converter options manage options with default value from config. // Package options manage options with default value from config.
package converter package converter
import ( import (

View File

@ -1,4 +1,4 @@
// Package converter profiles manage supported profiles for go-comic-converter. // Package profiles manage supported profiles for go-comic-converter.
package converter package converter
import ( import (

View File

@ -312,10 +312,9 @@ func (e EPUB) computeAspectRatio(epubParts []epubPart) float64 {
return bestAspectRatio return bestAspectRatio
} }
func (e EPUB) computeViewPort(epubParts []epubPart) (int, int) { func (e EPUB) computeViewPort(epubParts []epubPart) {
if e.Image.View.AspectRatio == -1 { if e.Image.View.AspectRatio == -1 {
//keep device size return //keep device size
return e.Image.View.Width, e.Image.View.Height
} }
// readjusting view port // readjusting view port
@ -326,9 +325,9 @@ func (e EPUB) computeViewPort(epubParts []epubPart) (int, int) {
viewWidth, viewHeight := int(float64(e.Image.View.Height)/bestAspectRatio), int(float64(e.Image.View.Width)*bestAspectRatio) viewWidth, viewHeight := int(float64(e.Image.View.Height)/bestAspectRatio), int(float64(e.Image.View.Width)*bestAspectRatio)
if viewWidth > e.Image.View.Width { if viewWidth > e.Image.View.Width {
return e.Image.View.Width, viewHeight e.Image.View.Height = viewHeight
} else { } else {
return viewWidth, e.Image.View.Height e.Image.View.Width = viewWidth
} }
} }
@ -446,7 +445,7 @@ func (e EPUB) Write() error {
Json: e.Json, Json: e.Json,
}) })
e.Image.View.Width, e.Image.View.Height = e.computeViewPort(epubParts) e.computeViewPort(epubParts)
for i, part := range epubParts { for i, part := range epubParts {
ext := filepath.Ext(e.Output) ext := filepath.Ext(e.Output)
suffix := "" suffix := ""

View File

@ -1,4 +1,4 @@
// Package epuboptions for EPUB creation. // Package epuboptions EPUBOptions for EPUB creation.
package epuboptions package epuboptions
type EPUBOptions struct { type EPUBOptions struct {

View File

@ -227,7 +227,7 @@ func (o Content) getSpineAuto() []tag {
) )
} }
} }
for i, img := range o.Images { for _, img := range o.Images {
if (img.DoublePage || img.Part == 1) && o.ImageOptions.Manga == isOnTheRight { if (img.DoublePage || img.Part == 1) && o.ImageOptions.Manga == isOnTheRight {
spine = append(spine, tag{ spine = append(spine, tag{
"itemref", "itemref",
@ -242,8 +242,6 @@ func (o Content) getSpineAuto() []tag {
tagAttrs{"idref": img.PageKey(), "properties": img.Position}, tagAttrs{"idref": img.PageKey(), "properties": img.Position},
"", "",
}) })
// save position, img is a value type
o.Images[i] = img
} }
if o.ImageOptions.Manga == isOnTheRight { if o.ImageOptions.Manga == isOnTheRight {
spine = append(spine, tag{ spine = append(spine, tag{