Fixes to center margin option
This commit is contained in:
parent
7155b2be10
commit
d8c2baa135
@ -245,7 +245,9 @@ class PagerPageHolder(
|
||||
private fun mergePages(imageStream: InputStream, imageStream2: InputStream?): InputStream {
|
||||
// Handle adding a center margin to wide images if requested
|
||||
if (imageStream2 == null) {
|
||||
return if (imageStream is BufferedInputStream && ImageUtil.isWideImage(imageStream) &&
|
||||
return if (imageStream is BufferedInputStream &&
|
||||
!ImageUtil.isAnimatedAndSupported(imageStream) &&
|
||||
ImageUtil.isWideImage(imageStream) &&
|
||||
viewer.config.centerMarginType and PagerConfig.CenterMarginType.WIDE_PAGE_CENTER_MARGIN > 0 &&
|
||||
!viewer.config.imageCropBorders
|
||||
) {
|
||||
@ -327,7 +329,7 @@ class PagerPageHolder(
|
||||
imageStream2.close()
|
||||
|
||||
val centerMargin = if (viewer.config.centerMarginType and PagerConfig.CenterMarginType.DOUBLE_PAGE_CENTER_MARGIN > 0 && !viewer.config.imageCropBorders) {
|
||||
96 / (getHeight().coerceAtLeast(1) / max(height, height2).coerceAtLeast(1)).coerceAtLeast(1)
|
||||
96 / (this.height.coerceAtLeast(1) / max(height, height2).coerceAtLeast(1)).coerceAtLeast(1)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ object ImageUtil {
|
||||
val height = imageBitmap.height
|
||||
val width = imageBitmap.width
|
||||
|
||||
val centerPadding = 96 / (max(1, viewHeight) / height)
|
||||
val centerPadding = 96 / (max(1, viewHeight) / height).coerceAtLeast(1)
|
||||
|
||||
val leftSourcePart = Rect(0, 0, width / 2, height)
|
||||
val rightSourcePart = Rect(width / 2, 0, width, height)
|
||||
|
Loading…
x
Reference in New Issue
Block a user