Bugfix: double-clicking on an object to start move brought the move service into a weird state and made the object 'jump' on the next click.

This commit is contained in:
Matthias Koefferlein 2020-12-01 23:02:18 +01:00
parent 9305861102
commit bb19acead4
2 changed files with 12 additions and 5 deletions

View File

@ -167,7 +167,7 @@ MoveService::mouse_click_event (const db::DPoint &p, unsigned int buttons, bool
return true;
}
if (prio && (buttons & lay::LeftButton) != 0) {
if (handle_dragging (p, buttons, false, 0)) {
if (handle_click (p, buttons, false, 0)) {
return true;
}
}
@ -184,10 +184,17 @@ bool
MoveService::mouse_double_click_event (const db::DPoint &p, unsigned int buttons, bool prio)
{
if (prio) {
// stop dragging if required
if (m_dragging) {
handle_click (p, buttons, false, 0);
}
lay::SelectionService *selector = mp_view->selection_service ();
if (selector) {
return selector->mouse_double_click_event (p, buttons, prio);
}
}
return false;
}
@ -220,7 +227,7 @@ bool
MoveService::mouse_press_event (const db::DPoint &p, unsigned int buttons, bool prio)
{
if (prio && (buttons & lay::LeftButton) != 0) {
if (handle_dragging (p, buttons, false, 0)) {
if (handle_click (p, buttons, false, 0)) {
return true;
}
}
@ -273,11 +280,11 @@ MoveService::begin_move (db::Transaction *transaction, bool selected_after_move)
pstart.set_y (std::min (pstart.y (), bbox.p2 ().y ()));
}
return handle_dragging (pstart, 0, drag_transient, trans_holder.release ());
return handle_click (pstart, 0, drag_transient, trans_holder.release ());
}
bool
MoveService::handle_dragging (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction)
MoveService::handle_click (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction)
{
std::auto_ptr<db::Transaction> trans_holder (transaction);

View File

@ -62,7 +62,7 @@ private:
virtual void drag_cancel ();
virtual void deactivated ();
bool handle_dragging (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction);
bool handle_click (const db::DPoint &p, unsigned int buttons, bool drag_transient, db::Transaction *transaction);
bool m_dragging;
bool m_dragging_transient;