-
-
Save andreymusth/f7d7299a23ef57d7f4013794fbdc35ea to your computer and use it in GitHub Desktop.
pointer input hit test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun hitTest( | |
pointerPosition: Offset, | |
hitPointerInputFilters: MutableList<PointerInputFilter> | |
) { | |
if (isPointerInBounds(pointerPosition) && withinLayerBounds(pointerPosition)) { | |
// If the pointer is in bounds, we hit the pointer input filter, so add it! | |
hitPointerInputFilters.add(modifier.pointerInputFilter) | |
// Also, keep looking to see if we also might hit any children. | |
// This avoids checking layer bounds twice as when we call super.hitTest() | |
val positionInWrapped = wrapped.fromParentPosition(pointerPosition) | |
wrapped.hitTest(positionInWrapped, hitPointerInputFilters) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment