David W
11/30/2021, 10:30 PMcombinedClickable
and mouseClickable
are mutually exclusive, but have non-overlapping functionality.
Is there a built-in way to handle both double-clicks and right-clicks on an item?combinedClickable
lets me add a double-click handler, and mouseClickable
lets me add a right-click handler, but I cannot use both at once.
I'd like to avoid home-rolling a double-click detector, if possible...Kirill Grouchnikov
11/30/2021, 10:47 PMDavid W
11/30/2021, 10:51 PMmouseClickable
doesn't have a double-click handler, which feels like an oversight or something unfinished.PointerInputScope.detectTapWithContext
is internal
, whereas PointerInputScope.detectTapGestures
is public
Kebbin
12/01/2021, 1:53 AMModifier
.pointerInput(Unit) {
forEachGesture {
awaitPointerEventScope {
awaitFirstDown()
do {
val event = awaitPointerEvent()
// detect mouse buttons and keyboard modifiers here:
// event.buttons.xxxx
// event.keyboard.Modifiers.xxxx
// event.*** :-D
} while (event.changes.any { it.pressed })
}
}
}
David W
12/01/2021, 2:02 AMPointerInputScope.detectTapGestures
to add double-click detection and hopefully this will be added to the easy-to-use APIs in the future.