diff --git a/ShareX.ScreenCaptureLib/Shapes/Drawing/SpeechBalloonDrawingShape.cs b/ShareX.ScreenCaptureLib/Shapes/Drawing/SpeechBalloonDrawingShape.cs index 5d67c6afd..c24b6906a 100644 --- a/ShareX.ScreenCaptureLib/Shapes/Drawing/SpeechBalloonDrawingShape.cs +++ b/ShareX.ScreenCaptureLib/Shapes/Drawing/SpeechBalloonDrawingShape.cs @@ -24,6 +24,7 @@ #endregion License Information (GPL v3) using ShareX.HelpersLib; +using System; using System.Drawing; using System.Drawing.Drawing2D; @@ -33,7 +34,8 @@ public class SpeechBalloonDrawingShape : TextDrawingShape { public override ShapeType ShapeType { get; } = ShapeType.DrawingSpeechBalloon; - public int TailWidth { get; } = 40; + // If rectangle average size is 100px then tail width will be 30px + public float TailWidthMultiplier { get; } = 0.3f; internal ResizeNode TailNode => Manager.ResizeNodes[(int)NodePosition.Extra]; @@ -60,7 +62,7 @@ public override void OnDraw(Graphics g) if (!Rectangle.Contains(TailNode.Position)) { - gpTail = CreateTailPath(TailWidth); + gpTail = CreateTailPath(); } if (FillColor.A > 0) @@ -131,10 +133,13 @@ public override void OnDraw(Graphics g) } } - protected GraphicsPath CreateTailPath(int tailWidth) + protected GraphicsPath CreateTailPath() { GraphicsPath gpTail = new GraphicsPath(); Point center = Rectangle.Center(); + int rectAverageSize = (Rectangle.Width + Rectangle.Height) / 2; + int tailWidth = (int)(TailWidthMultiplier * rectAverageSize); + tailWidth = Math.Min(Math.Min(tailWidth, Rectangle.Width), Rectangle.Height); int tailOrigin = tailWidth / 2; int tailLength = (int)MathHelpers.Distance(center, TailNode.Position); gpTail.AddLine(0, -tailOrigin, 0, tailOrigin);