diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-05-19 21:19:17 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-05-19 21:19:17 +0200 |
commit | b669f825944b8f487e9cadd15dff59fcfad6cfe5 (patch) | |
tree | a22679adcfbd896783f2c826f7637f65f0175ab9 | |
parent | 9e6e11a5d43ae677de6c092e7ba998199807893b (diff) |
don't show labels of hills not on image
-rw-r--r-- | src/GipfelWidget.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index ca7d7f8..19be5ae 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -245,6 +245,9 @@ GipfelWidget::draw() { known_hills->contains(m) || m == focused_mountain) continue; + if (fabs(m->x) > img->w() / 2 || fabs(m->y) > img->h() / 2) + continue; + fl_xyline(m_x - CROSS_SIZE, m_y, m_x + CROSS_SIZE); fl_yxline(m_x, m_y + m->label_y - height, m_y + CROSS_SIZE); fl_xyline(m_x, m_y + m->label_y - height, m_x + m->label_x); @@ -259,6 +262,9 @@ GipfelWidget::draw() { (!show_hidden && (m->flags & Hill::HIDDEN)) || m == focused_mountain) continue; + if (fabs(m->x) > img->w() / 2 || fabs(m->y) > img->h() / 2) + continue; + if (known_hills->contains(m)) { if (known_hills->get_num() > 3) fl_color(FL_GREEN); @@ -348,6 +354,9 @@ GipfelWidget::set_labels(Hills *v) { if (!show_hidden && (m->flags & Hill::HIDDEN)) continue; + if (fabs(m->x) > img->w() / 2 || fabs(m->y) > img->h() / 2) + continue; + m->label_x = (int) fl_width(m->name) + 1; m->label_y = 0; @@ -360,6 +369,9 @@ GipfelWidget::set_labels(Hills *v) { if (!show_hidden && (n->flags & Hill::HIDDEN)) continue; + if (fabs(m->x) > img->w() / 2 || fabs(m->y) > img->h() / 2) + continue; + if (overlap(m->x, m->label_x, n->x - CROSS_SIZE, n->label_x)) colliding.add(n); else |