Merge branch 'master' of github.com:wesnoth/wesnoth-old

This commit is contained in:
Alexander van Gessel 2013-12-22 02:05:05 +01:00
commit 0a4c353f5b

View file

@ -173,7 +173,7 @@ bool controller_base::handle_scroll(CKey& key, int mousex, int mousey, int mouse
dx += scroll_speed;
}
if ((mouse_flags & SDL_BUTTON_MMASK) != 0 && preferences::middle_click_scrolls()) {
map_location original_loc = get_mouse_handler_base().get_scroll_start();
const map_location original_loc = get_mouse_handler_base().get_scroll_start();
if (get_mouse_handler_base().scroll_started()) {
const SDL_Rect& rect = get_display().map_outside_area();
@ -181,10 +181,10 @@ bool controller_base::handle_scroll(CKey& key, int mousex, int mousey, int mouse
get_mouse_handler_base().scroll_started()) {
// Scroll speed is proportional from the distance from the first
// middle click and scrolling speed preference.
double speed = 0.04 * sqrt(scroll_speed);
double snap_dist = 16; // Snap to horizontal/vertical scrolling
double x_diff = (mousex - original_loc.x);
double y_diff = (mousey - original_loc.y);
const double speed = 0.04 * sqrt(scroll_speed);
const double snap_dist = 16; // Snap to horizontal/vertical scrolling
const double x_diff = (mousex - original_loc.x);
const double y_diff = (mousey - original_loc.y);
if (fabs(x_diff) > snap_dist || fabs(y_diff) <= snap_dist) dx += speed * x_diff;
if (fabs(y_diff) > snap_dist || fabs(x_diff) <= snap_dist) dy += speed * y_diff;