diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2024-05-07 16:09:18 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2024-05-07 20:05:27 +0200 |
| commit | 4d0963a7bfd6b7b7a45efe0e62d19130014c2a4b (patch) | |
| tree | b36b1485fa5eb7c999968493ccff0704b079a7c8 /src | |
| parent | 60690dba51a50c5ae3aef035b3b824f3646f2e3d (diff) | |
Improve arrow positions for 'oxy' scheme
- improve centering the different arrows
- fix one bug that prevented correct positioning
Diffstat (limited to 'src')
| -rw-r--r-- | src/fl_oxy.cxx | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/fl_oxy.cxx b/src/fl_oxy.cxx index 4e12f9bb1..5c3870d2b 100644 --- a/src/fl_oxy.cxx +++ b/src/fl_oxy.cxx @@ -53,14 +53,22 @@ static void single_arrow(Fl_Rect bb, Fl_Orientation o, Fl_Color col) { const int lw = 2; // arrow line width: n means n+1 pixels - if (o & 1) // up or down arrow - fl_translate(tx, ty - (lw+1)/2); + // define translation adjustments for easier maintenance + + static int tr_x = 0; + static int tr_y = -1; + + if (o == FL_ORIENT_LEFT) + tr_x = 2; + + if (o & 2) // up or down arrow + fl_translate(tx, ty - (lw+1)/2 + tr_y); else // left or right arrow - fl_translate(tx - lw/2 + 1, ty); + fl_translate(tx - lw/2 + tr_x, ty); fl_rotate(angle); - int x0 = -(dx)/2; + int x0 = (-dx)/2; fl_begin_complex_polygon(); @@ -104,7 +112,7 @@ void oxy_arrow(Fl_Rect bb, Fl_Arrow_Type t, Fl_Orientation o, Fl_Color col) { single_arrow(bb, o, col); break; default: - bb.x(bb.x() - 2); // shift left + bb.x(bb.x() - 1); // shift left bb.w(bb.w() - 4); // reduce size single_arrow(bb, o, col); bb.x(bb.x() + 4); // shift right @@ -115,7 +123,7 @@ void oxy_arrow(Fl_Rect bb, Fl_Arrow_Type t, Fl_Orientation o, Fl_Color col) { case FL_ARROW_CHOICE: - bb.y(bb.y() - 2); // shift upwards + // bb.y(bb.y() - 0); // don't shift upwards (was: -2) bb.h(bb.h() - 4); // reduce size single_arrow(bb, FL_ORIENT_UP, col); bb.y(bb.y() + 4); // shift down |
