From 734026bf96fbcba475e1dbef62138fa059a2c881 Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Mon, 10 Jan 2022 13:30:42 +0100 Subject: [PATCH] Reorder font list by draging font --- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index ff6773b6c6..4b3459f4aa 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -655,6 +655,15 @@ void GLGizmoEmboss::draw_font_list() } else if (ImGui::IsItemHovered()) ImGui::SetTooltip("%s", f.name.c_str()); + // reorder items + if (ImGui::IsItemActive() && !ImGui::IsItemHovered()) { + int other_index = index + (ImGui::GetMouseDragDelta(0).y < 0.f ? -1 : 1); + if (other_index >= 0 && other_index < m_font_list.size()) { + std::swap(m_font_list[index], m_font_list[other_index]); + ImGui::ResetMouseDragDelta(); + } + } + // draw buttons rename and delete ImGui::SameLine(); ImGui::SetCursorPosX(m_gui_cfg->rename_pos_x);