From aa9216858287a6cf0559606834c860dada0ca962 Mon Sep 17 00:00:00 2001 From: Robert J Audas Date: Thu, 4 Jun 2026 04:23:01 -0600 Subject: [PATCH] feat: double-click object list row to frame object in 3D view (#13804) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: double-click object list row to frame object in 3D view Resolves #13800. Extends the existing wxEVT_DATAVIEW_ITEM_ACTIVATED handler in ObjectList::create_objects_ctrl() so that double-clicking an object / part / instance row calls GLCanvas3D::zoom_to_selection(). This mirrors the existing "Fit camera to scene or selected object" canvas button, exposed via a natural mouse trigger from the list. The current view angle is preserved (Blender-style "Frame Selected"). Scope kept intentionally small: - Object / Part / Instance rows -> zoom_to_selection(). - Filament-color column -> unchanged (still opens color editor). - Plate rows -> unchanged (no-op). - Inert in slice-preview mode via get_current_canvas3D(true). Authored with assistance from Claude (Anthropic). Co-Authored-By: Claude Opus 4.7 * fix: no-op object-list double-click in slice-preview mode Following up on #13800 / #13804. The original guard used get_current_canvas3D(true)'s `exclude_preview` flag, expecting that to return nullptr when the preview canvas is active. In fact the flag falls through to the editor canvas as a default, so the handler was still calling zoom_to_selection() on the editor canvas — and since the camera is shared between the editor and preview canvases, the move was visible in the preview view as the camera jumping to empty world positions (sliced or excluded, sliced or not). Replace the misnamed flag with an explicit is_preview_shown() guard that returns early before any canvas lookup. Manually verified: preview mode now ignores object-list double-clicks; prepare-mode behavior unchanged. Authored with assistance from Claude (Anthropic). Co-Authored-By: Claude Opus 4.7 --------- Co-authored-by: Claude Opus 4.7 Co-authored-by: SoftFever --- src/slic3r/GUI/GUI_ObjectList.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index d0afd8e295..3413266b8e 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -481,6 +481,25 @@ void ObjectList::create_objects_ctrl() // Trigger the editor opening manually this->EditItem(event.GetItem(), GetColumn(colFilament)); #endif + return; + } + + // Double-clicking an object/part/instance row frames it in the 3D view, + // matching the "Fit camera to scene or selected object" canvas button. + // The preceding single click has already synced the canvas selection via + // wxEVT_DATAVIEW_SELECTION_CHANGED, so we just trigger the zoom here. + // No-op in slice-preview mode: the camera is shared with the editor + // canvas, so zooming there would move the preview view too — and the + // preview canvas's own toolbar button intentionally resets to the bed. + const wxDataViewItem item = event.GetItem(); + if (!item.IsOk()) + return; + if (wxGetApp().plater()->is_preview_shown()) + return; + const ItemType type = m_objects_model->GetItemType(item); + if (type & (itObject | itVolume | itInstance)) { + if (GLCanvas3D* canvas = wxGetApp().plater()->get_current_canvas3D()) + canvas->zoom_to_selection(); } });