mirror of
https://github.com/gedoor/legado.git
synced 2025-01-09 04:17:45 +08:00
当图片格式设置为single时,图片居中显示。 (#4482)
This commit is contained in:
parent
8885ac4a83
commit
21d689ef2f
@ -393,6 +393,18 @@ object ChapterProvider {
|
|||||||
}
|
}
|
||||||
durY = 0f
|
durY = 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 图片居中:调整 X 坐标
|
||||||
|
if (width < visibleWidth) {
|
||||||
|
val adjustWidth = (visibleWidth - width) / 2f
|
||||||
|
absStartX += adjustWidth.toInt() // 将起始 X 坐标移至居中位置
|
||||||
|
}
|
||||||
|
|
||||||
|
// 图片竖直方向居中:调整 Y 坐标
|
||||||
|
if (height < visibleHeight) {
|
||||||
|
val adjustHeight = (visibleHeight - height) / 2f
|
||||||
|
durY = adjustHeight // 将 Y 坐标设置为居中位置
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
@ -361,6 +361,18 @@ class TextChapterLayout(
|
|||||||
pendingTextPage = TextPage()
|
pendingTextPage = TextPage()
|
||||||
durY = 0f
|
durY = 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 图片居中:调整 X 坐标
|
||||||
|
if (width < visibleWidth) {
|
||||||
|
val adjustWidth = (visibleWidth - width) / 2f
|
||||||
|
absStartX += adjustWidth.toInt() // 将起始 X 坐标移至居中位置
|
||||||
|
}
|
||||||
|
|
||||||
|
// 图片竖直方向居中:调整 Y 坐标
|
||||||
|
if (height < visibleHeight) {
|
||||||
|
val adjustHeight = (visibleHeight - height) / 2f
|
||||||
|
durY = adjustHeight // 将 Y 坐标设置为居中位置
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user