How to show hint text over Icon? I try to place Te...
# compose-desktop
v
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:
Copy 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
Probably #compose is better place to ask
v
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
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
I'm use version 0.1.0-build113. pointerMoveFilter is in androidx.compose.ui.input.pointer
g
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?