Renamed function mouse_event to gizmo_event
This commit is contained in:
parent
2f244895d2
commit
2728e45646
4 changed files with 18 additions and 19 deletions
|
@ -1304,14 +1304,14 @@ void GLCanvas3D::Gizmos::set_sla_support_data(ModelObject* model_object, const S
|
|||
|
||||
|
||||
// Returns true if the gizmo used the event to do something, false otherwise.
|
||||
bool GLCanvas3D::Gizmos::mouse_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down)
|
||||
bool GLCanvas3D::Gizmos::gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down)
|
||||
{
|
||||
if (!m_enabled)
|
||||
return false;
|
||||
|
||||
GizmosMap::const_iterator it = m_gizmos.find(SlaSupports);
|
||||
if (it != m_gizmos.end())
|
||||
return reinterpret_cast<GLGizmoSlaSupports*>(it->second)->mouse_event(action, mouse_position, shift_down);
|
||||
return reinterpret_cast<GLGizmoSlaSupports*>(it->second)->gizmo_event(action, mouse_position, shift_down);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -3100,7 +3100,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
case 'a':
|
||||
case 'A':
|
||||
case WXK_CONTROL_A:
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.mouse_event(SLAGizmoEventType::SelectAll)) // Sla gizmo selects all support points
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.gizmo_event(SLAGizmoEventType::SelectAll)) // Sla gizmo selects all support points
|
||||
m_dirty = true;
|
||||
else
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_SELECT_ALL));
|
||||
|
@ -3120,14 +3120,14 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
{
|
||||
// key ESC
|
||||
case WXK_ESCAPE: {
|
||||
if (m_gizmos.get_current_type() != Gizmos::SlaSupports || !m_gizmos.mouse_event(SLAGizmoEventType::DiscardChanges))
|
||||
if (m_gizmos.get_current_type() != Gizmos::SlaSupports || !m_gizmos.gizmo_event(SLAGizmoEventType::DiscardChanges))
|
||||
m_gizmos.reset_all_states();
|
||||
m_dirty = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case WXK_RETURN: {
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.mouse_event(SLAGizmoEventType::ApplyChanges))
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.gizmo_event(SLAGizmoEventType::ApplyChanges))
|
||||
m_dirty = true;
|
||||
break;
|
||||
}
|
||||
|
@ -3137,7 +3137,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
#else /* __APPLE__ */
|
||||
case WXK_DELETE:
|
||||
#endif /* __APPLE__ */
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.mouse_event(SLAGizmoEventType::Delete))
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.gizmo_event(SLAGizmoEventType::Delete))
|
||||
m_dirty = true;
|
||||
else
|
||||
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE));
|
||||
|
@ -3156,7 +3156,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
case 'A':
|
||||
case 'a': {
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports) {
|
||||
if (m_gizmos.mouse_event(SLAGizmoEventType::AutomaticGeneration))
|
||||
if (m_gizmos.gizmo_event(SLAGizmoEventType::AutomaticGeneration))
|
||||
m_dirty = true;
|
||||
}
|
||||
else
|
||||
|
@ -3173,7 +3173,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
case 'z': { m_selection.is_empty() ? zoom_to_volumes() : zoom_to_selection(); break; }
|
||||
case 'M':
|
||||
case 'm': {
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.mouse_event(SLAGizmoEventType::ManualEditing)) {
|
||||
if (m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.gizmo_event(SLAGizmoEventType::ManualEditing)) {
|
||||
m_dirty = true;
|
||||
break;
|
||||
}
|
||||
|
@ -3207,7 +3207,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
|||
// Enable switching between 3D and Preview with Tab
|
||||
// m_canvas->HandleAsNavigationKey(evt); // XXX: Doesn't work in some cases / on Linux
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_TAB));
|
||||
} else if (m_gizmos.get_current_type() == Gizmos::SlaSupports && keyCode == WXK_SHIFT && m_gizmos.mouse_event(SLAGizmoEventType::ShiftUp)) {
|
||||
} else if (m_gizmos.get_current_type() == Gizmos::SlaSupports && keyCode == WXK_SHIFT && m_gizmos.gizmo_event(SLAGizmoEventType::ShiftUp)) {
|
||||
// shift has been just released - SLA gizmo might want to close rectangular selection.
|
||||
m_dirty = true;
|
||||
}
|
||||
|
@ -3443,7 +3443,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
_update_gizmos_data();
|
||||
m_dirty = true;
|
||||
}
|
||||
else if (evt.LeftDown() && m_gizmos.get_current_type() == Gizmos::SlaSupports && evt.ShiftDown() && m_gizmos.mouse_event(SLAGizmoEventType::LeftDown, Vec2d(pos(0), pos(1)), evt.ShiftDown()))
|
||||
else if (evt.LeftDown() && m_gizmos.get_current_type() == Gizmos::SlaSupports && evt.ShiftDown() && m_gizmos.gizmo_event(SLAGizmoEventType::LeftDown, Vec2d(pos(0), pos(1)), evt.ShiftDown()))
|
||||
{
|
||||
// the gizmo got the event and took some action, there is no need to do anything more
|
||||
}
|
||||
|
@ -3462,7 +3462,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
|
||||
m_dirty = true;
|
||||
}
|
||||
else if ((selected_object_idx != -1) && evt.RightDown() && m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.mouse_event(SLAGizmoEventType::RightDown))
|
||||
else if ((selected_object_idx != -1) && evt.RightDown() && m_gizmos.get_current_type() == Gizmos::SlaSupports && m_gizmos.gizmo_event(SLAGizmoEventType::RightDown))
|
||||
{
|
||||
// event was taken care of by the SlaSupports gizmo
|
||||
}
|
||||
|
@ -3619,7 +3619,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
|
||||
m_dirty = true;
|
||||
}
|
||||
else if (evt.Dragging() && m_gizmos.get_current_type() == Gizmos::SlaSupports && evt.ShiftDown() && m_gizmos.mouse_event(SLAGizmoEventType::Dragging, Vec2d(pos(0), pos(1)), evt.ShiftDown()))
|
||||
else if (evt.Dragging() && m_gizmos.get_current_type() == Gizmos::SlaSupports && evt.ShiftDown() && m_gizmos.gizmo_event(SLAGizmoEventType::Dragging, Vec2d(pos(0), pos(1)), evt.ShiftDown()))
|
||||
{
|
||||
// the gizmo got the event and took some action, no need to do anything more here
|
||||
m_dirty = true;
|
||||
|
@ -3672,7 +3672,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
m_layers_editing.accept_changes(*this);
|
||||
}
|
||||
else if (evt.LeftUp() && m_gizmos.get_current_type() == Gizmos::SlaSupports && !m_gizmos.is_dragging()
|
||||
&& !m_mouse.dragging && m_gizmos.mouse_event(SLAGizmoEventType::LeftUp, Vec2d(pos(0), pos(1)), evt.ShiftDown()))
|
||||
&& !m_mouse.dragging && m_gizmos.gizmo_event(SLAGizmoEventType::LeftUp, Vec2d(pos(0), pos(1)), evt.ShiftDown()))
|
||||
{
|
||||
// the gizmo got the event and took some action, no need to do anything more
|
||||
}
|
||||
|
@ -3686,10 +3686,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED));
|
||||
}
|
||||
else if (evt.LeftUp() && !m_mouse.dragging && (m_hover_volume_id == -1) && !gizmos_overlay_contains_mouse && !m_gizmos.is_dragging()
|
||||
&& !is_layers_editing_enabled() && (m_gizmos.get_current_type() != Gizmos::SlaSupports || !m_gizmos.mouse_event(SLAGizmoEventType::LeftUp, Vec2d(pos(0), pos(1)), evt.ShiftDown())))
|
||||
&& !is_layers_editing_enabled() && (m_gizmos.get_current_type() != Gizmos::SlaSupports || !m_gizmos.gizmo_event(SLAGizmoEventType::LeftUp, Vec2d(pos(0), pos(1)), evt.ShiftDown())))
|
||||
{
|
||||
// SLA gizmo cannot be deselected by clicking in canvas area to avoid inadvertent unselection and losing manual changes
|
||||
// that's why the mouse_event function was called so that the gizmo can refuse the deselection in manual editing mode
|
||||
// that's why the gizmo_event function was called so that the gizmo can refuse the deselection in manual editing mode
|
||||
|
||||
// deselect and propagate event through callback
|
||||
if (!evt.ShiftDown() && m_picking_enabled && !m_mouse.ignore_up_event)
|
||||
|
|
|
@ -446,8 +446,7 @@ private:
|
|||
void set_flattening_data(const ModelObject* model_object);
|
||||
|
||||
void set_sla_support_data(ModelObject* model_object, const Selection& selection);
|
||||
bool mouse_event(SLAGizmoEventType action, const Vec2d& mouse_position = Vec2d::Zero(), bool shift_down = false);
|
||||
void delete_current_grabber(bool delete_all = false);
|
||||
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position = Vec2d::Zero(), bool shift_down = false);
|
||||
|
||||
void render_current_gizmo(const Selection& selection) const;
|
||||
void render_current_gizmo_for_picking_pass(const Selection& selection) const;
|
||||
|
|
|
@ -307,7 +307,7 @@ std::pair<Vec3f, Vec3f> GLGizmoSlaSupports::unproject_on_mesh(const Vec2d& mouse
|
|||
// The gizmo has an opportunity to react - if it does, it should return true so that the Canvas3D is
|
||||
// aware that the event was reacted to and stops trying to make different sense of it. If the gizmo
|
||||
// concludes that the event was not intended for it, it should return false.
|
||||
bool GLGizmoSlaSupports::mouse_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down)
|
||||
bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down)
|
||||
{
|
||||
if (m_editing_mode) {
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
#endif // ENABLE_SVG_ICONS
|
||||
virtual ~GLGizmoSlaSupports();
|
||||
void set_sla_support_data(ModelObject* model_object, const Selection& selection);
|
||||
bool mouse_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down);
|
||||
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down);
|
||||
void delete_selected_points(bool force = false);
|
||||
std::pair<float, float> get_sla_clipping_plane() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue