Skip to content

Conversation

@jo-mueller
Copy link
Collaborator

Follow-up to #455 to see if tests are passing with fixed napari version.

zoccoler and others added 28 commits July 1, 2025 12:27
…version for points layer)

Refactors the object focusing logic to correctly apply combined affine transformations (rotation, scale, shear, translation) when centering the viewer on a selected object. Adds a helper function to build the affine matrix and ensures only the selected layer's objects are considered for focusing.
Added support for focusing on selected objects in Labels layers by computing the center of the selected label and applying affine transformations. Introduced helper functions for affine transformation and default zoom calculation to improve camera centering and zooming behavior.
Improved the logic for focusing on selected objects in napari layers by refactoring affine transformation application and camera setting into dedicated functions. Enhanced code clarity, modularity, and error handling for single object selection, and streamlined the process for both Points and Labels layers.
Extended the _focus_object function to handle napari Surface, Shapes, and Tracks layers. Each layer type now computes the center and applies the affine transformation before setting the viewer camera. Also fixed center calculation for Points and Labels layers.
Replaces boolean indexing with integer indexing for shape selection in the _focus_object function to ensure compatibility with list of arrays in napari.layers.Shapes.
Replaces the custom _build_affine_matrix function with napari's Affine class for constructing affine transformation matrices. This simplifies the code and leverages napari's built-in utilities for affine transformations.
The _calculate_default_zoom function and its usage in _set_viewer_camera have been commented out. This prepares for potential future implementation of zooming in on highlighted objects, but currently leaves the functionality inactive.
Introduces two tests to verify that the viewer camera centers and dims step update correctly when a single or multiple points layers have highlighted selections in 3D mode. These tests ensure proper behavior when focusing on selected points, including handling of layer translations.
Simplified the logic for selecting the center of a track in the _focus_object function by using a ternary operator, as suggested by SIM108. Required by pre-commit.
…ing,-not-uuids

Use layer names for indexing, not uuids
@jo-mueller jo-mueller closed this Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants