Fixed tap controls not working when zoomed in (#10378)
Co-authored-by: Paloys <Paloys@users.noreply.github.com>
This commit is contained in:
parent
02e50411de
commit
c65a9aecf5
@ -102,7 +102,14 @@ abstract class PagerViewer(val activity: ReaderActivity) : Viewer {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
pager.tapListener = { event ->
|
pager.tapListener = { event ->
|
||||||
val pos = PointF(event.x / pager.width, event.y / pager.height)
|
val viewPosition = IntArray(2)
|
||||||
|
pager.getLocationOnScreen(viewPosition)
|
||||||
|
val viewPositionRelativeToWindow = IntArray(2)
|
||||||
|
pager.getLocationInWindow(viewPositionRelativeToWindow)
|
||||||
|
val pos = PointF(
|
||||||
|
(event.rawX - viewPosition[0] + viewPositionRelativeToWindow[0]) / pager.width,
|
||||||
|
(event.rawY - viewPosition[1] + viewPositionRelativeToWindow[1]) / pager.height,
|
||||||
|
)
|
||||||
when (config.navigator.getAction(pos)) {
|
when (config.navigator.getAction(pos)) {
|
||||||
NavigationRegion.MENU -> activity.toggleMenu()
|
NavigationRegion.MENU -> activity.toggleMenu()
|
||||||
NavigationRegion.NEXT -> moveToNext()
|
NavigationRegion.NEXT -> moveToNext()
|
||||||
|
@ -111,7 +111,14 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
recycler.tapListener = { event ->
|
recycler.tapListener = { event ->
|
||||||
val pos = PointF(event.x / recycler.width, event.y / recycler.height)
|
val viewPosition = IntArray(2)
|
||||||
|
recycler.getLocationOnScreen(viewPosition)
|
||||||
|
val viewPositionRelativeToWindow = IntArray(2)
|
||||||
|
recycler.getLocationInWindow(viewPositionRelativeToWindow)
|
||||||
|
val pos = PointF(
|
||||||
|
(event.rawX - viewPosition[0] + viewPositionRelativeToWindow[0]) / recycler.width,
|
||||||
|
(event.rawY - viewPosition[1] + viewPositionRelativeToWindow[1]) / recycler.height,
|
||||||
|
)
|
||||||
when (config.navigator.getAction(pos)) {
|
when (config.navigator.getAction(pos)) {
|
||||||
NavigationRegion.MENU -> activity.toggleMenu()
|
NavigationRegion.MENU -> activity.toggleMenu()
|
||||||
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
|
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
|
||||||
|
Loading…
Reference in New Issue
Block a user