Gizmo Measure - When CTRL+dragging to pan/rotate the scene, do not select the hovered feature, if any

This commit is contained in:
enricoturri1966 2022-11-21 08:37:58 +01:00
parent cf2a7608d3
commit 5d6346f275

View File

@ -254,6 +254,7 @@ GLGizmoMeasure::GLGizmoMeasure(GLCanvas3D& parent, const std::string& icon_filen
bool GLGizmoMeasure::on_mouse(const wxMouseEvent &mouse_event)
{
m_mouse_pos = { double(mouse_event.GetX()), double(mouse_event.GetY()) };
m_dragging = false;
if (mouse_event.Moving()) {
// only for sure
@ -261,6 +262,8 @@ bool GLGizmoMeasure::on_mouse(const wxMouseEvent &mouse_event)
return false;
}
else if (mouse_event.Dragging()) {
m_dragging = true;
// Enable/Disable panning/rotating the 3D scene
// Ctrl is pressed or the mouse is not hovering a selected volume
bool unlock_dragging = mouse_event.CmdDown() || (m_hover_id == -1 && !m_parent.get_selection().contains_volume(m_parent.get_first_hover_volume_idx()));
@ -578,7 +581,9 @@ void GLGizmoMeasure::on_render()
m_curr_point_on_feature_position.reset();
}
else {
std::optional<Measure::SurfaceFeature> curr_feature = mouse_on_object ? m_measuring->get_feature(model_facet_idx, position_on_model.cast<double>()) : std::nullopt;
std::optional<Measure::SurfaceFeature> curr_feature = m_dragging ? m_curr_feature :
mouse_on_object ? m_measuring->get_feature(model_facet_idx, position_on_model.cast<double>()) : std::nullopt;
if (m_curr_feature != curr_feature ||
(curr_feature.has_value() && curr_feature->get_type() == Measure::SurfaceFeatureType::Circle && (m_curr_feature != curr_feature || m_last_inv_zoom != inv_zoom))) {
m_parent.remove_raycasters_for_picking(SceneRaycaster::EType::Gizmo, POINT_ID);