Marcin Wisniowski
09/17/2024, 9:18 PMonGloballyPositioned returns, but I need it before it's placed. I tried SubcomposeLayout, but it only allows me to measure the content itself on the spot, not where it would be drawn. How do I get the "current" global position in my Composable?Alex Vanyo
09/17/2024, 9:33 PMcoordinates available, but then that means the child’s measurement can’t influence the size of the parent (but its intrinsic size can, and that might be enough)Marcin Wisniowski
09/17/2024, 9:37 PMMarcin Wisniowski
09/17/2024, 9:53 PMPlacementScope.coordinates does allow me to get the info before choosing where to display it, but I don't have the ability to change what is displayed. I need to display the tooltip's anchor point triangle on the left or right of it depending on the outcome.Marcin Wisniowski
09/17/2024, 9:56 PMLayout and then only display one of the two placeables. But that feels a bit hacky.Alex Vanyo
09/17/2024, 9:57 PMPlacementScope.coordinates and doing the drawing logic after that.
Otherwise, if it has to be choosing between two different @Composable s based on the side, then passing both versions and only placing one is probably your best bet.Marcin Wisniowski
09/17/2024, 11:02 PMPopup threw a wrench into this, since I can't control the Popup position from a custom layout, it does it's own thing ignoring where I place(x, y) it.Alex Vanyo
09/17/2024, 11:05 PMPopup specifically there’s a PopupPositionProvider which is involvedMarcin Wisniowski
09/17/2024, 11:07 PMPopupPositionProvider alone, but then I'm back to being unable to control which anchor triangle image I display and where.Alex Vanyo
09/17/2024, 11:41 PMPopupPositionProvider.calculatePosition is called, maybe you could try a custom one to know where it will be put, and update some state based on that and see if that works?Marcin Wisniowski
09/18/2024, 12:02 AMPopupPositionProvider that in addition to the popup position also sets some state to control the anchor triangle type and position.
The issue with this approach is that I only have that state set on the second frame, and the triangle image shows up 1 frame delayed after the actual popup which is noticeable. I solved that by setting the alpha to 0 on the popup until I have the anchor info so they appear together on the second frame.