Skip to main content

Module navigator

Module navigator 

Source
Expand description

The zoom control and the navigator (a minimap): two views of a viewport’s View, sharing its ViewportState. What they change goes through the viewport’s before_view hook, like the viewport’s own gestures (ViewportState::propose), and comes out as the viewport’s Signal::View with the next frame.

Experimental: may change in any release (docs/stability.md).
  • ZoomControl: zoom out, the zoom in percent, zoom in, fit and 100 %, one step of the zoom ladder at a time.
  • Navigator: the whole image (a texture the application gives, its proxy) and a frame around the part in view. A drag of the frame pans (Ctrl finer, Shift coarser; Escape puts the view back), a press outside it centres the view there, the wheel zooms, a double click fits. Focused, the arrows pan, + and - zoom, 0 fits.

Each has an on_change hook, before the viewport’s: a Change of the View, a drag’s frames with done: false and its end once more from the view before it. egui-pop-imaging runs the finished ones as the zoom.change step of an application.

use egui_pop_viewport::navigator::{Navigator, ZoomControl};
use egui_pop_viewport::{View, ViewportState};

fn side_panel(ui: &mut egui::Ui, state: &mut ViewportState, view: &mut View, proxy: egui::TextureId) {
    ZoomControl::new(state, view).show(ui);
    Navigator::new(state, view).texture(proxy).show(ui);
}

Structs§

Navigator
The navigator: the whole image and the part in view.
NavigatorTokens
The navigator’s colours, from the theme (navigator.*).
ViewOutput
What a zoom control or a navigator did in a frame.
ZoomControl
The zoom control: zoom out, the zoom, zoom in, fit, 100 %.

Functions§

percent_text
A zoom in percent, as the interface writes numbers: whole above 10 %, one decimal below.