Skip to content

Commit

Permalink
Fix OpenTTD#7004: Redraw linkgraph overlay correctly after zoom
Browse files Browse the repository at this point in the history
Previously, when the user zooms in or out, the linkgraph overlay was recalculated before the zoom.  This caused some stations and edges to be missing from the visible region of the viewport.
  • Loading branch information
btzy committed Dec 31, 2018
1 parent 4a255e8 commit ac83367
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/main_gui.cpp
Expand Up @@ -197,9 +197,11 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w)

Point pt = GetTileZoomCenterWindow(in, w);
if (pt.x != -1) {
ScrollWindowTo(pt.x, pt.y, -1, w, true);
bool update_overlay = ScrollWindowTo(pt.x, pt.y, -1, w, true);

DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w);
update_overlay = DoZoomInOutWindow(in ? ZOOM_IN : ZOOM_OUT, w) || update_overlay;

if (update_overlay) RebuildViewportOverlay(w);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/viewport.cpp
Expand Up @@ -2245,7 +2245,6 @@ bool ScrollWindowTo(int x, int y, int z, Window *w, bool instant)
if (instant) {
w->viewport->scrollpos_x = pt.x;
w->viewport->scrollpos_y = pt.y;
RebuildViewportOverlay(w);
}

w->viewport->dest_scrollpos_x = pt.x;
Expand Down

0 comments on commit ac83367

Please sign in to comment.