Commit 1fcf02d8 authored by Jens Georg's avatar Jens Georg

Minor code clean-up

parent cc77394b
......@@ -503,32 +503,34 @@ private class MapWidget : Gtk.Bin {
bool did_adjust_view = false;
foreach (var m in ms) {
if (m.view is CheckerboardItem) {
CheckerboardItem item = (CheckerboardItem) m.view;
if (!(m.view is CheckerboardItem)) {
continue;
}
if (!did_adjust_view) {
// if first item is in any way out of view, scroll to it
Gtk.Adjustment vadj = page.get_vadjustment();
CheckerboardItem item = m.view as CheckerboardItem;
if (!(get_adjustment_relation(vadj, item.allocation.y) == AdjustmentRelation.IN_RANGE
&& (get_adjustment_relation(vadj, item.allocation.y + item.allocation.height) == AdjustmentRelation.IN_RANGE))) {
if (!did_adjust_view) {
// if first item is in any way out of view, scroll to it
Gtk.Adjustment vadj = page.get_vadjustment();
// scroll to see the new item
int top = 0;
if (item.allocation.y < vadj.get_value()) {
top = item.allocation.y;
top -= CheckerboardLayout.ROW_GUTTER_PADDING / 2;
} else {
top = item.allocation.y + item.allocation.height - (int) vadj.get_page_size();
top += CheckerboardLayout.ROW_GUTTER_PADDING / 2;
}
if (!(get_adjustment_relation(vadj, item.allocation.y) == AdjustmentRelation.IN_RANGE
&& (get_adjustment_relation(vadj, item.allocation.y + item.allocation.height) == AdjustmentRelation.IN_RANGE))) {
vadj.set_value(top);
// scroll to see the new item
int top = 0;
if (item.allocation.y < vadj.get_value()) {
top = item.allocation.y;
top -= CheckerboardLayout.ROW_GUTTER_PADDING / 2;
} else {
top = item.allocation.y + item.allocation.height - (int) vadj.get_page_size();
top += CheckerboardLayout.ROW_GUTTER_PADDING / 2;
}
did_adjust_view = true;
vadj.set_value(top);
}
item.brighten();
did_adjust_view = true;
}
item.brighten();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment