From 617891bda45986a15d30d1dc97ba79bd84395f9a Mon Sep 17 00:00:00 2001 From: Ivan Matkov Date: Mon, 12 Feb 2024 16:21:05 +0100 Subject: [PATCH] Address feedback --- .../compose/foundation/gestures/MouseWheelScrollable.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/MouseWheelScrollable.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/MouseWheelScrollable.kt index 75dfa18d5c0f9..6f7bbbe00e1e2 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/MouseWheelScrollable.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/MouseWheelScrollable.kt @@ -37,9 +37,9 @@ import androidx.compose.ui.unit.Density import androidx.compose.ui.unit.dp import androidx.compose.ui.util.fastAny import androidx.compose.ui.util.fastForEach +import kotlin.coroutines.coroutineContext import kotlin.math.abs import kotlin.math.roundToInt -import kotlinx.coroutines.CancellationException import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.isActive @@ -259,7 +259,7 @@ private class AnimatedMouseWheelScrollPhysics( var requiredAnimation = true var lastValue = 0f val anim = AnimationState(0f) - while (requiredAnimation && coroutineScope.isActive) { + while (requiredAnimation && coroutineContext.isActive) { requiredAnimation = false val durationMillis = (abs(target - anim.value) / speed) .roundToInt()