Expand description
Pointer gestures in a context: the table canvases read (a
PointerMap: what each pointer chord does per canvas kind, with
the options in force), and the wheel read raw.
The application API publishes the map from the keymap and the
pointer profile (set_map); without it, canvases follow the
default profile (Document). egui’s own scrolling follows the
profile’s modifiers (apply_input_options) and the wheel speed
(apply_wheel_speed).
egui merges a pinch with Ctrl and the wheel, and turns units into
points before widgets see them; a profile needs both apart, so the
canvases read the raw events (wheel_inputs): a wheel in lines is
Wheel, a scroll in points Scroll (unless the wheel device setting
says otherwise), a pinch Pinch, each with its modifiers.
A widget that needs the secondary button for itself claims it on its
rect (claim): context menus and the canvases’ profile bindings
leave that click or drag to it.
A draggable shows the cursor of its kind of drag (drag), hovered
only when dragging is its only action by default; the widget, the
profile and the kit may change it: drag_cursor, or
UiPop::drag_cursor.
use egui_pop_core::pointer;
use egui_pop_model::keymap::Pointer;
use egui_pop_model::pointer::SCOPE_IMAGE;
let ctx = egui::Context::default();
let map = pointer::map(&ctx);
assert_eq!(map.profile, "document");
let ctrl_wheel = pointer::chord(egui::Modifiers::COMMAND, Pointer::Wheel);
assert_eq!(map.command(SCOPE_IMAGE, &ctrl_wheel).unwrap().as_str(), "gesture.image.zoom");Re-exports§
pub use claim::Secondary;pub use claim::SecondaryClaim;pub use claim::claim_secondary;pub use claim::claimed;pub use drag::DragCursorFor;pub use drag::cursor_icon;pub use drag::drag_cursor;pub use drag::drag_cursor_icons;pub use drag::ghost_shown;pub use drag::hold_drag_cursor;pub use drag::hover_drag_cursor;pub use drag::resolve_drag_cursor;pub use drag::set_ghost_shown;
Modules§
- claim
- A widget’s own use of the secondary button.
- drag
- Drag cursors: the cursor a draggable shows, hovered and while it is
dragged, keyed by what the drag means (
DragKind) rather than by widget. - view
- 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.
Structs§
- Drag
Cursor - The cursors of a drag kind: hovered, and while dragging (kept until
the drag ends, wherever the pointer goes), and when the hover one
shows. Names from
CURSOR_NAMES; in a kit or a profile, an empty or unknown name and no policy keep the level below’s (DragCursor::over). - Wheel
Input - One wheel, scroll or pinch event of this pass.
Enums§
- Drag
Kind - What a drag does to what it holds: the meaning a drag’s cursor is
keyed by, whatever the widget. A widget names the kind of each of its
drags; the profile in force says which cursor each kind shows,
hovered and dragged, and when the hover cursor shows
(
DragKind::cursors,Profile::drag_cursors,HoverPolicy). - Hover
Policy - When a draggable shows its hover cursor, before any drag. While it is dragged it always shows its drag cursor.
Constants§
- MODIFIER_
SETS - How many sets of modifiers an
indextells apart.
Functions§
- apply_
input_ options - Makes egui’s scrolling (scroll areas,
zoom_delta) follow a profile’s modifiers. - apply_
wheel_ speed - Makes a wheel’s lines worth
speedtimes egui’s own points a line, in scroll areas and inwheel_inputs. What a trackpad sends is in points already, and stays as it is. A speed that is not a positive number counts as 1. - button
- The keymap’s button of egui’s.
- chord
- The chord of a pointer gesture with egui’s modifiers held.
- chord_
index - A chord’s modifiers as an
index. - collector
- The
pointercollector of the debug bridge: the profile in force, the hint shown now, the widgets’ claims of the secondary button in force and the uses they said (claim). - default_
map - The default profile’s map, without a context.
- egui_
button - egui’s button of the keymap’s.
- hint
- What the pointer does in a scope with these modifiers held, for a
canvas’s hint:
Wheel: zoom · MiddleDrag: pan, each gesture by its name and its command byword(none: left out). Clicks and drags of other buttons than these are left out too. - hint_
now - The hint a canvas under the pointer gave in this pass or the last one, if any (and not empty).
- index
- The four modifiers as an index (Ctrl or Cmd 1, Alt 2, Shift 4): the tables canvases keep per set of modifiers.
- map
- The pointer map in a context: the one published, else the default profile’s.
- modifiers_
from_ text - egui’s modifiers of a chord’s modifiers as text (
Ctrl,Alt+Shift; empty or unreadable: none). - modifiers_
of - egui’s modifiers of a chord’s: Ctrl is Cmd on macOS, as in the keymap.
- published
- The map published in a context, if one was.
- set_map
- Publishes a pointer map, and makes egui’s scrolling follow its modifiers and its wheel speed.
- set_
shared_ map set_mapwith a map shared with its publisher, who can tell it is still there (published).- show_
hint - A canvas under the pointer says what the pointer does there now
(
hint), for a status line to show (hint_now). - take_
wheel - Takes this pass’s wheel from what comes after (a canvas used it): the panel around does not scroll, egui’s smoothing of earlier notches included.
- web_
prevent_ default - For a web build’s
eframe::WebOptions::should_prevent_default: the browser never gets an event egui-pop handles, the wheel above all (Ctrl and the wheel would zoom the page, and a trackpad’s pinch arrives the same way), as eframe’s default does for every event. - wheel_
inputs - This pass’s wheel, scroll and pinch events, raw: unit and modifiers kept, egui’s smoothing left out (a notch is one step).
- wheel_
pointer - What the wheel device setting makes of a wheel event’s unit.