SwiftUI-Tooltip
SwiftUI-Tooltip copied to clipboard
Arrow position relative to the bubble is always center
trafficstars
Arrow is always centred in the tooltip view. How to position it in the top-right corner? If the side is set to bottom.
Hey @sukie2, if you set the side: .bottom then the arrow will always be centered, the functionality for offsetting the arrow is not present yet. The perfect solution in my opinion would be to have an offset: Angle(radians: _) parameter, which would allow setting the arrow position to any place you want (depending on the tooltip position of course).
For example:
- Setting
side: .bottomandoffset: 0would position the arrow on top center. - Setting
side: .bottomandoffset: PI/4would position the arrow on top-right corner. - Setting
side: .bottomandoffset: -PI/4would position the arrow on tol-left corner. - Setting
side: .bottomandoffset: PI/8would position the arrow exactly between the top-center and top-right corner. - Setting
side: .topandoffset: PI/2would position the arrow end point at the top of the content, but the arrow would be at the top side of the tooltip.
I'd be very happy to review a PR for this implementation :)
Closed due to inactivity