From 1e4c6ea7040530129063de87436c9c7efe8a7731 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sat, 22 Oct 2005 19:26:49 +0200 Subject: make label_x and label_y relative to x and y --- src/GipfelWidget.cxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index be1dbcb..04ab21f 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -318,11 +318,11 @@ GipfelWidget::draw() { } fl_xyline(center_x + m->x + x() - 2, center_y + m->y + y(), center_x + m->x + x() + 2); - fl_yxline(center_x + m->x + x(), center_y + m->label_y + y() - 2, center_y + m->y + y() + 2); + fl_yxline(center_x + m->x + x(), center_y + m->y + m->label_y + y() - 2, center_y + m->y + y() + 2); fl_draw(m->name, center_x + m->x + x(), - center_y + m->label_y + y()); + center_y + m->y + m->label_y + y()); } /* markers */ @@ -380,8 +380,8 @@ GipfelWidget::set_labels(Hills *v) { } width = (int) ceilf(fl_width(m->name)); - m->label_x = m->x + width; - m->label_y = m->y; + m->label_x = width; + m->label_y = 0; for (j=0; j < i; j++) { n = v->get(j); @@ -391,11 +391,11 @@ GipfelWidget::set_labels(Hills *v) { // Check for overlapping labels and // overlaps between labels and peak markers - if ((overlap(m->x, m->label_x, n->x, n->label_x) && - overlap(m->label_y - height, m->label_y, n->label_y - height, n->label_y)) || - (overlap(m->x, m->label_x, n->x - 2, n->x + 2) && - overlap(m->label_y - height, m->label_y, n->y - 2, n->y + 2))) { - m->label_y = n->label_y - height - 1; + if ((overlap(m->x, m->x + m->label_x, n->x, n->x + n->label_x) && + overlap(m->y + m->label_y - height, m->y + m->label_y, n->y + n->label_y - height, n->y + n->label_y)) || + (overlap(m->x, m->x + m->label_x, n->x - 2, n->x + 2) && + overlap(m->y + m->label_y - height, m->y + m->label_y, n->y - 2, n->y + 2))) { + m->label_y = n->y + n->label_y - m->y - height - 1; } } } @@ -464,7 +464,7 @@ GipfelWidget::set_mountain(int m_x, int m_y) { cur_mountain->x = m_x - center_x; cur_mountain->y = m_y - center_y; - cur_mountain->label_y = cur_mountain->y; + cur_mountain->label_y = 0; redraw(); return 0; -- cgit v1.2.3