Fix hollowing mouse click
This commit is contained in:
parent
46044a210f
commit
1fa3a236a5
@ -429,19 +429,60 @@ bool GLGizmoHollow::on_mouse(const wxMouseEvent &mouse_event)
|
|||||||
Selection & selection = m_parent.get_selection();
|
Selection & selection = m_parent.get_selection();
|
||||||
static bool pending_right_up = false;
|
static bool pending_right_up = false;
|
||||||
|
|
||||||
if (mouse_event.RightDown() && selection.get_object_idx() != -1 &&
|
// when control is down we allow scene pan and rotation even when clicking
|
||||||
gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false)) {
|
// over some object
|
||||||
// we need to set the following right up as processed to avoid showing
|
bool control_down = mouse_event.CmdDown();
|
||||||
// the context menu if the user release the mouse over the object
|
bool grabber_contains_mouse = (get_hover_id() != -1);
|
||||||
pending_right_up = true;
|
int selected_object_idx = selection.get_object_idx();
|
||||||
// event was taken care of by the SlaSupports gizmo
|
if (mouse_event.LeftDown()) {
|
||||||
return true;
|
if ((!control_down || grabber_contains_mouse) &&
|
||||||
|
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
|
||||||
|
// to do anything more
|
||||||
|
return true;
|
||||||
|
} else if (mouse_event.Dragging()) {
|
||||||
|
if (m_parent.get_move_volume_id() != -1)
|
||||||
|
// don't allow dragging objects with the Sla gizmo on
|
||||||
|
return true;
|
||||||
|
if (control_down) {
|
||||||
|
if ((mouse_event.LeftIsDown() || mouse_event.RightIsDown())) {
|
||||||
|
// CTRL has been pressed while already dragging -> stop current action
|
||||||
|
if (mouse_event.LeftIsDown())
|
||||||
|
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true);
|
||||||
|
else if (mouse_event.RightIsDown())
|
||||||
|
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true);
|
||||||
|
}
|
||||||
|
} 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
|
||||||
|
// anything more here
|
||||||
|
m_parent.set_as_dirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (mouse_event.LeftUp()) {
|
||||||
|
if (!m_parent.is_mouse_dragging()) {
|
||||||
|
// in case gizmo is selected, we just pass the LeftUp event
|
||||||
|
// and stop processing - neither object moving or selecting is
|
||||||
|
// suppressed in that case
|
||||||
|
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos,
|
||||||
|
mouse_event.ShiftDown(), mouse_event.AltDown(),
|
||||||
|
control_down);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (mouse_event.RightDown()) {
|
||||||
|
if (selection.get_object_idx() != -1 &&
|
||||||
|
gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false)) {
|
||||||
|
// 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
|
||||||
|
pending_right_up = true;
|
||||||
|
// event was taken care of by the SlaSupports gizmo
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (mouse_event.RightUp()) {
|
||||||
|
if (pending_right_up) {
|
||||||
|
pending_right_up = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (pending_right_up && mouse_event.RightUp()) {
|
|
||||||
pending_right_up = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,21 +643,13 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||||||
|
|
||||||
bool GLGizmoPainterBase::on_mouse(const wxMouseEvent &mouse_event)
|
bool GLGizmoPainterBase::on_mouse(const wxMouseEvent &mouse_event)
|
||||||
{
|
{
|
||||||
// TODO: distribute implementation into gizmos itself
|
|
||||||
|
|
||||||
GLGizmosManager & mng = m_parent.get_gizmos_manager();
|
|
||||||
GLGizmosManager::EType current_type = mng.get_current_type();
|
|
||||||
|
|
||||||
// wxCoord == int --> wx/types.h
|
// wxCoord == int --> wx/types.h
|
||||||
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>();
|
||||||
|
|
||||||
if (mouse_event.Moving()) {
|
if (mouse_event.Moving()) {
|
||||||
if (current_type == GLGizmosManager::MmuSegmentation ||
|
gizmo_event(SLAGizmoEventType::Moving, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false);
|
||||||
current_type == GLGizmosManager::FdmSupports)
|
return false;
|
||||||
gizmo_event(SLAGizmoEventType::Moving, mouse_pos,
|
|
||||||
mouse_event.ShiftDown(), mouse_event.AltDown(),
|
|
||||||
false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// when control is down we allow scene pan and rotation even when clicking
|
// when control is down we allow scene pan and rotation even when clicking
|
||||||
@ -667,79 +659,51 @@ bool GLGizmoPainterBase::on_mouse(const wxMouseEvent &mouse_event)
|
|||||||
|
|
||||||
const Selection &selection = m_parent.get_selection();
|
const Selection &selection = m_parent.get_selection();
|
||||||
int selected_object_idx = selection.get_object_idx();
|
int selected_object_idx = selection.get_object_idx();
|
||||||
if (mouse_event.LeftDown() && (!control_down || grabber_contains_mouse)) {
|
if (mouse_event.LeftDown()) {
|
||||||
if ((current_type == GLGizmosManager::SlaSupports ||
|
if ((!control_down || grabber_contains_mouse) &&
|
||||||
current_type == GLGizmosManager::Hollow ||
|
gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), false))
|
||||||
current_type == GLGizmosManager::FdmSupports ||
|
|
||||||
current_type == GLGizmosManager::Seam ||
|
|
||||||
current_type == GLGizmosManager::MmuSegmentation) &&
|
|
||||||
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
|
||||||
// to do anything more
|
// to do anything more
|
||||||
return true;
|
return true;
|
||||||
} else if (mouse_event.RightDown() && !control_down && selected_object_idx != -1 &&
|
} else if (mouse_event.RightDown()){
|
||||||
(current_type == GLGizmosManager::FdmSupports ||
|
if (!control_down && selected_object_idx != -1 &&
|
||||||
current_type == GLGizmosManager::Seam ||
|
gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false))
|
||||||
current_type == GLGizmosManager::MmuSegmentation) &&
|
// event was taken care of
|
||||||
gizmo_event(SLAGizmoEventType::RightDown, mouse_pos, false, false, false)) {
|
return true;
|
||||||
// event was taken care of by the FdmSupports / Seam / MMUPainting gizmo
|
} else if (mouse_event.Dragging()) {
|
||||||
return true;
|
if (m_parent.get_move_volume_id() != -1)
|
||||||
} else if (mouse_event.Dragging() &&
|
// don't allow dragging objects with the Sla gizmo on
|
||||||
m_parent.get_move_volume_id() != -1 &&
|
return true;
|
||||||
(current_type == GLGizmosManager::SlaSupports ||
|
if (!control_down && gizmo_event(SLAGizmoEventType::Dragging,
|
||||||
current_type == GLGizmosManager::Hollow ||
|
mouse_pos, mouse_event.ShiftDown(),
|
||||||
current_type == GLGizmosManager::FdmSupports ||
|
mouse_event.AltDown(), false)) {
|
||||||
current_type == GLGizmosManager::Seam ||
|
// the gizmo got the event and took some action, no need to do
|
||||||
current_type == GLGizmosManager::MmuSegmentation))
|
// anything more here
|
||||||
// don't allow dragging objects with the Sla gizmo on
|
m_parent.set_as_dirty();
|
||||||
return true;
|
return true;
|
||||||
else if (mouse_event.Dragging() && !control_down &&
|
}
|
||||||
(current_type == GLGizmosManager::SlaSupports ||
|
if(control_down && (mouse_event.LeftIsDown() || mouse_event.RightIsDown()))
|
||||||
current_type == GLGizmosManager::Hollow ||
|
{
|
||||||
current_type == GLGizmosManager::FdmSupports ||
|
// CTRL has been pressed while already dragging -> stop current action
|
||||||
current_type == GLGizmosManager::Seam ||
|
if (mouse_event.LeftIsDown())
|
||||||
current_type == GLGizmosManager::MmuSegmentation) &&
|
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true);
|
||||||
gizmo_event(SLAGizmoEventType::Dragging, mouse_pos,
|
else if (mouse_event.RightIsDown())
|
||||||
mouse_event.ShiftDown(), mouse_event.AltDown(), false)) {
|
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), true);
|
||||||
// the gizmo got the event and took some action, no need to do
|
return false;
|
||||||
// anything more here
|
}
|
||||||
m_parent.set_as_dirty();
|
} else if (mouse_event.LeftUp()) {
|
||||||
return true;
|
if (!m_parent.is_mouse_dragging()) {
|
||||||
} else if (mouse_event.Dragging() && control_down &&
|
// in case SLA/FDM gizmo is selected, we just pass the LeftUp
|
||||||
(mouse_event.LeftIsDown() || mouse_event.RightIsDown())) {
|
// event and stop processing - neither object moving or selecting
|
||||||
// CTRL has been pressed while already dragging -> stop current action
|
// is suppressed in that case
|
||||||
if (mouse_event.LeftIsDown())
|
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), control_down);
|
||||||
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos,
|
return true;
|
||||||
mouse_event.ShiftDown(), mouse_event.AltDown(), true);
|
}
|
||||||
else if (mouse_event.RightIsDown())
|
} else if (mouse_event.RightUp()) {
|
||||||
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos,
|
if (!m_parent.is_mouse_dragging()) {
|
||||||
mouse_event.ShiftDown(), mouse_event.AltDown(), true);
|
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, mouse_event.ShiftDown(), mouse_event.AltDown(), control_down);
|
||||||
|
return true;
|
||||||
} else if (mouse_event.LeftUp() &&
|
}
|
||||||
(current_type == GLGizmosManager::SlaSupports ||
|
|
||||||
current_type == GLGizmosManager::Hollow ||
|
|
||||||
current_type == GLGizmosManager::FdmSupports ||
|
|
||||||
current_type == GLGizmosManager::Seam ||
|
|
||||||
current_type == GLGizmosManager::MmuSegmentation) &&
|
|
||||||
!m_parent.is_mouse_dragging()) {
|
|
||||||
// in case SLA/FDM gizmo is selected, we just pass the LeftUp event
|
|
||||||
// and stop processing - neither object moving or selecting is
|
|
||||||
// suppressed in that case
|
|
||||||
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos,
|
|
||||||
mouse_event.ShiftDown(), mouse_event.AltDown(),
|
|
||||||
control_down);
|
|
||||||
return true;
|
|
||||||
} else if (mouse_event.RightUp() &&
|
|
||||||
(current_type == GLGizmosManager::FdmSupports ||
|
|
||||||
current_type == GLGizmosManager::Seam ||
|
|
||||||
current_type == GLGizmosManager::MmuSegmentation) &&
|
|
||||||
!m_parent.is_mouse_dragging()) {
|
|
||||||
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos,
|
|
||||||
mouse_event.ShiftDown(), mouse_event.AltDown(),
|
|
||||||
control_down);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user