Kebbin
11/08/2021, 10:25 AMIgor Demin
11/08/2021, 12:49 PMKebbin
11/09/2021, 7:21 AMKebbin
11/09/2021, 7:23 AMIgor Demin
11/09/2021, 7:31 AMdo we as developers find out about them?The application won't compile, if API is used directly (to fix that, the developer of the application would just change the code) Or crashes in runtime with
MethodNotFoundException
, if API is used in some library that depends on the older Compose (the developer of the library should release a new version of it).
P.S.
Between Compose 1.0 and 2.0 there will be no breaking changes for non-experimental API. All we can do - is to mark some old API as Deprecated (if we introduce a better API)Kebbin
11/09/2021, 7:32 AMmcpiroman
11/09/2021, 9:14 AMKebbin
11/09/2021, 10:04 AMKebbin
11/11/2021, 9:27 AMonMouseScroll
code.
I've managed to get the mouseScrollFilter
coded in.
I just have an application, and Columns and a Box.
Can you give me a hint?
Thanks!Igor Demin
11/11/2021, 9:47 AMimport androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.size
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.input.mouse.mouseScrollFilter
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.singleWindowApplication
@OptIn(ExperimentalComposeUiApi::class)
fun main() = singleWindowApplication {
Box(
Modifier
.size(200.dp)
.background(Color.Red)
.mouseScrollFilter { event, _ ->
println(event.delta)
true
}
)
}
Kebbin
11/11/2021, 9:51 AMKebbin
11/11/2021, 9:55 AMKebbin
11/11/2021, 11:40 AMevent.delta
MouseScrollUnit
is a custom type?
I added .toString() == "Line(value=-3.0"
, but is there a better way to detect forward and backward scrolling using the MouseScrollUnit directly somehow?
Thanks for your help tonight! I've really made some progress. πIgor Demin
11/11/2021, 11:43 AMKebbin
11/11/2021, 11:44 AMKebbin
11/11/2021, 12:53 PM.Line
or .Page
values, so that we know if the wheel has been rolled forward or backward?
There was listed in the sample code, lines like MouseScrollUnit.Line/Page(1f,-1f,3f,-3f)
.
Can we test that somehow?
Thanks again.Igor Demin
11/11/2021, 12:59 PMtest
? Just retrieve delta
, as described here, and check it with if
, or apply sign
function.Kebbin
11/11/2021, 1:07 PMif
was what I've done here. I'll look into the sign
function hint. Thank you!Kebbin
11/12/2021, 2:11 AMvar zoomDir = sign((event.delta as MouseScrollUnit.Line).value)
Thank you so much @Igor Demin for your patience and knowledge!
Cheers!