mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-04 05:31:16 +00:00
Quick fix for restoring a 15px threshold for drag&drop (instead of 0)
This fixes unwanted double-click (causing double select event and reset goto) ilor: the editor continue to use 0, but I don't know where test it.
This commit is contained in:
parent
5bb4c4dc8f
commit
c92e735dc9
@ -32,11 +32,6 @@
|
||||
namespace events{
|
||||
|
||||
|
||||
namespace{
|
||||
//minimum dragging distance to fire the drag&drop
|
||||
const double drag_threshold = 14.0;
|
||||
}
|
||||
|
||||
mouse_handler::mouse_handler(game_display* gui, std::vector<team>& teams,
|
||||
unit_map& units, gamemap& map, gamestatus& status,
|
||||
undo_list& undo_stack, undo_list& redo_stack) :
|
||||
@ -77,6 +72,11 @@ void mouse_handler::set_team(const int team_number)
|
||||
team_num_ = team_number;
|
||||
}
|
||||
|
||||
int mouse_handler::drag_threshold() const
|
||||
{
|
||||
return 14;
|
||||
}
|
||||
|
||||
void mouse_handler::mouse_motion(int x, int y, const bool browse, bool update)
|
||||
{
|
||||
if (attackmove_) return;
|
||||
|
@ -69,6 +69,7 @@ protected:
|
||||
const team& viewing_team() const { return teams_[gui().viewing_team()]; }
|
||||
team& current_team() { return teams_[team_num_-1]; }
|
||||
|
||||
int drag_threshold() const;
|
||||
/**
|
||||
* Use update to force an update of the mouse state.
|
||||
*/
|
||||
|
@ -34,8 +34,6 @@ command_disabler::~command_disabler()
|
||||
|
||||
int commands_disabled= 0;
|
||||
|
||||
const int mouse_handler_base::drag_threshold_ = 0;
|
||||
|
||||
static bool command_active()
|
||||
{
|
||||
#ifdef __APPLE__
|
||||
@ -110,7 +108,7 @@ bool mouse_handler_base::mouse_motion_default(int x, int y, bool& /*update*/)
|
||||
if ((dragging_left_ && (SDL_GetMouseState(&mx,&my) & SDL_BUTTON_LEFT) != 0)
|
||||
|| (dragging_right_ && (SDL_GetMouseState(&mx,&my) & SDL_BUTTON_RIGHT) != 0)) {
|
||||
const double drag_distance = std::pow((double) (drag_from_x_- mx), 2) + std::pow((double) (drag_from_y_- my), 2);
|
||||
if (drag_distance > drag_threshold_*drag_threshold_) {
|
||||
if (drag_distance > drag_threshold()*drag_threshold()) {
|
||||
dragging_started_ = true;
|
||||
cursor::set_dragging(true);
|
||||
}
|
||||
|
@ -51,6 +51,9 @@ public:
|
||||
*/
|
||||
bool is_dragging() const;
|
||||
|
||||
//minimum dragging distance to fire the drag&drop
|
||||
virtual int drag_threshold() const {return 0;};
|
||||
|
||||
void mouse_motion_event(const SDL_MouseMotionEvent& event, const bool browse);
|
||||
|
||||
/** update the mouse with a fake mouse motion */
|
||||
@ -156,8 +159,6 @@ protected:
|
||||
|
||||
/** Show context menu flag */
|
||||
bool show_menu_;
|
||||
|
||||
static const int drag_threshold_;
|
||||
};
|
||||
|
||||
} // end namespace events
|
||||
|
Loading…
x
Reference in New Issue
Block a user