bensonarafat / super_tooltip

SuperTooltip It is super flexible and allows you to display ToolTips in the overlay of the screen.
https://pub.dev/packages/super_tooltip
MIT License
141 stars 95 forks source link

Feature to add curve with custom radius to the arrow tip #119

Closed ak424 closed 1 month ago

ak424 commented 2 months ago

Currently, the arrow tip have a sharp point (V). This feature is added to give the functionality to give a curve at the tip with a custom radius which can be given explicitly

Screenshot 2024-09-03 at 4 45 30 PM

In all the directions, right now the arrow is formed by joining two straight lines. In this PR, i have added an arc between two straight lines to form a curve with a custom radius. As shown in the diagram, i have taken an arc of a small circle with center (0,0), radius R and an angle of 90°. So, the points on the circle between arc is created will be (-R Sin 45°, R Cos 45°) and (R Sin 45°, R Cos 45°). And Cos45° and Sin 45° value is 1/√ 2. So the exact point of the start of the curve would be (target.dx - R/√ 2 , target.dy + arrow_tip_length - (R - R/√ 2)). As the distance of the start position on y axis will be -> target.dy + arrow_tip_length - (R - R Cos45°) . Hence, i have created a straight line first upto this point , then added a curve to the point (target.dx + R/√ 2 , target.dy + arrow_tip_length - (R - R/√ 2)) with radius R. Then a straight line as before to the point on the rectangle. Similarly, I have added this in all the directions with proper points and angles. Default value arrowTipRadius(R) is set to be 0 which will give a sharp tip as before since there will be no arc in that case. Then developer can give custom arrowTipRadius for the curve.

bensonarafat commented 2 months ago

thanks @ak424 I will review this. thanks for your contribution

ak424 commented 1 month ago

Hi @bensonarafat, just a friendly reminder to review the PR when you have a moment. Thanks!