SwiftUI-Tooltip icon indicating copy to clipboard operation
SwiftUI-Tooltip copied to clipboard

Arrow position relative to the bubble is always center

Open sukie2 opened this issue 4 years ago • 2 comments
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.

sukie2 avatar Aug 30 '21 06:08 sukie2

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: .bottom and offset: 0 would position the arrow on top center.
  • Setting side: .bottom and offset: PI/4 would position the arrow on top-right corner.
  • Setting side: .bottom and offset: -PI/4 would position the arrow on tol-left corner.
  • Setting side: .bottom and offset: PI/8 would position the arrow exactly between the top-center and top-right corner.
  • Setting side: .top and offset: PI/2 would position the arrow end point at the top of the content, but the arrow would be at the top side of the tooltip.

bring-shrubbery avatar Mar 21 '22 08:03 bring-shrubbery

I'd be very happy to review a PR for this implementation :)

bring-shrubbery avatar Mar 21 '22 08:03 bring-shrubbery

Closed due to inactivity

bring-shrubbery avatar Aug 28 '22 15:08 bring-shrubbery