Fix the changing viewport when zooming with the slider.

This commit is contained in:
fendrin 2013-05-15 07:45:45 +02:00
parent 3fbc8b2711
commit 17b27b2946

View file

@ -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();