orangy08/08/2022, 11:39 AM
with some url annotations, and I’m struggling to make it working properly with hover interactions. I want (like in a browser) to highlight links when they are hovered, and change pointer icon to hand. It causes infinite recomposition because when I handle enter/move pointer event, the
is changed (to highlight hovered part of the text with url), which causes recomposition of
, and then
(because input changed, particularly span styles), which causes remembered mutable state to be modified, which triggers more changes and causes recomposition again, ad infinum. Also, it seems recomposition causes synthentic
to be sent, which causes un-hover path to be triggered. I just can’t find how to get it all together. Any ideas, maybe?
Alexander Maryanovsky08/08/2022, 2:53 PM
here doesn’t cause recomposition, because it’s only read in
orangy08/09/2022, 6:04 PM
.then(if (hoverRange != null) Modifier.pointerHoverIcon(PointerIconDefaults.Hand, overrideDescendants = true) else Modifier)
I was using no modifier in case of not hovered because text may or may not be wrapped into SelectionContainer, and thus no-hover cursor would be different… Now I wonder why is that.
.pointerHoverIcon(if (hoverRange != null) PointerIconDefaults.Hand else PointerIconDefaults.Default, overrideDescendants = true)
click is not working, because it is probably intercepted by selection handling code
Alexander Maryanovsky08/10/2022, 10:25 AM