From 9093f3c05f701b74ea4629505c6712f8aaa739ef Mon Sep 17 00:00:00 2001 From: MichalPelka Date: Mon, 9 Nov 2026 00:27:27 +0100 Subject: [PATCH 1/2] Step 2: preview LIO segment gizmo drag, commit pose on release Dragging a segment gizmo in the LIO segments editor wrote m_pose every frame, so ScanRenderer::syncPoses() re-transformed and re-uploaded every moved scan (the segment and all following ones) each frame. Port step 3's drag-preview scheme: while ImGuizmo::IsUsing(), keep the in-progress pose chain in gizmo_drag_preview_poses and draw those scans from their cached GPU buffers via drawCachedWithTransform(); commit to m_pose once when the drag ends, rebuilding the scans immediately so the release frame doesn't flash the pre-drag pose. Selecting a gizmo no longer rewrites the pose through float every frame. Move the segment gizmo into lioSegmentsGizmo(), run only while the LIO segments editor is open, and commit an orphaned drag in commitGizmoDragIfOrphaned(). Replace element-wise m_gizmo copies with Eigen::Map. Co-Authored-By: Claude Opus 5.5 --- .../multi_view_tls_registration_gui.cpp | 379 +++++++++++------- 1 file changed, 234 insertions(+), 145 deletions(-) diff --git a/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp b/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp index 40dff10b..a73c6d85 100644 --- a/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp +++ b/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp @@ -1112,8 +1112,56 @@ float m_gizmo[] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; bool manipulate_only_marked_gizmo = false; +// Segment gizmo drag in progress (same scheme as multi_session_registration's +// session_drag_preview_poses): while ImGuizmo::IsUsing(), the moved scans' +// m_pose stays untouched -- writing it every frame made ScanRenderer::syncPoses() +// re-transform and re-upload every moved scan's points each frame. Instead the +// in-progress poses live here and are drawn from the cached GPU buffers; they +// are committed to m_pose once, when the drag ends. +// gizmo_drag_preview_poses[k] is the preview pose of scan gizmo_drag_first_index + k. +int gizmo_drag_first_index = -1; +std::vector gizmo_drag_preview_poses; + +bool isGizmoDragging() +{ + return gizmo_drag_first_index >= 0; +} + Session session; PointClouds::PointCloudDimensions session_dims; + +// Writes the in-progress drag poses into the scans and ends the drag. +void commitGizmoDrag() +{ + if (!isGizmoDragging()) + { + return; + } + auto& pcs = session.point_clouds_container.point_clouds; + for (size_t k = 0; k < gizmo_drag_preview_poses.size(); k++) + { + const size_t j = static_cast(gizmo_drag_first_index) + k; + if (j >= pcs.size()) + { + break; + } + PointCloud& pc = pcs[j]; + pc.m_pose = gizmo_drag_preview_poses[k]; + pc.pose = pose_tait_bryan_from_affine_matrix(pc.m_pose); + pc.gui_translation[0] = static_cast(pc.pose.px); + pc.gui_translation[1] = static_cast(pc.pose.py); + pc.gui_translation[2] = static_cast(pc.pose.pz); + pc.gui_rotation[0] = static_cast(pc.pose.om * RAD_TO_DEG); + pc.gui_rotation[1] = static_cast(pc.pose.fi * RAD_TO_DEG); + pc.gui_rotation[2] = static_cast(pc.pose.ka * RAD_TO_DEG); + // Rebuild right away: this frame's syncPoses() already ran (top of + // display()) and the preview is off from now on, so without this the + // scan is drawn once more at its pre-drag pose -- a visible jump back. + scan_renderer.rebuild(j, pc); + } + gizmo_drag_first_index = -1; + gizmo_drag_preview_poses.clear(); +} bool session_loaded = false; std::vector geoids; std::string selected_geoid_model; @@ -2186,22 +2234,14 @@ void lio_segments_gui() session.point_clouds_container.point_clouds[j].gizmo = false; } } - m_gizmo[0] = (float)session.point_clouds_container.point_clouds[i].m_pose(0, 0); - m_gizmo[1] = (float)session.point_clouds_container.point_clouds[i].m_pose(1, 0); - m_gizmo[2] = (float)session.point_clouds_container.point_clouds[i].m_pose(2, 0); - m_gizmo[3] = (float)session.point_clouds_container.point_clouds[i].m_pose(3, 0); - m_gizmo[4] = (float)session.point_clouds_container.point_clouds[i].m_pose(0, 1); - m_gizmo[5] = (float)session.point_clouds_container.point_clouds[i].m_pose(1, 1); - m_gizmo[6] = (float)session.point_clouds_container.point_clouds[i].m_pose(2, 1); - m_gizmo[7] = (float)session.point_clouds_container.point_clouds[i].m_pose(3, 1); - m_gizmo[8] = (float)session.point_clouds_container.point_clouds[i].m_pose(0, 2); - m_gizmo[9] = (float)session.point_clouds_container.point_clouds[i].m_pose(1, 2); - m_gizmo[10] = (float)session.point_clouds_container.point_clouds[i].m_pose(2, 2); - m_gizmo[11] = (float)session.point_clouds_container.point_clouds[i].m_pose(3, 2); - m_gizmo[12] = (float)session.point_clouds_container.point_clouds[i].m_pose(0, 3); - m_gizmo[13] = (float)session.point_clouds_container.point_clouds[i].m_pose(1, 3); - m_gizmo[14] = (float)session.point_clouds_container.point_clouds[i].m_pose(2, 3); - m_gizmo[15] = (float)session.point_clouds_container.point_clouds[i].m_pose(3, 3); + // Not while dragging: m_pose stays frozen at its pre-drag value until + // the drag ends, so re-seeding m_gizmo from it would break the drag. + if (!isGizmoDragging()) + { + // m_gizmo is column-major 4x4, same as Eigen's default storage. + Eigen::Map gizmo_map(m_gizmo); + gizmo_map = session.point_clouds_container.point_clouds[i].m_pose.matrix().cast(); + } } if (session.point_clouds_container.point_clouds[i].visible) @@ -4770,6 +4810,106 @@ void draw_section_preview() pose.matrix() = Eigen::Map(m).cast(); } +// Commits a drag that is still in progress if its gizmo won't be processed +// this frame (gizmo unticked, LIO segments editor closed, control points / +// loop closure opened, scans reloaded), rather than leave a stale preview. +void commitGizmoDragIfOrphaned() +{ + if (!isGizmoDragging()) + { + return; + } + const auto& pcs = session.point_clouds_container.point_clouds; + if (!is_lio_segments_gui || session.control_points.is_imgui || is_loop_closure_gui || + static_cast(gizmo_drag_first_index) >= pcs.size() || !pcs[gizmo_drag_first_index].gizmo) + { + commitGizmoDrag(); + } +} + +// LIO segments editor gizmo: moves the segment whose "gizmo" checkbox is set +// (and, unless "Manipulate only marked gizmo", every segment after it). +// While dragging only gizmo_drag_preview_poses is updated; the poses are +// committed once, when the drag ends (see commitGizmoDrag()). +void lioSegmentsGizmo() +{ + for (size_t i = 0; i < session.point_clouds_container.point_clouds.size(); i++) + { + if (session.point_clouds_container.point_clouds[i].gizmo) + { + auto& pcs = session.point_clouds_container.point_clouds; + + // Seed from the stored pose unless mid-drag (then m_gizmo is + // ImGuizmo's own last output and m_pose is still the pre-drag pose). + if (!isGizmoDragging()) + { + Eigen::Map gizmo_map(m_gizmo); + gizmo_map = pcs[i].m_pose.matrix().cast(); + } + + ImGuiIO& io = ImGui::GetIO(); + // ImGuizmo ----------------------------------------------- + ImGuizmo::BeginFrame(); + ImGuizmo::Enable(true); + ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y); + + if (!app_state.camera.isOrtho) + { + // Named-field copy (not a raw struct memcpy): Matrix's + // declared field order isn't guaranteed to match the + // m0..m15 column-major numbering its names imply. + Matrix projMat = rlGetMatrixProjection(); + Matrix modelMat = rlGetMatrixModelview(); + float projection[16] = { projMat.m0, projMat.m1, projMat.m2, projMat.m3, projMat.m4, projMat.m5, + projMat.m6, projMat.m7, projMat.m8, projMat.m9, projMat.m10, projMat.m11, + projMat.m12, projMat.m13, projMat.m14, projMat.m15 }; + float modelview[16] = { modelMat.m0, modelMat.m1, modelMat.m2, modelMat.m3, modelMat.m4, modelMat.m5, + modelMat.m6, modelMat.m7, modelMat.m8, modelMat.m9, modelMat.m10, modelMat.m11, + modelMat.m12, modelMat.m13, modelMat.m14, modelMat.m15 }; + + ImGuizmo::Manipulate( + &modelview[0], + &projection[0], + ImGuizmo::TRANSLATE | ImGuizmo::ROTATE_Z | ImGuizmo::ROTATE_X | ImGuizmo::ROTATE_Y, + ImGuizmo::WORLD, + m_gizmo, + NULL); + } + else + ImGuizmo::Manipulate( + app_state.camera.orthoGizmoView, + app_state.camera.orthoProjection, + ImGuizmo::TRANSLATE_X | ImGuizmo::TRANSLATE_Y | ImGuizmo::ROTATE_Z, + ImGuizmo::WORLD, + m_gizmo, + NULL); + + if (ImGuizmo::IsUsing()) + { + // Mid-drag: only update the preview chain (CPU-only); m_pose is + // left untouched so syncPoses() doesn't re-upload the moved scans. + // Each following scan keeps its offset to the previous one, + // taken from the still-unmodified m_pose values. + const size_t last = manipulate_only_marked_gizmo ? i + 1 : pcs.size(); + gizmo_drag_first_index = static_cast(i); + gizmo_drag_preview_poses.resize(last - i); + gizmo_drag_preview_poses[0] = Eigen::Affine3d(Eigen::Map(m_gizmo).cast()); + for (size_t j = i + 1; j < last; j++) + { + gizmo_drag_preview_poses[j - i] = + gizmo_drag_preview_poses[j - i - 1] * (pcs[j - 1].m_pose.inverse() * pcs[j].m_pose); + } + } + else + { + // Drag just ended (no-op otherwise): commit once -- the only + // frame the moved scans' GPU buffers get rebuilt. + commitGizmoDrag(); + } + } + } +} + void display() { // Safety net: rebuilds any scan whose m_pose no longer matches its @@ -4972,118 +5112,44 @@ void display() if (session.ground_control_points.is_imgui) session.ground_control_points.imgui(session.point_clouds_container); + // Commits a still-running drag whose gizmo won't be processed this frame. + commitGizmoDragIfOrphaned(); + if (!session.control_points.is_imgui) { if (!is_loop_closure_gui) { - for (size_t i = 0; i < session.point_clouds_container.point_clouds.size(); i++) + if (is_lio_segments_gui) { - if (session.point_clouds_container.point_clouds[i].gizmo) - { - std::vector all_m_poses; - for (size_t j = 0; j < session.point_clouds_container.point_clouds.size(); j++) - { - all_m_poses.push_back(session.point_clouds_container.point_clouds[j].m_pose); - } - - ImGuiIO& io = ImGui::GetIO(); - // ImGuizmo ----------------------------------------------- - ImGuizmo::BeginFrame(); - ImGuizmo::Enable(true); - ImGuizmo::SetRect(0, 0, io.DisplaySize.x, io.DisplaySize.y); + lioSegmentsGizmo(); + } - if (!app_state.camera.isOrtho) - { - // Named-field copy (not a raw struct memcpy): Matrix's - // declared field order isn't guaranteed to match the - // m0..m15 column-major numbering its names imply. - Matrix projMat = rlGetMatrixProjection(); - Matrix modelMat = rlGetMatrixModelview(); - float projection[16] = { projMat.m0, projMat.m1, projMat.m2, projMat.m3, projMat.m4, projMat.m5, - projMat.m6, projMat.m7, projMat.m8, projMat.m9, projMat.m10, projMat.m11, - projMat.m12, projMat.m13, projMat.m14, projMat.m15 }; - float modelview[16] = { modelMat.m0, modelMat.m1, modelMat.m2, modelMat.m3, modelMat.m4, modelMat.m5, - modelMat.m6, modelMat.m7, modelMat.m8, modelMat.m9, modelMat.m10, modelMat.m11, - modelMat.m12, modelMat.m13, modelMat.m14, modelMat.m15 }; - - ImGuizmo::Manipulate( - &modelview[0], - &projection[0], - ImGuizmo::TRANSLATE | ImGuizmo::ROTATE_Z | ImGuizmo::ROTATE_X | ImGuizmo::ROTATE_Y, - ImGuizmo::WORLD, - m_gizmo, - NULL); - } - else - ImGuizmo::Manipulate( - app_state.camera.orthoGizmoView, - app_state.camera.orthoProjection, - ImGuizmo::TRANSLATE_X | ImGuizmo::TRANSLATE_Y | ImGuizmo::ROTATE_Z, - ImGuizmo::WORLD, - m_gizmo, - NULL); - - session.point_clouds_container.point_clouds[i].m_pose(0, 0) = m_gizmo[0]; - session.point_clouds_container.point_clouds[i].m_pose(1, 0) = m_gizmo[1]; - session.point_clouds_container.point_clouds[i].m_pose(2, 0) = m_gizmo[2]; - session.point_clouds_container.point_clouds[i].m_pose(3, 0) = m_gizmo[3]; - session.point_clouds_container.point_clouds[i].m_pose(0, 1) = m_gizmo[4]; - session.point_clouds_container.point_clouds[i].m_pose(1, 1) = m_gizmo[5]; - session.point_clouds_container.point_clouds[i].m_pose(2, 1) = m_gizmo[6]; - session.point_clouds_container.point_clouds[i].m_pose(3, 1) = m_gizmo[7]; - session.point_clouds_container.point_clouds[i].m_pose(0, 2) = m_gizmo[8]; - session.point_clouds_container.point_clouds[i].m_pose(1, 2) = m_gizmo[9]; - session.point_clouds_container.point_clouds[i].m_pose(2, 2) = m_gizmo[10]; - session.point_clouds_container.point_clouds[i].m_pose(3, 2) = m_gizmo[11]; - session.point_clouds_container.point_clouds[i].m_pose(0, 3) = m_gizmo[12]; - session.point_clouds_container.point_clouds[i].m_pose(1, 3) = m_gizmo[13]; - session.point_clouds_container.point_clouds[i].m_pose(2, 3) = m_gizmo[14]; - session.point_clouds_container.point_clouds[i].m_pose(3, 3) = m_gizmo[15]; - session.point_clouds_container.point_clouds[i].pose = - pose_tait_bryan_from_affine_matrix(session.point_clouds_container.point_clouds[i].m_pose); - - session.point_clouds_container.point_clouds[i].gui_translation[0] = - (float)session.point_clouds_container.point_clouds[i].pose.px; - session.point_clouds_container.point_clouds[i].gui_translation[1] = - (float)session.point_clouds_container.point_clouds[i].pose.py; - session.point_clouds_container.point_clouds[i].gui_translation[2] = - (float)session.point_clouds_container.point_clouds[i].pose.pz; - - session.point_clouds_container.point_clouds[i].gui_rotation[0] = - (float)(session.point_clouds_container.point_clouds[i].pose.om * RAD_TO_DEG); - session.point_clouds_container.point_clouds[i].gui_rotation[1] = - (float)(session.point_clouds_container.point_clouds[i].pose.fi * RAD_TO_DEG); - session.point_clouds_container.point_clouds[i].gui_rotation[2] = - (float)(session.point_clouds_container.point_clouds[i].pose.ka * RAD_TO_DEG); - - if (!manipulate_only_marked_gizmo) - { - Eigen::Affine3d curr_m_pose = session.point_clouds_container.point_clouds[i].m_pose; - for (size_t j = i + 1; j < session.point_clouds_container.point_clouds.size(); j++) - { - curr_m_pose = curr_m_pose * (all_m_poses[j - 1].inverse() * all_m_poses[j]); - session.point_clouds_container.point_clouds[j].m_pose = curr_m_pose; - session.point_clouds_container.point_clouds[j].pose = - pose_tait_bryan_from_affine_matrix(session.point_clouds_container.point_clouds[j].m_pose); - - session.point_clouds_container.point_clouds[j].gui_translation[0] = - (float)session.point_clouds_container.point_clouds[j].pose.px; - session.point_clouds_container.point_clouds[j].gui_translation[1] = - (float)session.point_clouds_container.point_clouds[j].pose.py; - session.point_clouds_container.point_clouds[j].gui_translation[2] = - (float)session.point_clouds_container.point_clouds[j].pose.pz; - - session.point_clouds_container.point_clouds[j].gui_rotation[0] = - (float)(session.point_clouds_container.point_clouds[j].pose.om * RAD_TO_DEG); - session.point_clouds_container.point_clouds[j].gui_rotation[1] = - (float)(session.point_clouds_container.point_clouds[j].pose.fi * RAD_TO_DEG); - session.point_clouds_container.point_clouds[j].gui_rotation[2] = - (float)(session.point_clouds_container.point_clouds[j].pose.ka * RAD_TO_DEG); - } - } + // Scans being dragged are drawn below at their preview pose, straight + // from the cached GPU buffers, so hide them from the regular draw. + // (With "show with initial pose" the drag isn't visible anyway.) + auto& pcs = session.point_clouds_container.point_clouds; + const bool drawDragPreview = isGizmoDragging() && !session.point_clouds_container.show_with_initial_pose; + std::vector previewWasVisible; + if (drawDragPreview) + { + previewWasVisible.resize(gizmo_drag_preview_poses.size()); + for (size_t k = 0; k < gizmo_drag_preview_poses.size() && gizmo_drag_first_index + k < pcs.size(); k++) + { + PointCloud& pc = pcs[gizmo_drag_first_index + k]; + previewWasVisible[k] = pc.visible; + pc.visible = false; } } + // Colormap settings shared by the regular draw and the drag preview, + // so dragged scans keep the same coloring as the rest of the scene. + const ScanColorMode colorMode = scanColorModeFromScheme(csPointCloud); + const float elevationMin = static_cast(session_dims.z_min); + const float elevationMax = static_cast(session_dims.z_max); + const Eigen::Vector3d distanceCenter( + app_state.camera.euler.rotationCenter.x, app_state.camera.euler.rotationCenter.y, app_state.camera.euler.rotationCenter.z); + const float distanceMax = static_cast(std::max({ session_dims.length, session_dims.width, session_dims.height, 1.0 })); + // Was PointClouds::render() (legacy-GL, in `core`, shared with // GLUT apps) -- replaced with scan_renderer, which is kept in // sync via rebuildAll()/syncPoses() at session-load/pose-change @@ -5091,14 +5157,11 @@ void display() scan_renderer.draw( session.point_clouds_container.point_clouds, static_cast(app_state.point_size), - scanColorModeFromScheme(csPointCloud), - static_cast(session_dims.z_min), - static_cast(session_dims.z_max), - Eigen::Vector3d( - app_state.camera.euler.rotationCenter.x, - app_state.camera.euler.rotationCenter.y, - app_state.camera.euler.rotationCenter.z), - static_cast(std::max({ session_dims.length, session_dims.width, session_dims.height, 1.0 })), + colorMode, + elevationMin, + elevationMax, + distanceCenter, + distanceMax, app_state.viewer_decimate_point_cloud, session.point_clouds_container.xz_intersection, session.point_clouds_container.yz_intersection, @@ -5115,6 +5178,49 @@ void display() session.point_clouds_container.show_with_initial_pose, session.point_clouds_container.imu_to_lio_diff_scale); + if (drawDragPreview) + { + for (size_t k = 0; k < gizmo_drag_preview_poses.size() && gizmo_drag_first_index + k < pcs.size(); k++) + { + const size_t idx = gizmo_drag_first_index + k; + PointCloud& pc = pcs[idx]; + pc.visible = previewWasVisible[k]; + if (!pc.visible) + { + continue; + } + const Eigen::Affine3d& previewPose = gizmo_drag_preview_poses[k]; + scan_renderer.drawCachedWithTransform( + idx, + previewPose * pc.m_pose.inverse(), + ColorFromNormalized(Vector4{ pc.render_color[0], pc.render_color[1], pc.render_color[2], 1.f }), + static_cast(app_state.point_size), + colorMode, + elevationMin, + elevationMax, + distanceCenter, + distanceMax, + session.point_clouds_container.xz_intersection, + session.point_clouds_container.yz_intersection, + session.point_clouds_container.xy_intersection, + static_cast(session.point_clouds_container.intersection_width)); + + // Lightweight trajectory preview (the cached trajectory buffer is + // at the pre-drag pose); the full overlay returns on commit. + rlBegin(RL_LINES); + rlColor3f(pc.traj_color[0], pc.traj_color[1], pc.traj_color[2]); + for (size_t t = 1; t < pc.local_trajectory.size(); t++) + { + for (size_t n : { t - 1, t }) + { + const Eigen::Vector3d p = (previewPose * pc.local_trajectory[n].m_pose).translation(); + rlVertex3f(static_cast(p.x()), static_cast(p.y()), static_cast(p.z())); + } + } + rlEnd(); + } + } + observationPickingRender(observation_picking); for (const auto& obs : observation_picking.observations) @@ -5221,24 +5327,7 @@ void display() m_gizmo, NULL); - Eigen::Affine3d m_g = Eigen::Affine3d::Identity(); - - m_g(0, 0) = m_gizmo[0]; - m_g(1, 0) = m_gizmo[1]; - m_g(2, 0) = m_gizmo[2]; - m_g(3, 0) = m_gizmo[3]; - m_g(0, 1) = m_gizmo[4]; - m_g(1, 1) = m_gizmo[5]; - m_g(2, 1) = m_gizmo[6]; - m_g(3, 1) = m_gizmo[7]; - m_g(0, 2) = m_gizmo[8]; - m_g(1, 2) = m_gizmo[9]; - m_g(2, 2) = m_gizmo[10]; - m_g(3, 2) = m_gizmo[11]; - m_g(0, 3) = m_gizmo[12]; - m_g(1, 3) = m_gizmo[13]; - m_g(2, 3) = m_gizmo[14]; - m_g(3, 3) = m_gizmo[15]; + const Eigen::Affine3d m_g(Eigen::Map(m_gizmo).cast()); const int& index_src = session.pose_graph_loop_closure.edges[session.pose_graph_loop_closure.index_active_edge].index_from; From e094e6030782480efbdd22f066dddcb100e5f262 Mon Sep 17 00:00:00 2001 From: MichalPelka Date: Mon, 9 Nov 2026 00:27:28 +0100 Subject: [PATCH 2/2] Step 3: scrollable loop closure edge list (#629) The edge list in the Manual Pose Graph Loop Closure window grew the auto-resizing window with every edge, pushing the active-edge controls off screen. Put it in a bordered scrollable child, as step 2's LIO segments list, capped at 10 rows, and scroll to the active edge when it changes. Co-Authored-By: Claude Opus 5.5 --- .../multi_session_registration.cpp | 18 ++++++++++++++++++ .../multi_view_tls_registration_gui.cpp | 3 +-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/apps/multi_session_registration/multi_session_registration.cpp b/apps/multi_session_registration/multi_session_registration.cpp index 49b0fb1c..7f3a2a54 100644 --- a/apps/multi_session_registration/multi_session_registration.cpp +++ b/apps/multi_session_registration/multi_session_registration.cpp @@ -185,6 +185,8 @@ std::string project_file_name; std::vector edges; int index_active_edge = -1; +//!< Last index_active_edge the edge list was scrolled to (loop_closure_gui()). +int edge_list_scrolled_to = -1; bool manipulate_active_edge = false; bool edge_gizmo = false; @@ -730,6 +732,14 @@ void loop_closure_gui() ImGui::BeginDisabled(is_session_gizmo); int delete_edge_index = -1; + // Scrollable list, as step 2's "LIO segments" list, so many edges don't grow the + // window (AlwaysAutoResize) and push the active-edge controls below off screen. + // Fixed height (up to kEdgeListMaxRows rows) since an auto-resizing window can't + // give a child "the remaining space". + constexpr int kEdgeListMaxRows = 10; + const int edgeListRows = std::clamp((int)edges.size(), 1, kEdgeListMaxRows); + const float edgeListHeight = edgeListRows * ImGui::GetFrameHeightWithSpacing() + ImGui::GetStyle().WindowPadding.y * 2.0f; + ImGui::BeginChild("Edges", ImVec2(0, edgeListHeight), true); for (int i = 0; i < (int)edges.size(); i++) { const auto& e = edges[i]; @@ -757,7 +767,15 @@ void loop_closure_gui() snprintf(buttonLabel, sizeof(buttonLabel), "Delete##%d", i); if (ImGui::Button(buttonLabel)) delete_edge_index = i; + + // Keep the active edge in view when it changes (slider/input below, Add edge). + if (i == index_active_edge && index_active_edge != edge_list_scrolled_to) + { + ImGui::SetScrollHereY(0.5f); + edge_list_scrolled_to = index_active_edge; + } } + ImGui::EndChild(); ImGui::EndDisabled(); // Deleted after the loop so the list is not modified while it is drawn. The active edge keeps pointing at diff --git a/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp b/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp index a73c6d85..71055d1b 100644 --- a/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp +++ b/apps/multi_view_tls_registration/multi_view_tls_registration_gui.cpp @@ -4896,8 +4896,7 @@ void lioSegmentsGizmo() gizmo_drag_preview_poses[0] = Eigen::Affine3d(Eigen::Map(m_gizmo).cast()); for (size_t j = i + 1; j < last; j++) { - gizmo_drag_preview_poses[j - i] = - gizmo_drag_preview_poses[j - i - 1] * (pcs[j - 1].m_pose.inverse() * pcs[j].m_pose); + gizmo_drag_preview_poses[j - i] = gizmo_drag_preview_poses[j - i - 1] * (pcs[j - 1].m_pose.inverse() * pcs[j].m_pose); } } else