From b669f825944b8f487e9cadd15dff59fcfad6cfe5 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 19 May 2009 21:19:17 +0200 Subject: don't show labels of hills not on image --- src/GipfelWidget.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 -- cgit v1.2.3