[chronojump] CairoArrow have smaller tip if arrow is shorter than 2*tip



commit ca261230a044314e2834ffe39d311374b683cb42
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Aug 29 18:30:26 2021 +0200

    CairoArrow have smaller tip if arrow is shorter than 2*tip

 src/gui/cairo/generic.cs | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/gui/cairo/generic.cs b/src/gui/cairo/generic.cs
index 05b71a56d..c580c41c4 100644
--- a/src/gui/cairo/generic.cs
+++ b/src/gui/cairo/generic.cs
@@ -208,6 +208,9 @@ public abstract class CairoGeneric
                // 3) write arrow tip(s)
                int tip = 5;
                if(horiz) {
+                       if(Math.Abs(bx-ax) <= 2*tip)
+                               tip = 3;
+
                        g.LineTo(bx - tip, by - tip);
                        g.MoveTo(bx, by);
                        g.LineTo(bx - tip, by + tip);
@@ -218,6 +221,9 @@ public abstract class CairoGeneric
                                g.LineTo(ax + tip, ay + tip);
                        }
                } else {
+                       if(Math.Abs(by-ay) <= 2*tip)
+                               tip = 3;
+
                        g.LineTo(bx - tip, by + tip);
                        g.MoveTo(bx, by);
                        g.LineTo(bx + tip, by + tip);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]