From 17b27b2946203a2ff8656bebf3119d3796e611ea Mon Sep 17 00:00:00 2001 From: fendrin Date: Wed, 15 May 2013 07:45:45 +0200 Subject: [PATCH] Fix the changing viewport when zooming with the slider. --- src/display.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index e096b546858..00ec4da3805 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -1924,8 +1924,8 @@ void display::set_zoom(int amount, bool absolute) zoom_slider->set_value(new_zoom); } SDL_Rect const &area = map_area(); - xpos_ += (xpos_ + area.w / 2) * amount / zoom_; - ypos_ += (ypos_ + area.h / 2) * amount / zoom_; + xpos_ += (xpos_ + area.w / 2) * (absolute ? new_zoom - zoom_ : amount) / zoom_; + ypos_ += (ypos_ + area.h / 2) * (absolute ? new_zoom - zoom_ : amount) / zoom_; zoom_ = new_zoom; bounds_check_position();