Alexander Maryanovsky
12/12/2022, 5:21 PMAlexander Maryanovsky
12/12/2022, 5:24 PMCasey Brooks
12/12/2022, 5:54 PMTooltipArea allows you to customize the placement of the tooltip, with the default being CursorPoint. From a quick glance as its source, CursorPoint doesn’t really care about the bounds of the parent Box and just places the popup at the cursor’s location. But you could use ComponentRect to place it relative to the TooltipArea’s Box, or you could write your own implementation to place the tooltip anywhere on the screen you’d likeAlexander Maryanovsky
12/12/2022, 5:56 PMAlexander Maryanovsky
12/12/2022, 6:00 PMCasey Brooks
12/12/2022, 6:04 PMTooltipArea is essentially 2 things: A Modifier that watches for the cursor position to determine when to show the popup, and then a Popup Composable to actually display your content.
Modifiers don’t create new UI elements, which is why it needs that separate Popup to display the content. But you might be able to hack something together with Modifier.drawWithContent { } and the other modifiers taken from the TooltipArea’s original source (it’s pretty minimal, shouldn’t be too difficult to copy it all over to your project). But note that the default Canvas doesn’t have any way to draw text, but I think you can drop down to the native Skiko canvas to add text to the Modifier.drawWithContent canvas