Aaron Yoder
04/17/2021, 8:12 PMandroidx.compose.ui.input.mouse.MouseScrollEvent
and MouseScrollUnit
: I am using a mouseScrollFilter
and am wanting to perform some mathematical operations using the delta
(for zoom on scroll), but I can't seem to figure out how to get the actual value from the delta
, there's no accessors or anything for the raw Float value. I understand there's the line/page scroll values but those don't seem accessible either, so not sure if I'm just thinking about this incorrectly.Igor Demin
04/18/2021, 11:09 AMthere's no accessors or anything for the raw Float valueUsually there is no raw Float value (most of the mousses has discrete scroll; except maybe Magic mouse / touchpads)
there's no accessors or anything for the raw Float valueMouseScrollUnit is a sealed class, so you have to check every possible subclass:
val zoomLevel += when (event.delta) {
is MouseScrollUnit.Line -> value
is MouseScrollUnit.Page -> value
}
val zoom = zoomLevelToZoomn(zoomLevel)
Aaron Yoder
04/21/2021, 10:59 AM