Skip to main content

Module view

Module view 

Source
Expand description

A view’s pointer gestures (the image viewport’s, the node graph’s, the library’s comparison): what the profile in force makes the wheel, a scroll, a pinch, each click, double click and drag do, and the one wheel path every zoomable view reads (view_wheel), so the same gesture does the same thing in each.

The image canvases share more: the view model (View, Mapping, the zoom ladder) and the gestures themselves (CanvasGestures, run over a ZoomPan by pan, click, double_click, wheel and keys), so the image viewport and each pane of the library’s comparison change their view the same way.

Experimental: may change in any release (docs/stability.md).

Structs§

CanvasGestures
An image canvas’s gestures, as data so an input profile can remap them: the pointer’s from the profile in force, the keys as by default.
GestureState
What a canvas keeps between frames for its gestures.
Mapping
The mapping between image pixels, physical pixels and points for one frame of one viewport in one window. Build it with Mapping::new; every conversion of the viewport (drawing, tiles, hit tests, the readout) goes through it.
View
What is shown: a zoom and the image point at the centre of the view. The application owns it (a window, a document); the viewport changes it through gestures and says so with signals.
ViewGestures
A view’s pointer gestures: per set of modifiers (index), what the wheel, a scroll and a pinch do, what a click and a double click of each button do, and which buttons’ drags pan.

Enums§

Cause
What made a view change.
Phase
Where a change stands in its gesture.
ViewAction
What a pointer gesture does to a view.
ViewWheel
One wheel, scroll or pinch input as a view’s gestures read it.
Zoom
How the zoom is chosen.

Constants§

MAX_ZOOM
The largest zoom.
MIN_ZOOM
The smallest zoom (a very large image fitted in a small view).
WHEEL_RATE
How fast the wheel zooms: the factor per point of scroll is exp(points × WHEEL_RATE) (wheel_factor).
ZOOM_LADDER
The zoom steps of zoom_in and zoom_out, in physical pixels per image pixel: whole ratios first (100 % is 1.0).

Traits§

ZoomPan
A zoomable, pannable view the canvas gestures drive: its view and mapping this frame, and what it does with a change.

Functions§

canvas_gestures
The image canvases’ gestures in a context: those set, else the pointer profile’s.
click
A click the profile gives a view action (a middle click cycling the zoom, a primary click toggling fit and 100 %).
click_view
The view a click-like action leads to from view (None: no change).
double_click
A primary double click: the profile’s view action (fit, 100 % and back, the zoom cycle, leave), through ZoomPan::double_click.
fit_zoom
The zoom that shows a whole image in a view of rect_px physical pixels.
keys
The keys, for a canvas with the keyboard (the caller says when): a ladder step up or down, fit, 100 % and 200 % around the centre, and with arrows the arrows pan (Shift: further). Not during a pan.
pan
A drag that pans (as the profile says, or with the pan key held): the image follows the pointer; Escape puts it back.
pan_key_held
Whether the pan key is held over the canvas (a drag then pans, whatever is under the pointer).
set_canvas_gestures
Sets the image canvases’ gestures in a context, over the pointer profile’s.
slot
A button’s place in ViewGestures’ per-button tables.
view_wheel
This pass’s wheel, scroll and pinch inputs as gestures say, in order; the wheel is taken from the panel around (call it only when the view is hovered). The one wheel path of the zoomable views.
wheel
The wheel, a scroll and a pinch, raw, as the profile says: zoom around the pointer (holding at 100 % while the wheel goes on, unless free), or pan. Only while the canvas is hovered: the wheel is then taken from the panel around.
wheel_factor
The zoom factor of a wheel motion of points (positive zooms in).
wheel_step
What one input does with gestures (view_wheel).
wheel_zoom
The zoom after a wheel motion of points (positive zooms in): a continuous factor that stops at exactly 100 % when it crosses it.
zoom_in
The next ladder step above zoom (or MAX_ZOOM’s step).
zoom_out
The next ladder step below zoom (or the smallest step).