Skip to main content

Module navigation

Module navigation 

Source
Expand description

One navigation model for every canvas larger than its view (the node graph, the image viewport, plots): what docs/design/navigation.md proposes, in one place so each canvas behaves the same.

Experimental: may change in any release (docs/stability.md).
  • Hand mode (hand): H toggles it, Space held is the same for the moment; a primary drag then pans from anywhere on the canvas, for a pen, a touch screen or a mouse without a middle button. The canvas shows it with the grab cursor and an indicator (indicator).
  • Navigation commands (NavCommand): view.fit, view.frame_selection, view.zoom_in, view.zoom_out, view.zoom_100, view.pan_left (_right, _up, _down) and view.hand. Their keys (NavKeys) are the pointer profile’s (its view_keys): on the widget alone it reads them; in an application they are keymap bindings (shown and rebound in the shortcuts editor), and the commands reach the canvas in use through egui_pop_core::canvas.
  • The zoom control (CanvasZoom): zoom out, the percentage with a menu of fit, 100 % and steps, zoom in and hand mode, over any canvas, through the same commands.
  • Touch screens: two fingers pan (touch_pan) and a pinch zooms every canvas.
  • The overview shows when the content is much larger than the view (overview_needed).
  • The view kept across sessions for a canvas given an id (load_view, save_view), in egui’s persisted memory.
  • A one-time hint on a canvas kind’s first use (hint), dismissed by the first pan or a click, remembered.

Structs§

CanvasZoom
A zoom control for any canvas: zoom out, the zoom in percent (a menu of fit, frame the selection, 100 % and the steps), zoom in, and hand mode. It sends the canvas commands (view.zoom_out, view.fit, view.zoom_to:200…) to the canvas it drives through egui_pop_core::canvas, and shows the zoom the canvas published; each button’s tooltip says its keys.
NavKeys
The navigation keys: each command’s chords. A pointer profile gives them (egui_pop_core::model::pointer::Profile::view_keys), through the keymap in an application, where the user rebinds them in the shortcuts editor.

Enums§

NavCommand
A navigation command, the same on every canvas.
Overview
When a canvas shows its overview (a minimap in a corner).
PanDir
A direction to pan.

Constants§

OVERVIEW_RATIO
How much larger than the view the content must be, on one axis, for the overview to show.
ZOOM_STEPS
The zoom steps a CanvasZoom’s menu offers by default, in percent (100 % is always offered).

Functions§

commands
A canvas’s navigation for this frame: marks it active when the pointer is over it or it has the keyboard, reads its keys then (not while a text input owns the keyboard, nor in an application, whose keymap reads them and sends the commands), and gives what was asked, the application’s commands included. Hand mode is toggled here and not returned.
dismiss_hint
Marks a canvas kind’s hint as seen.
hand
Whether hand mode is on (a primary drag pans).
hint
The one-time hint on a canvas kind’s first use: shown from the first time the pointer is over the canvas until the first pan (panned) or a click on the canvas or on the hint; then never again for that kind. Whether it shows.
hint_seen
Whether a canvas kind’s hint was seen (dismissed) on this installation.
indicator
The hand mode indicator in a canvas’s top-left corner, and the grab cursor over the canvas, while hand mode is on. Whether it shows.
keys
The navigation keys in force: set with set_keys, else the pointer map’s (the profile’s, with the user’s changes in an application).
load_view
A canvas’s view kept in egui’s persisted memory under id.
overview_needed
Whether the content is much larger than the view: on one axis, more than OVERVIEW_RATIO times the view.
primary_pans
Whether a primary drag pans now: hand mode, or Space held.
save_view
Keeps a canvas’s view under id (written when it changed).
set_hand
Turns hand mode on or off.
set_keys
Sets the navigation keys outright; a canvas then reads them itself, in an application too.
touch_pan
How far two fingers or more moved this frame on a touch screen, in points, when they started over rect: the content follows them. A pinch’s zoom comes with the wheel’s inputs (egui_pop_core::pointer::wheel_inputs).
touching
Whether two fingers or more are on a touch screen now (egui’s multi-touch): a canvas then pans and zooms with them, and leaves the first finger’s drag alone.

Type Aliases§

Chord
A key and its modifiers.