Remove warning

Remove unused right_up event call
This commit is contained in:
Filip Sykala 2022-02-11 10:12:57 +01:00
parent 1fa3a236a5
commit ff713c23ac
2 changed files with 33 additions and 41 deletions

View File

@ -426,15 +426,10 @@ bool GLGizmoHollow::on_mouse(const wxMouseEvent &mouse_event)
Vec2i mouse_coord(mouse_event.GetX(), mouse_event.GetY()); Vec2i mouse_coord(mouse_event.GetX(), mouse_event.GetY());
Vec2d mouse_pos = mouse_coord.cast<double>(); Vec2d mouse_pos = mouse_coord.cast<double>();
Selection & selection = m_parent.get_selection();
static bool pending_right_up = false; static bool pending_right_up = false;
if (mouse_event.LeftDown()) {
// when control is down we allow scene pan and rotation even when clicking
// over some object
bool control_down = mouse_event.CmdDown(); bool control_down = mouse_event.CmdDown();
bool grabber_contains_mouse = (get_hover_id() != -1); bool grabber_contains_mouse = (get_hover_id() != -1);
int selected_object_idx = selection.get_object_idx();
if (mouse_event.LeftDown()) {
if ((!control_down || grabber_contains_mouse) && if ((!control_down || grabber_contains_mouse) &&
gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false)) gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false))
// the gizmo got the event and took some action, there is no need // the gizmo got the event and took some action, there is no need
@ -444,13 +439,14 @@ bool GLGizmoHollow::on_mouse(const wxMouseEvent &mouse_event)
if (m_parent.get_move_volume_id() != -1) if (m_parent.get_move_volume_id() != -1)
// don't allow dragging objects with the Sla gizmo on // don't allow dragging objects with the Sla gizmo on
return true; return true;
bool control_down = mouse_event.CmdDown();
if (control_down) { if (control_down) {
if ((mouse_event.LeftIsDown() || mouse_event.RightIsDown())) {
// CTRL has been pressed while already dragging -> stop current action // CTRL has been pressed while already dragging -> stop current action
if (mouse_event.LeftIsDown()) if (mouse_event.LeftIsDown())
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true); gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true);
else if (mouse_event.RightIsDown()) else if (mouse_event.RightIsDown()) {
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true); pending_right_up = false;
} }
} else if(gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false)) { } else if(gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false)) {
// the gizmo got the event and took some action, no need to do // the gizmo got the event and took some action, no need to do
@ -460,16 +456,15 @@ bool GLGizmoHollow::on_mouse(const wxMouseEvent &mouse_event)
} }
} else if (mouse_event.LeftUp()) { } else if (mouse_event.LeftUp()) {
if (!m_parent.is_mouse_dragging()) { if (!m_parent.is_mouse_dragging()) {
bool control_down = mouse_event.CmdDown();
// in case gizmo is selected, we just pass the LeftUp event // in case gizmo is selected, we just pass the LeftUp event
// and stop processing - neither object moving or selecting is // and stop processing - neither object moving or selecting is
// suppressed in that case // suppressed in that case
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), control_down);
mouse_event.ShiftDown(), mouse_event.AltDown(),
control_down);
return true; return true;
} }
} else if (mouse_event.RightDown()) { } else if (mouse_event.RightDown()) {
if (selection.get_object_idx() != -1 && if (m_parent.get_selection().get_object_idx() != -1 &&
gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false)) { gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false)) {
// we need to set the following right up as processed to avoid showing // we need to set the following right up as processed to avoid showing
// the context menu if the user release the mouse over the object // the context menu if the user release the mouse over the object

View File

@ -1120,25 +1120,20 @@ bool GLGizmoSlaSupports::on_mouse(const wxMouseEvent &mouse_event){
Vec2i mouse_coord(mouse_event.GetX(), mouse_event.GetY()); Vec2i mouse_coord(mouse_event.GetX(), mouse_event.GetY());
Vec2d mouse_pos = mouse_coord.cast<double>(); Vec2d mouse_pos = mouse_coord.cast<double>();
Selection &selection = m_parent.get_selection();
static bool pending_right_up = false; static bool pending_right_up = false;
if (mouse_event.LeftDown()) {
// when control is down we allow scene pan and rotation even when clicking
// over some object
bool control_down = mouse_event.CmdDown();
bool grabber_contains_mouse = (get_hover_id() != -1); bool grabber_contains_mouse = (get_hover_id() != -1);
int selected_object_idx = selection.get_object_idx(); bool control_down = mouse_event.CmdDown();
if (mouse_event.LeftDown() && (!control_down || grabber_contains_mouse)) { if ((!control_down || grabber_contains_mouse) &&
if (gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false))
mouse_event.ShiftDown(), mouse_event.AltDown(), false))
return true; return true;
} else if (mouse_event.Dragging()) { } else if (mouse_event.Dragging()) {
bool control_down = mouse_event.CmdDown();
if (m_parent.get_move_volume_id() != -1) { if (m_parent.get_move_volume_id() != -1) {
// don't allow dragging objects with the Sla gizmo on // don't allow dragging objects with the Sla gizmo on
return true; return true;
} else if (!control_down && } else if (!control_down &&
gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false)) {
mouse_event.ShiftDown(), mouse_event.AltDown(), false)) {
// the gizmo got the event and took some action, no need to do // the gizmo got the event and took some action, no need to do
// anything more here // anything more here
m_parent.set_as_dirty(); m_parent.set_as_dirty();
@ -1148,21 +1143,23 @@ bool GLGizmoSlaSupports::on_mouse(const wxMouseEvent &mouse_event){
if (mouse_event.LeftIsDown()) if (mouse_event.LeftIsDown())
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true); gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true);
else if (mouse_event.RightIsDown()) else if (mouse_event.RightIsDown())
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true); pending_right_up = false;
} }
} else if (mouse_event.LeftUp() && !m_parent.is_mouse_dragging()) { } else if (mouse_event.LeftUp() && !m_parent.is_mouse_dragging()) {
// in case SLA/FDM gizmo is selected, we just pass the LeftUp event // in case SLA/FDM gizmo is selected, we just pass the LeftUp event
// and stop processing - neither object moving or selecting is // and stop processing - neither object moving or selecting is
// suppressed in that case // suppressed in that case
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), control_down); gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), mouse_event.CmdDown());
return true; return true;
}else if (mouse_event.RightDown() && selection.get_object_idx() != -1 && }else if (mouse_event.RightDown()){
if (m_parent.get_selection().get_object_idx() != -1 &&
gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false)) { gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false)) {
// we need to set the following right up as processed to avoid showing // we need to set the following right up as processed to avoid showing
// the context menu if the user release the mouse over the object // the context menu if the user release the mouse over the object
pending_right_up = true; pending_right_up = true;
// event was taken care of by the SlaSupports gizmo // event was taken care of by the SlaSupports gizmo
return true; return true;
}
} else if (pending_right_up && mouse_event.RightUp()) { } else if (pending_right_up && mouse_event.RightUp()) {
pending_right_up = false; pending_right_up = false;
return true; return true;