diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index a24c095ad6..110b6697ae 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4756,7 +4756,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) deselect_all(); } //BBS Select plate in this 3D canvas. - else if (evt.LeftUp() && !m_mouse.dragging && m_picking_enabled && !m_hover_plate_idxs.empty() && (m_canvas_type == CanvasView3D) && !is_layers_editing_enabled()) + // The left up may come from an ImGui window (e.g. a drag started on the gizmo floating window and released over the bed), + // in which case it must not be treated as a click on the plate, otherwise the gizmo would be closed (see deselect_all below). + else if (evt.LeftUp() && !m_mouse.ignore_left_up && !m_mouse.dragging && m_picking_enabled && !m_hover_plate_idxs.empty() && (m_canvas_type == CanvasView3D) && !is_layers_editing_enabled()) { int hover_idx = m_hover_plate_idxs.front(); wxGetApp().plater()->select_plate_by_hover_id(hover_idx); diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 7bae744098..17497edf16 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -1119,6 +1119,10 @@ public: void set_mouse_as_dragging() { m_mouse.dragging = true; } bool is_mouse_dragging() const { return m_mouse.dragging; } + // True when the current left up event comes from an ImGui window and was not processed by it + // (e.g. a drag that started on a gizmo floating window and was released over the 3D scene). + // Such a release is the end of an ImGui interaction, not a click on the scene. + bool is_mouse_left_up_ignored() const { return m_mouse.ignore_left_up; } double get_size_proportional_to_max_bed_size(double factor) const; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index feba37133a..ecf465afe7 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -566,8 +566,11 @@ bool GLGizmoEmboss::on_mouse_for_translate(const wxMouseEvent &mouse_event) void GLGizmoEmboss::on_mouse_change_selection(const wxMouseEvent &mouse_event) { - static bool was_dragging = true; - if ((mouse_event.LeftUp() || mouse_event.RightUp()) && !was_dragging) { + static bool was_dragging = true; + // The left up may be the end of a drag that started on the gizmo floating window (e.g. selecting + // text in the input field). Such a release is not a click on the scene and must not close the gizmo. + // (The flag is only set for left up events, so right up behavior is unchanged.) + if ((mouse_event.LeftUp() || mouse_event.RightUp()) && !was_dragging && !m_parent.is_mouse_left_up_ignored()) { // is hovered volume closest hovered? int hovered_idx = m_parent.get_first_hover_volume_idx(); if (hovered_idx < 0)