Recreate webtoon SSIV when crop borders setting changes (fixes #4734)

This commit is contained in:
arkon 2021-03-30 18:47:44 -04:00
parent 4054f2a6a0
commit 407e798fdb

View File

@ -66,6 +66,7 @@ class WebtoonPageHolder(
* Image view that supports subsampling on zoom. * Image view that supports subsampling on zoom.
*/ */
private var subsamplingImageView: SubsamplingScaleImageView? = null private var subsamplingImageView: SubsamplingScaleImageView? = null
private var cropBorders: Boolean = false
/** /**
* Simple image view only used on GIFs. * Simple image view only used on GIFs.
@ -360,17 +361,20 @@ class WebtoonPageHolder(
* Initializes a subsampling scale view. * Initializes a subsampling scale view.
*/ */
private fun initSubsamplingImageView(): SubsamplingScaleImageView { private fun initSubsamplingImageView(): SubsamplingScaleImageView {
if (subsamplingImageView != null) return subsamplingImageView!!
val config = viewer.config val config = viewer.config
if (subsamplingImageView != null && config.imageCropBorders == cropBorders) {
return subsamplingImageView!!
}
cropBorders = config.imageCropBorders
subsamplingImageView = WebtoonSubsamplingImageView(context).apply { subsamplingImageView = WebtoonSubsamplingImageView(context).apply {
setMaxTileSize(viewer.activity.maxBitmapSize) setMaxTileSize(viewer.activity.maxBitmapSize)
setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE) setPanLimit(SubsamplingScaleImageView.PAN_LIMIT_INSIDE)
setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_FIT_WIDTH) setMinimumScaleType(SubsamplingScaleImageView.SCALE_TYPE_FIT_WIDTH)
setMinimumDpi(90) setMinimumDpi(90)
setMinimumTileDpi(180) setMinimumTileDpi(180)
setCropBorders(config.imageCropBorders) setCropBorders(cropBorders)
setOnImageEventListener( setOnImageEventListener(
object : SubsamplingScaleImageView.DefaultOnImageEventListener() { object : SubsamplingScaleImageView.DefaultOnImageEventListener() {
override fun onReady() { override fun onReady() {