https://kotlinlang.org logo
Title
v

Vadim Kapustin

11/12/2020, 11:51 AM
How to show hint text over Icon? I try to place Text() in one Box() with Icon() when mouse pointer enter in Icon. The text is shown on top of the icon, but the problem is that the box changes its size and changes the position of neighboring elements. My code:
@Composable
fun IconWithHint(
    asset: ImageAsset,
    modifier: Modifier = Modifier,
    tint: Color = AmbientContentColor.current,
    hint: @Composable() () -> Unit
) {
    val entered = remember { mutableStateOf(false) }
    Box {
        Icon(asset,
            modifier.pointerMoveFilter(
                onEnter = {
                    entered.value = true
                    false
                },
                onExit = {
                    entered.value = false
                    false
                }
            ),
            tint
        )
        if (entered.value) hint()
    }
}
g

gildor

11/13/2020, 7:12 AM
Probably #compose is better place to ask
v

Vadim Kapustin

11/13/2020, 11:32 AM
I try to play with Popup(). Small problem is that it intercepts mouse messages on itself. I got an acceptable results by adding timers, filtering move messages, and forcibly disabling popups after a certain time
g

Greg Steckman

11/15/2020, 10:14 PM
Can someone point me to documentation on pointerMoveFilter? I have seen examples, but the IDE/Compiler isn't finding it, and I cannot find it in the API documentation under androidx.compose.ui.gesture. Using version 0.1.0-m1.build62.
v

Vadim Kapustin

11/16/2020, 8:22 AM
I'm use version 0.1.0-build113. pointerMoveFilter is in androidx.compose.ui.input.pointer
g

Greg Steckman

11/17/2020, 1:44 AM
ok so it is in build62 as well - I figured out that I was trying to use it from common code instead of JVM. No sign of it in the online API documentation (https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary) however, assuming because this is a new API. Are there any online API docs tracking the milestone releases?