diff --git a/docs/_scripts/homepage_video.py b/docs/_scripts/homepage_video.py index 9c3e5270a..ae8abddb9 100644 --- a/docs/_scripts/homepage_video.py +++ b/docs/_scripts/homepage_video.py @@ -82,7 +82,7 @@ def build_viewer(*, show: bool) -> napari.Viewer: layer.rendering = RENDERING layer.attenuation = ATTENUATION layer.colormap = COLORMAP - viewer.scale_bar.visible = True + viewer.canvas.scale_bar.visible = True viewer.axes.visible = True viewer.dims.axis_labels = ('T', 'Z', 'Y', 'X') viewer.window._qt_window.resize(*WINDOW_SIZE) diff --git a/docs/getting_started/viewer.md b/docs/getting_started/viewer.md index e224458fa..f1ac93f01 100644 --- a/docs/getting_started/viewer.md +++ b/docs/getting_started/viewer.md @@ -178,6 +178,8 @@ The **canvas** is in the center of the viewer and contains the visual display of +++ +The canvas model can be accessed via `viewer.canvas`; several things are exposed here, such as the [grid mode](grid-mode), [canvas overlays](viewer-overlays) and the overlay tiling settings. + (layer-list)= ### Layer list @@ -589,6 +591,8 @@ Note that this has no effect on the order of `viewer.dims.current_step`. The fir The fourth button transposes the displayed dimensions. +(grid-mode)= + ### Grid button The fifth button, the grid button, toggles between the default layer mode and grid mode. When clicked, it distributes the layers in a grid of cells. Each cell is a small interactive canvas whose camera is linked with all the others. @@ -606,7 +610,7 @@ The fifth button, the grid button, toggles between the default layer mode and gr ``` -The distribution of the layers in the grid can be altered according to the settings below, accessible by right-clicking the button (or programmatically through `viewer.grid`). The question icons can be hovered for more information about each setting. +The distribution of the layers in the grid can be altered according to the settings below, accessible by right-clicking the button (or programmatically through `viewer.canvas.grid`). The question icons can be hovered for more information about each setting. 1. Grid stride: By default, 1, placing one layer in each view. The value determines the number of layers overlaid in each view. Negative values reverse the order in which layers are displayed in the grid. 1. Grid width/height: By default, -1, which automatically determines the grid layout. @@ -635,11 +639,15 @@ The right side of the status bar contains some helpful tips depending on which l Overlays provide additional information about the render state and the data, displayed on the canvas itself. In napari there are two main types: canvas overlays - which are locked in position on the screen and hover over the rendered canvas - and scene overlays - which are located somewhere in world coordinates and follow the camera and dims just like layers. Canvas overlays can be positioned in various locations on the canvas (e.g: `top_left`, `bottom_center`), and will automatically tile if multiple are present at the same location. -The viewer gives access to a few such overlays: +Canvas overlays can be accessed via `viewer.canvas.overlays`, whereas viewer overlays live on the viewer itself. For example: + +```{tip} +`viewer.canvas.overlays` is a smart dictionary that allows access via attributes, instead of only via keys. So a shorthand for `viewer.canvas.overlays['text'] is `viewer.canvas.overlays.text`! +``` -- Scale bar (canvas overlay, accessible via `viewer.scale_bar`): it displays distances in world coordinates for the displayed scene. The scale bar usually inherits layer units when they are set. If inference fails it can fall back to a dimensionless label, and if displayed axes mix dimensionalities it uses the last displayed axis unit with a warning. You can control its appearance and fixed length from the viewer. See the [units guide](units-guide) for more information. +- Scale bar (accessible via `viewer.canvas.overlays.scale_bar`): it displays distances in world coordinates for the displayed scene. The scale bar usually inherits layer units when they are set. If inference fails it can fall back to a dimensionless label, and if displayed axes mix dimensionalities it uses the last displayed axis unit with a warning. You can control its appearance and fixed length from the viewer. See the [units guide](units-guide) for more information. - Axes (scene overlay, accessible via `viewer.axes`): displays basis axes at the origin. -- Text Overlay (canvas overlay, accessible via `viewer.text_overlay`): displays arbitrary text on the canvas. +- Text Overlay (canvas overlay, accessible via `viewer.canvas.overlays.text`): displays arbitrary text on the canvas. These overlays can also be accessed via graphical interface through the **View** menu and their respective submenus.