mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 18:08:24 +01:00
parent
97b4d1f13d
commit
90d3dd2242
@ -41,13 +41,13 @@ open class GestureDetectorWithLongTap(
|
||||
// This is the key difference with the built-in detector. We have to ignore the
|
||||
// event if the last up and current down are too close in time (double tap).
|
||||
if (ev.downTime - lastUp > doubleTapTime) {
|
||||
downX = ev.rawX
|
||||
downY = ev.rawY
|
||||
downX = ev.x
|
||||
downY = ev.y
|
||||
handler.postDelayed(longTapFn, longTapTime)
|
||||
}
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
if (abs(ev.rawX - downX) > slop || abs(ev.rawY - downY) > slop) {
|
||||
if (abs(ev.x - downX) > slop || abs(ev.y - downY) > slop) {
|
||||
handler.removeCallbacks(longTapFn)
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : Viewer {
|
||||
},
|
||||
)
|
||||
pager.tapListener = { event ->
|
||||
val pos = PointF(event.rawX / pager.width, event.rawY / pager.height)
|
||||
val pos = PointF(event.x / pager.width, event.y / pager.height)
|
||||
when (config.navigator.getAction(pos)) {
|
||||
NavigationRegion.MENU -> activity.toggleMenu()
|
||||
NavigationRegion.NEXT -> moveToNext()
|
||||
|
@ -111,7 +111,7 @@ class WebtoonViewer(val activity: ReaderActivity, val isContinuous: Boolean = tr
|
||||
},
|
||||
)
|
||||
recycler.tapListener = { event ->
|
||||
val pos = PointF(event.rawX / recycler.width, event.rawY / recycler.height)
|
||||
val pos = PointF(event.x / recycler.width, event.y / recycler.height)
|
||||
when (config.navigator.getAction(pos)) {
|
||||
NavigationRegion.MENU -> activity.toggleMenu()
|
||||
NavigationRegion.NEXT, NavigationRegion.RIGHT -> scrollDown()
|
||||
|
Loading…
Reference in New Issue
Block a user