Hello! I’m having trouble positioning a “pointer” frame correctly on the edges of its parent frame.
- When the pointer’s anchor point is at (0, 0) and I set the X position to 0, it works fine.
- However, when I set the X position to 1, the pointer goes out of bounds.
- Changing the anchor point to (1, 0) causes the opposite issue, and (0.5, 0) doesn’t place the pointer on either edge.
Setting the parent’s AutomaticSize to X stretches the parent, which isn’t what I want. (I mean this should’ve been obvious but I still tried)
https://gyazo.com/cf38482eb2594a4d01f57d54e13a4dd5
Can anyone help with a solution to fix this?
You have to adjust both the anchor point and the position. For example:
At 50%:
AnchorPoint → 0.5, 0
Position → 0.5, 0, 0, 0
At 75%:
AnchorPoint → 0.75, 0
Position → 0.75, 0, 0, 0
At 100%:
AnchorPoint → 1, 0
Position → 1, 0, 0, 0
Alternatively, you can create a frame that is exactly a width less than the gradient frame, and parent the white pointer to the new frame with an anchor point of 0, 0
.
The green frame is the adjusted box, black is the pointer. Notice how the adjusted box is smaller than the gradient box by exactly the width of the pointer:
This way you don’t need to adjust the anchor point, although the pointer may be inaccurate in some cases.