I tried to experiment with mouse scroll events fol...
# compose-desktop
m
I tried to experiment with mouse scroll events following this tutorial from JetBrains: https://github.com/JetBrains/compose-jb/blob/master/tutorials/Mouse_Events/README.md#mouse-events But when I build the project all I get is this:
e: …/CmpMapPane.kt: (132, 55): This API is experimental and is likely to change in the future.
How can I get rid of that and get my code compiled. I’ve added
@OptIn(ExperimentalFoundationApi::class)
to the composable function on which I use the pointerInput modifier but IntelliJ is only telling me
The opt-in annotation is redundant: no matching experimental API is used.
s
In your build.gradle.kts for the project add:
Copy code
tasks.withType<KotlinCompile> {
        kotlinOptions {
            freeCompilerArgs = freeCompilerArgs + arrayOf(
                "-Xopt-in=<whatever the package is here>.ExperimentalFoundationApi"
            )
        }
    }
🙏 1
m
According to: https://kotlinlang.org/docs/opt-in-requirements.html#require-opt-in-for-api I fixed the problem by adding
Copy code
all {
    languageSettings.optIn("androidx.compose.ui.ExperimentalComposeUiApi")
}
to the sourceSets. The real problem was that I picked the wrong optIn because they are using different ones in the examples. The code compiles and runs now but mouse wheel scrolling still does not seem to work. The reported value is always zero.
s
👍