I am creating a tooltip system that shows a tooltip when the mouse is hovered over a specific frame. The tooltip is automatically being resized based on the text, using this code:
This is because the text has it’s position or scale set in scale. You can fix this for both by setting the position and the anchor point property of the text labels to 0,0. To add some seperation between the two you can use UIPadding with offsets.
AnchorPoint just changes where the center (or the “position offset”) of the Frame will be, always starting out at 0,0 (which is the Top Left Corner), so that wouldn’t do much.
If you are referring to the size of the frame (The Text Frame), then a solution would be to use a hybrid of Scale, and Offset sizing. So rather than a fixed size in pixels, or a percentage of space taken at a time. you can give it the scale portion a value of (1, 1), which would cover 100% of the parent Frame. Then set the Offset portion to be something like (-5, 0) or (-5, -5) to maintain a “indent” of the text.
You can then use AnchorPoint to center the Frame to the center of the parent Frame, using scale position (0.5, 0.5)
What this will do is always have a 5 pixel offset from the parent Frame no matter the size due to the scale sizing.