File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
balloon/src/main/kotlin/com/skydoves/balloon Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -1827,16 +1827,31 @@ public class Balloon private constructor(
18271827 )
18281828 }
18291829
1830+ /* * remembers the last pressed action event to pass it after move the touch-up points. */
1831+ private var passedEventActionDownEvent: Pair <MotionEvent , Boolean >? = null
1832+
18301833 private fun passTouchEventToAnchor (anchor : View ) {
18311834 if (! this .builder.passTouchEventToAnchor) return
18321835 setOnBalloonOverlayTouchListener { view, event ->
18331836 view.performClick()
18341837 val rect = Rect ()
18351838 anchor.getGlobalVisibleRect(rect)
1836- if (event.action == MotionEvent .ACTION_UP || event.action == MotionEvent .ACTION_MOVE ) {
1837- anchor.rootView.dispatchTouchEvent(event)
1839+
1840+ if (event.action == MotionEvent .ACTION_DOWN ) {
1841+ passedEventActionDownEvent = event to rect.contains(
1842+ event.rawX.toInt(),
1843+ event.rawY.toInt(),
1844+ )
1845+ }
1846+
1847+ val passedEventActionDownEvents = passedEventActionDownEvent?.first
1848+ val passedEventActionDownInvokable = passedEventActionDownEvent?.second ? : false
1849+
1850+ if (passedEventActionDownInvokable && (event.action == MotionEvent .ACTION_UP )
1851+ ) {
1852+ anchor.rootView.dispatchTouchEvent(passedEventActionDownEvents!! )
18381853 true
1839- } else if (rect.contains(event.rawX.toInt(), event.rawY.toInt()) ) {
1854+ } else if (passedEventActionDownInvokable ) {
18401855 anchor.rootView.dispatchTouchEvent(event)
18411856 true
18421857 } else {
You can’t perform that action at this time.
0 commit comments