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.
i
Igor Demin
04/18/2021, 11:09 AM
there's no accessors or anything for the raw Float value
Usually 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 value
MouseScrollUnit is a sealed class, so you have to check every possible subclass:
Copy code
val zoomLevel += when (event.delta) {
is MouseScrollUnit.Line -> value
is MouseScrollUnit.Page -> value
}
val zoom = zoomLevelToZoomn(zoomLevel)