Skip to content

Commit

Permalink
FIX: help text link's clickable area not correctly set
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@3087 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
Knightly committed Feb 8, 2010
1 parent 037c39f commit a66ed88
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
12 changes: 6 additions & 6 deletions gui/components/gui_flowtext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@ koord gui_flowtext_t::output(koord offset, bool doit)
break;

case ATT_A_END:
link->br.x = xpos;
link->br.y = ypos + 14;
link->br.x = xpos - 4;
link->br.y = ypos + LINESPACE;

if (link->br.x < link->tl.x) {
link->tl.x = 0;
link->tl.y = link->br.y - 14;
link->tl.y = ypos;
}

if (doit) {
display_fillbox_wh_clip(link->tl.x + offset.x, link->tl.y + offset.y + 10, link->br.x - link->tl.x - 4, 1, color, false);
display_fillbox_wh_clip(link->tl.x + offset.x, link->tl.y + offset.y + 10, link->br.x - link->tl.x, 1, color, false);
}

++link;
Expand Down Expand Up @@ -290,8 +290,8 @@ void gui_flowtext_t::infowin_event(const event_t* ev)
if (IS_LEFTCLICK(ev)) {
// scan links for hit
for (slist_tpl<hyperlink_t>::const_iterator i = links.begin(), end = links.end(); i != end; ++i) {
if (i->tl.x <= ev->cx && ev->cx <= i->br.x &&
i->tl.y <= ev->cy && ev->cy <= i->br.y) {
if (i->tl.x <= ev->cx && ev->cx < i->br.x &&
i->tl.y <= ev->cy && ev->cy < i->br.y) {
call_listeners((const void*)i->param);
}
}
Expand Down
13 changes: 5 additions & 8 deletions gui/components/gui_scrollpane.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,17 @@ void gui_scrollpane_t::recalc_sliders(koord groesse)
{
scroll_x.set_pos(koord(0, groesse.y-11));
scroll_x.set_groesse(groesse-koord(12,12));
scroll_x.set_knob(groesse.x-12, komp->get_groesse().x); // set client/komp area
scroll_x.set_knob(groesse.x-12, komp->get_groesse().x + komp->get_pos().x); // set client/komp area

if(b_has_size_corner || b_show_scroll_x) {
scroll_y.set_pos(koord(groesse.x-11, 0));
scroll_y.set_groesse(groesse-koord(12,12));
scroll_y.set_knob(groesse.y-12, komp->get_groesse().y);
scroll_y.set_knob(groesse.y-12, komp->get_groesse().y + komp->get_pos().y);
}
else {
scroll_y.set_pos(koord(groesse.x-11, 0));
scroll_y.set_groesse(groesse);
scroll_y.set_knob(groesse.y, komp->get_groesse().y);
scroll_y.set_knob(groesse.y, komp->get_groesse().y + komp->get_pos().y);
}
old_komp_groesse = komp->get_groesse();
}
Expand Down Expand Up @@ -95,15 +95,14 @@ void gui_scrollpane_t::infowin_event(const event_t *ev)
else {
// translate according to scrolled position
event_t ev2 = *ev;
translate_event(&ev2, scroll_x.get_knob_offset(), scroll_y.get_knob_offset());
const koord gr = get_groesse();
translate_event(&ev2, scroll_x.get_knob_offset() - komp->get_pos().x, scroll_y.get_knob_offset() - komp->get_pos().y);

// hand event to component
komp->infowin_event(&ev2);

// Hajo: hack: component could have changed size
// this recalculates the scrollbars
if(gr!=get_groesse()) {
if( old_komp_groesse!=komp->get_groesse() ) {
recalc_sliders(get_groesse());
}
}
Expand Down Expand Up @@ -145,8 +144,6 @@ void gui_scrollpane_t::zeichnen(koord pos)
{
pos += this->pos;

koord gr=komp->get_groesse();

PUSH_CLIP(pos.x, pos.y, groesse.x-12*b_show_scroll_y, groesse.y-11*b_show_scroll_x );
komp->zeichnen(pos - koord(scroll_x.get_knob_offset(), scroll_y.get_knob_offset()));
POP_CLIP();
Expand Down
2 changes: 1 addition & 1 deletion gui/help_frame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void help_frame_t::set_text(const char * buf)
{
flow.set_text(buf);

flow.set_pos(koord(10, 6));
flow.set_pos(koord(10, 10));
flow.set_groesse(koord(220, 0));

// try to get the following sizes
Expand Down
2 changes: 1 addition & 1 deletion ifc/gui_komponente.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class gui_komponente_t
*/
virtual bool getroffen(int x, int y)
{
return (pos.x <= x && pos.y <= y && (pos.x+groesse.x) >= x && (pos.y+groesse.y) >= y);
return (pos.x <= x && pos.y <= y && (pos.x+groesse.x) > x && (pos.y+groesse.y) > y);
}

/**
Expand Down
1 change: 1 addition & 0 deletions simutrans/history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Trunk:
FIX: text overflow in message boxes
FIX: window resizing is triggered even if initial click is not in dragger area
FIX: square button's clickable area not set according to accompanying text
FIX: help text link's clickable area not correctly set

Release Candidate 102.2.2
FIX: connecting upslope to upper way works in sliced mode (r2949)
Expand Down

0 comments on commit a66ed88

Please sign in to comment.