mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 14:44:19 -06:00
Rotating/panning the view, using mouse left/right + CTRL modifier, while any gizmo is active
This commit is contained in:
parent
0f8f412e90
commit
68a7e5ce41
3 changed files with 131 additions and 134 deletions
|
@ -504,18 +504,20 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
int selected_object_idx = selection.get_object_idx();
|
||||
bool processed = false;
|
||||
|
||||
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
// when control is down we allow scene pan and rotation even when clicking over some object
|
||||
bool control_down = evt.CmdDown();
|
||||
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
|
||||
// mouse anywhere
|
||||
if (evt.Moving())
|
||||
m_tooltip = update_hover_state(mouse_pos);
|
||||
else if (evt.LeftUp())
|
||||
{
|
||||
if (m_mouse_capture.left)
|
||||
{
|
||||
else if (evt.LeftUp()) {
|
||||
if (m_mouse_capture.left) {
|
||||
processed = true;
|
||||
m_mouse_capture.left = false;
|
||||
}
|
||||
else if (is_dragging())
|
||||
{
|
||||
else if (is_dragging()) {
|
||||
switch (m_current) {
|
||||
case Move: m_parent.do_move(L("Gizmo-Move")); break;
|
||||
case Scale: m_parent.do_scale(L("Gizmo-Scale")); break;
|
||||
|
@ -538,41 +540,34 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
// else
|
||||
// return false;
|
||||
}
|
||||
else if (evt.MiddleUp())
|
||||
{
|
||||
if (m_mouse_capture.middle)
|
||||
{
|
||||
else if (evt.MiddleUp()) {
|
||||
if (m_mouse_capture.middle) {
|
||||
processed = true;
|
||||
m_mouse_capture.middle = false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if (evt.RightUp())
|
||||
{
|
||||
if (pending_right_up)
|
||||
{
|
||||
else if (evt.RightUp()) {
|
||||
if (pending_right_up) {
|
||||
pending_right_up = false;
|
||||
return true;
|
||||
}
|
||||
if (m_mouse_capture.right)
|
||||
{
|
||||
if (m_mouse_capture.right) {
|
||||
processed = true;
|
||||
m_mouse_capture.right = false;
|
||||
}
|
||||
// else
|
||||
// return false;
|
||||
}
|
||||
else if (evt.Dragging() && !is_dragging())
|
||||
{
|
||||
else if (evt.Dragging() && !is_dragging()) {
|
||||
if (m_mouse_capture.any())
|
||||
// if the button down was done on this toolbar, prevent from dragging into the scene
|
||||
processed = true;
|
||||
// else
|
||||
// return false;
|
||||
}
|
||||
else if (evt.Dragging() && is_dragging())
|
||||
{
|
||||
else if (evt.Dragging() && is_dragging()) {
|
||||
if (!m_parent.get_wxglcanvas()->HasCapture())
|
||||
m_parent.get_wxglcanvas()->CaptureMouse();
|
||||
|
||||
|
@ -595,7 +590,11 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
if (evt.AltDown())
|
||||
transformation_type.set_independent();
|
||||
selection.scale(get_scale(), transformation_type);
|
||||
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
if (control_down)
|
||||
#else
|
||||
if (evt.ControlDown())
|
||||
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
selection.translate(get_scale_offset(), true);
|
||||
wxGetApp().obj_manipul()->set_dirty();
|
||||
break;
|
||||
|
@ -618,15 +617,21 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
processed = true;
|
||||
}
|
||||
|
||||
if (get_gizmo_idx_from_mouse(mouse_pos) == Undefined)
|
||||
{
|
||||
if (get_gizmo_idx_from_mouse(mouse_pos) == Undefined) {
|
||||
// mouse is outside the toolbar
|
||||
m_tooltip = "";
|
||||
|
||||
if (evt.LeftDown())
|
||||
{
|
||||
if ((m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports ||m_current == Seam)
|
||||
&& gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
||||
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
if (evt.LeftDown() && (!control_down || grabber_contains_mouse())) {
|
||||
#else
|
||||
if (evt.LeftDown()) {
|
||||
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
if ((m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam)
|
||||
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
&& gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, evt.ShiftDown(), evt.AltDown()))
|
||||
#else
|
||||
&& gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
||||
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
// the gizmo got the event and took some action, there is no need to do anything more
|
||||
processed = true;
|
||||
else if (!selection.is_empty() && grabber_contains_mouse()) {
|
||||
|
@ -644,17 +649,19 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
processed = true;
|
||||
}
|
||||
}
|
||||
else if (evt.RightDown() && (selected_object_idx != -1) && (m_current == SlaSupports || m_current == Hollow)
|
||||
&& gizmo_event(SLAGizmoEventType::RightDown, mouse_pos))
|
||||
{
|
||||
else if (evt.RightDown() && selected_object_idx != -1 && (m_current == SlaSupports || m_current == Hollow)
|
||||
&& gizmo_event(SLAGizmoEventType::RightDown, mouse_pos)) {
|
||||
// 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
|
||||
processed = true;
|
||||
}
|
||||
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
else if (evt.RightDown() && !control_down && selected_object_idx != -1 && (m_current == FdmSupports || m_current == Seam)
|
||||
#else
|
||||
else if (evt.RightDown() && (selected_object_idx != -1) && (m_current == FdmSupports || m_current == Seam)
|
||||
&& gizmo_event(SLAGizmoEventType::RightDown, mouse_pos))
|
||||
{
|
||||
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
&& gizmo_event(SLAGizmoEventType::RightDown, mouse_pos)) {
|
||||
// event was taken care of by the FdmSupports / Seam gizmo
|
||||
processed = true;
|
||||
}
|
||||
|
@ -662,53 +669,57 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
|||
&& (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam))
|
||||
// don't allow dragging objects with the Sla gizmo on
|
||||
processed = true;
|
||||
else if (evt.Dragging() && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam )
|
||||
&& gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
||||
{
|
||||
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
else if (evt.Dragging() && !control_down && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam)
|
||||
&& gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown())) {
|
||||
#else
|
||||
else if (evt.Dragging() && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam)
|
||||
&& gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown())) {
|
||||
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
// the gizmo got the event and took some action, no need to do anything more here
|
||||
m_parent.set_as_dirty();
|
||||
processed = true;
|
||||
}
|
||||
else if (evt.LeftUp() && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam) && !m_parent.is_mouse_dragging())
|
||||
{
|
||||
else if (evt.LeftUp() && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam) && !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
|
||||
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down);
|
||||
#else
|
||||
gizmo_event(SLAGizmoEventType::LeftUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown());
|
||||
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
processed = true;
|
||||
}
|
||||
else if (evt.LeftUp() && (m_current == Flatten) && (m_gizmos[m_current]->get_hover_id() != -1))
|
||||
{
|
||||
else if (evt.LeftUp() && m_current == Flatten && m_gizmos[m_current]->get_hover_id() != -1) {
|
||||
// to avoid to loose the selection when user clicks an the white faces of a different object while the Flatten gizmo is active
|
||||
processed = true;
|
||||
}
|
||||
else if (evt.RightUp() && (m_current == FdmSupports || m_current == Seam) && !m_parent.is_mouse_dragging())
|
||||
{
|
||||
else if (evt.RightUp() && (m_current == FdmSupports || m_current == Seam) && !m_parent.is_mouse_dragging()) {
|
||||
#if ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down);
|
||||
#else
|
||||
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown());
|
||||
#endif // ENABLE_PAN_ROTATE_SCENE_IN_GIZMOS
|
||||
processed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// mouse inside toolbar
|
||||
if (evt.LeftDown() || evt.LeftDClick())
|
||||
{
|
||||
if (evt.LeftDown() || evt.LeftDClick()) {
|
||||
m_mouse_capture.left = true;
|
||||
m_mouse_capture.parent = &m_parent;
|
||||
processed = true;
|
||||
if (!selection.is_empty())
|
||||
{
|
||||
if (!selection.is_empty()) {
|
||||
update_on_off_state(mouse_pos);
|
||||
update_data();
|
||||
m_parent.set_as_dirty();
|
||||
}
|
||||
}
|
||||
else if (evt.MiddleDown())
|
||||
{
|
||||
else if (evt.MiddleDown()) {
|
||||
m_mouse_capture.middle = true;
|
||||
m_mouse_capture.parent = &m_parent;
|
||||
}
|
||||
else if (evt.RightDown())
|
||||
{
|
||||
else if (evt.RightDown()) {
|
||||
m_mouse_capture.right = true;
|
||||
m_mouse_capture.parent = &m_parent;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue