Before starting the dragging, check the current mouse position
...instead of trusting the calling parameters. Remove now unused data from the header
This commit is contained in:
parent
6c196f4e20
commit
e26abc9738
2 changed files with 8 additions and 6 deletions
|
@ -723,11 +723,14 @@ void mouse_handler::mouse_motion(int x, int y, const bool browse)
|
|||
const gamemap::location new_hex = (*gui_).hex_clicked_on(x,y,&nearest_hex,&second_nearest_hex);
|
||||
|
||||
// Fire the drag & drop only after minimal drag distance
|
||||
// or when we quit the initial hex.
|
||||
const int drag_distance = maximum<int>(abs(drag_from_x_- x), abs(drag_from_y_- y));
|
||||
if (dragging_ && !dragging_started_ && drag_distance > 10 && (SDL_GetMouseState(NULL,NULL) & SDL_BUTTON(1) != 0)) {
|
||||
dragging_started_ = true;
|
||||
cursor::set_dragging(true);
|
||||
// While we check the mouse buttons state, we also grab fresh position data.
|
||||
int mx,my;
|
||||
if (dragging_ && !dragging_started_ && (SDL_GetMouseState(&mx,&my) & SDL_BUTTON(1) != 0)) {
|
||||
const int drag_distance = maximum<int>(abs(drag_from_x_- mx), abs(drag_from_y_- my));
|
||||
if (drag_distance > 10) {
|
||||
dragging_started_ = true;
|
||||
cursor::set_dragging(true);
|
||||
}
|
||||
}
|
||||
|
||||
if(new_hex != last_hex_ || nearest_hex != last_nearest_ || second_nearest_hex != last_second_nearest_) {
|
||||
|
|
|
@ -91,7 +91,6 @@ private:
|
|||
undo_list& redo_stack_;
|
||||
|
||||
bool minimap_scrolling_;
|
||||
bool update_cursor_;
|
||||
bool dragging_;
|
||||
bool dragging_started_;
|
||||
int drag_from_x_;
|
||||
|
|
Loading…
Add table
Reference in a new issue