Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime {
Show 37 fields pub states: StateStore, pub still: bool, pub scrollbars: Scrollbars, pub scrollbar_fade: HashMap<WidgetId, ScrollbarFade>, pub scrollbar_hovered: Option<WidgetId>, pub scrollbar_dragged: Option<WidgetId>, pub input: InputState, pub scroll: ScrollState, pub scroll_target: ScrollState, pub scroll_velocity: ScrollState, pub scroll_ballistic: HashMap<WidgetId, ScrollBallistic>, pub scroll_glow: HashMap<WidgetId, ScrollGlows>, pub ink: HashMap<WidgetId, Ripples>, pub refresh: HashMap<WidgetId, RefreshPull>, pub dismiss: HashMap<WidgetId, DismissState>, pub sheets: HashMap<WidgetId, SheetState>, pub sheet_handovers: Vec<(WidgetId, f32)>, pub page_requested: HashMap<WidgetId, usize>, pub kept_visible: HashMap<WidgetId, u64>, pub page_shown: HashMap<WidgetId, usize>, pub scroll_reported: HashMap<WidgetId, (f32, f32)>, pub drag_over: Option<WidgetId>, pub scroll_held: Option<WidgetId>, pub interactive: HashMap<WidgetId, InteractiveView>, pub interactive_velocity: HashMap<WidgetId, (f32, f32)>, pub edits: HashMap<WidgetId, Edit>, pub selection_handles: Option<WidgetId>, pub caret_hidden: bool, pub undo: HashMap<WidgetId, UndoHistory>, pub anims: HashMap<WidgetId, Anim>, pub values: HashMap<WidgetId, ValueAnim>, pub mounted: HashSet<WidgetId>, pub leaving: HashMap<u64, (Vec<Primitive>, f32)>, pub time: f32, pub focus_visible: bool, pub layout_cache: RefCell<LayoutCache>, pub paint_cache: RefCell<PaintCache>, /* private fields */
}
Expand description

Runtime context handed to build_ui: all the state retained between frames.

Fields§

§states: StateStore

What every Component keeps between rebuilds: the state of a StatefulWidget, and the values a component’s hooks hold.

§still: bool

Motion is off: the user has asked for animations to be reduced or removed, and the shell has passed that on from the platform.

The implicit animations — the ones a widget starts by itself when a value it was given changes — complete at once instead of over time. The change still happens; it stops moving, which is what the setting asks for. Skipping the change as well would leave the interface wrong rather than still.

It does not touch scrolling. A fling is physics answering a finger, not a decoration, and a list that jumped to a stop would be harder to use rather than calmer — the reference draws the same line.

§scrollbars: Scrollbars

Whether scroll areas draw a scrollbar, as the platform answers it and the application may override it. Set by the shell every frame, like still above.

It lives here rather than on the theme because it is a platform behaviour and not an appearance: the reference resolves it through ScrollBehavior, beside the physics, and not through ThemeData.

§scrollbar_fade: HashMap<WidgetId, ScrollbarFade>

How present each area’s scrollbar is, and how close a pointer has come to it. Advanced by Runtime::advance_scroll, which is where movement is seen.

§scrollbar_hovered: Option<WidgetId>

The area whose scrollbar a mouse is near, set by the shell from the previous frame’s registry. A bar that has gone comes back for a pointer that reaches for it — otherwise a faded bar could never be grabbed again (scrollbar.dart:2132).

§scrollbar_dragged: Option<WidgetId>

The area whose scrollbar is being dragged. It stays while the thumb is held, however long the hand pauses (scrollbar.dart:1970).

§input: InputState

Hover / press / focus.

§scroll: ScrollState

Current scroll offsets (the rendered ones), per region.

§scroll_target: ScrollState

Target scroll offsets (what the spring drives towards), per region.

§scroll_velocity: ScrollState

SingleChildScrollView velocity (for the spring), per region.

§scroll_ballistic: HashMap<WidgetId, ScrollBallistic>

The ballistic motion still running after a fling, per region — the simulation the platform’s physics handed us, sampled frame by frame by Runtime::advance_scroll. Absent = no fling in flight.

§scroll_glow: HashMap<WidgetId, ScrollGlows>

The overscroll glows of each region — the edge feedback a platform that clamps needs, since it has no bounce to speak with. Absent = all quiet.

§ink: HashMap<WidgetId, Ripples>

The ink splashed on each surface that takes it, keyed by the surface. A ripple outlives the frame that started it — a tap is 450 ms of motion — so it is retained here rather than in the widget, which is rebuilt every frame. Absent = dry.

§refresh: HashMap<WidgetId, RefreshPull>

The retained pull of each crate::RefreshIndicator area, keyed by the area. Absent = nothing pulled and nothing spinning.

§dismiss: HashMap<WidgetId, DismissState>

The retained swipe of each crate::Dismissible item. Absent = at rest.

§sheets: HashMap<WidgetId, SheetState>

The retained height of each crate::DraggableScrollableSheet, keyed by its panel. Absent = never moved, and at its initial height.

§sheet_handovers: Vec<(WidgetId, f32)>

Throws that carried a sheet to full height since they were last taken: the list each goes on in and the velocity it goes on at, in px/s. See Runtime::take_sheet_handovers.

§page_requested: HashMap<WidgetId, usize>

The page each crate::PageView was last told to show, so that a request is acted on when it changes rather than re-asserted every frame — which would leave the offset unswipeable. Absent = never seen, so the next request is the initial page and arrives without an animation.

§kept_visible: HashMap<WidgetId, u64>

The box each scroll region was last asked to keep in view, by the key the content named it with, so that the request is acted on when it changes rather than re-asserted every frame — which would pin the content and leave it undraggable. Absent = never seen, and the walk has already opened there.

§page_shown: HashMap<WidgetId, usize>

The page each paged view was last reported as showing, so that on_page_changed fires on a change and not on every frame of the motion.

§scroll_reported: HashMap<WidgetId, (f32, f32)>

The offset each scroll region was last reported at, so that crate::Widget::on_scroll fires on a change and not on every frame, and so that a region’s grain is measured from what the application was actually told rather than from the previous frame — otherwise a slow drag would never travel a whole grain in one frame and would never be reported at all.

§drag_over: Option<WidgetId>

The drop target a drag is currently over, when it would accept it. The target paints its own “drop it here” state from this, through crate::interaction::Status::drag_over — the shell decides which target, the widget decides what that looks like.

§scroll_held: Option<WidgetId>

The region a finger is currently holding, if any.

A scroll offset has one owner at a time. While a drag owns it, nothing else may move it: without this, the edge spring keeps retracting the offset between two moves of the finger, and a rubber band pulled against a bouncing edge is dragged back as fast as it is stretched — it never appears at all. At most one, because at most one gesture is live.

§interactive: HashMap<WidgetId, InteractiveView>

Retained transform (scale + translation) of each InteractiveViewer, per viewport. Absent = identity (scale 1, no translation).

§interactive_velocity: HashMap<WidgetId, (f32, f32)>

Pan velocity (px/s) of a fling still running after release, per viewport — decelerated every frame by Runtime::advance_interactive. Absent = at rest.

§edits: HashMap<WidgetId, Edit>

Edit state, per input field.

§selection_handles: Option<WidgetId>

The field whose selection shows handles — one made with a finger (milestone 511). Put away by the next press or key; shown only while that field is focused.

§caret_hidden: bool

The focused field’s caret is in the hidden half of its blink (milestone 513). Kept by the shell, on the wall clock; false — shown — wherever nothing blinks it, which is every test and every picture.

§undo: HashMap<WidgetId, UndoHistory>

Undo history, per input field: what it was, and what it was about to be.

Beside edits rather than inside it, because they are different things kept for different reasons — a caret is where the field is now, a history is everywhere it has been — and because Edit is Copy and a history is not.

§anims: HashMap<WidgetId, Anim>

Animation progresses (hover/focus/opacity), per widget.

§values: HashMap<WidgetId, ValueAnim>

The widgets’ own animated values (Widget::anim_target), per widget — each one a curved timeline (see ValueAnim).

§mounted: HashSet<WidgetId>

Widgets present at the previous frame (to detect mounts).

§leaving: HashMap<u64, (Vec<Primitive>, f32)>

Snapshots of outgoing subtrees, fading out: event key → (captured primitives, remaining opacity 1 → 0).

§time: f32

Time elapsed (seconds) since start-up, for continuous animations.

§focus_visible: bool

Was the last interaction a keyboard one? The generic focus ring is only painted in that case (FocusHighlightMode: a click must not flash a ring). The focus itself stays active.

§layout_cache: RefCell<LayoutCache>

Relayout-boundary cache (rects retained per layout root, from one frame to the next). Interior mutability: build_ui updates it while holding only a shared reference to the Runtime.

§paint_cache: RefCell<PaintCache>

Repaint-boundary cache (primitives + interactions retained per boundary, from one frame to the next). Same interior mutability.

Implementations§

Source§

impl Runtime

Source

pub fn advance_switchers<Msg>( &mut self, root: &dyn Widget<Msg>, dt: f32, ) -> bool

Steps every AnimatedSwitcher’s children in and out, and forgets the switchers no longer in the tree. Returns whether a child is still moving.

Source

pub fn switching(&self) -> bool

Whether a switcher has moved since the tree was last built, so that the next frame has to build the tree again rather than only paint it: what moved is carried by the children as numbers.

Source§

impl Runtime

Source

pub fn with_scrollbars(scrollbars: Scrollbars) -> Self

A runtime that answers a given scrollbar policy — what the shell sets from the application’s scrollbars(), and what an isolated render has to say for itself, there being no shell to set it.

Source

pub fn hover_progress(&self, id: WidgetId) -> f32

A widget’s animated hover progress.

Source

pub fn focus_progress(&self, id: WidgetId) -> f32

A widget’s animated focus progress.

Source

pub fn press_progress_or(&self, id: WidgetId, default: f32) -> f32

A widget’s animated press progress, or default where the runtime has never heard of it.

The fallback is the rule Runtime::value_or applies: a frame built before the loop has advanced anything — a test, an isolated render — must draw a widget that is being held as held, not as untouched on its way there.

Source

pub fn press_progress(&self, id: WidgetId) -> f32

A widget’s animated press progress (0 by default).

Source

pub fn opacity(&self, id: WidgetId) -> f32

A widget’s animated opacity (1 by default).

Source

pub fn value(&self, id: WidgetId) -> f32

A widget’s animated value (0 by default).

Source

pub fn value_or(&self, id: WidgetId, default: f32) -> f32

A widget’s animated value, or default if no value has been recorded yet (a widget never animated — e.g. an isolated render with no loop). Lets the target be adopted immediately, as on mount.

Source

pub fn set_value(&mut self, id: WidgetId, v: f32)

Sets a widget’s animated value to v (at rest, no transition in progress) — for isolated renders/tests that want a precise progress without running the animation.

Source

pub fn advance_values<Msg>(&mut self, root: &dyn Widget<Msg>, dt: f32) -> bool

Drives every animated value towards the target its widget declares (Widget::anim_target). A widget seen for the first time adopts its target with no transition (no animation on mount). Returns true if a value is still moving.

Source

pub fn anim_color(&self, id: WidgetId) -> Option<Color>

A widget’s animated background colour, if in transition (None otherwise).

Source

pub fn advance_colors<Msg>(&mut self, root: &dyn Widget<Msg>, dt: f32) -> bool

Drives every animated background colour towards the target its widget declares (Widget::anim_color), following its duration/curve (anim_duration/anim_curve). On mount: adopts the target with no transition. Returns true if a colour is still moving. Same model as Self::advance_values.

Source

pub fn anim_text_style(&self, id: WidgetId) -> Option<TextStyle>

A widget’s animated inherited text style, if in transition (None otherwise).

Read by the theme swap rather than by the node itself: see crate::ui::scoped_theme, which is the one place the value is consumed and the reason there is one place at all.

Source

pub fn advance_text_styles<Msg>( &mut self, root: &dyn Widget<Msg>, dt: f32, ) -> bool

Drives every animated inherited text style towards the target its widget declares (Widget::anim_text_style), following its duration/curve. On mount: adopts the target with no transition. Returns true if a style is still moving.

Same model as Self::advance_colors, over TextStyle::lerp — which is where the rules live for what travels, what holds and what swaps at the halfway point.

Source

pub fn anim_size(&self, id: WidgetId) -> Option<Size>

A widget’s animated size, if in transition (None otherwise).

Source

pub fn advance_sizes<Msg>(&mut self, root: &dyn Widget<Msg>, dt: f32) -> bool

Drives every animated size towards the target its widget declares (Widget::anim_size), following its duration/curve. On mount: adopts the target with no transition. Returns true if a size is still moving. Same model as Self::advance_values, except the output is consumed at layout (effective_style), not at paint.

Source

pub fn anim_radius(&self, id: WidgetId) -> Option<BorderRadius>

A widget’s animated corner radius, if in transition (None otherwise).

Source

pub fn advance_radii<Msg>(&mut self, root: &dyn Widget<Msg>, dt: f32) -> bool

Drives every animated corner radius towards the target its widget declares (Widget::anim_radius), following its duration/curve. On mount: adopts the target with no transition. Returns true if a radius is still moving. Same model as Self::advance_colors, applied to a BorderRadius.

Source

pub fn anim_transform(&self, id: WidgetId) -> Option<TransformValues>

A widget’s animated transform, if in transition (None otherwise).

Source

pub fn advance_transforms<Msg>( &mut self, root: &dyn Widget<Msg>, dt: f32, ) -> bool

Drives every animated transform towards the target its widget declares (Widget::anim_transform), following its duration/curve. On mount: adopts the target with no transition — a widget that appears already scaled does not scale in from nothing. Returns true if a transform is still moving. The output is consumed at paint, unlike the size and the padding.

Source

pub fn anim_padding(&self, id: WidgetId) -> Option<Insets>

A widget’s animated padding, if in transition (None otherwise).

Source

pub fn anim_offset(&self, id: WidgetId) -> Option<(f32, f32)>

A widget’s animated offset pair, if in transition (None otherwise).

Source

pub fn advance_offsets<Msg>(&mut self, root: &dyn Widget<Msg>, dt: f32) -> bool

Drives every animated offset pair towards the target its widget declares (Widget::anim_offset), following its duration/curve. On mount: adopts the target with no transition. Returns true if one is still moving.

The pair belongs to whichever offset rule the node declares — its alignment, or its slide — which is why one quantity serves both: a node has one of those rules, and the wrappers in animated.rs each give it a node of its own.

Source

pub fn advance_paddings<Msg>(&mut self, root: &dyn Widget<Msg>, dt: f32) -> bool

Drives every animated padding towards the target its widget declares (Widget::anim_padding), following its duration/curve. On mount: adopts the target with no transition. Returns true if a padding is still moving. Like the size, the output is consumed at layout (effective_style).

Source

pub fn anim_pins(&self, id: WidgetId) -> Option<Positioning>

A widget’s animated stack pins, if it has any (None otherwise).

Source

pub fn anim_fractions(&self, id: WidgetId) -> Option<(Option<f32>, Option<f32>)>

A widget’s animated fractions of its parent, if it has any (None otherwise), as (width factor, height factor).

Source

pub fn advance_pins<Msg>(&mut self, root: &dyn Widget<Msg>, dt: f32) -> bool

Drives every animated set of stack pins towards the target its widget declares (Widget::anim_pins), following its duration/curve. On mount: adopts the target with no transition. Returns true if a layer is still moving.

The output is consumed where the stack lays its layers out, which is the only place pins mean anything — a pin is a request to a parent of one particular kind, not a property of the box.

Source

pub fn advance_fractions<Msg>( &mut self, root: &dyn Widget<Msg>, dt: f32, ) -> bool

Drives every animated pair of fractions towards the target its widget declares (Widget::anim_fractions), following its duration/curve. On mount: adopts the target with no transition. Returns true if a box is still growing or shrinking.

Like the size and the padding, the output is consumed at layout (effective_style): a share of the parent is a claim on room, and a claim on room is settled before anything is drawn.

Source

pub fn advance(&mut self, dt: f32) -> bool

Advances the transitions (hover/focus/press) by dt seconds towards their targets. Returns true if at least one animation is still running.

Source

pub fn advance_scroll( &mut self, regions: &[Scrollable], default: ScrollPhysics, dt: f32, ) -> bool

Advances every scroll region by dt, and returns true if any is still moving.

Two motions live here, and they are not the same thing:

  • a fling, when the finger let go with speed: the region’s physics built a simulation (ScrollBallistic), and we sample it. This is where the platform’s feel lives — spline deceleration that stops at the edge, or friction that hands over to a spring and bounces.
  • a glide to a target, for the discrete inputs (the wheel, a programmatic scroll): a spring eases the offset across to where it was asked to go.

A fling wins while it runs: it drives the offset directly and keeps the target in step, so the spring has nothing to pull against.

regions describes the scrollables of the last frame; default is the application’s physics, used by every region that did not ask for its own.

Source

pub fn scrollbar_fade_of(&self, id: WidgetId) -> ScrollbarFade

What id’s scrollbar looks like this frame. An area nothing has touched, or one rendered in isolation with no runtime behind it, answers a closed fade.

Source

pub fn fling_scroll( &mut self, area: Scrollable, physics: ScrollPhysics, velocity: (f32, f32), ) -> bool

Launches a fling on area from the release velocity (px/s, in scroll space), under physics. A release too slow to fling leaves any overscroll to be sprung back, and otherwise does nothing.

Source

pub fn sync_pages(&mut self, regions: &[Scrollable])

Acts on the page each paged view is asking for.

A request is honoured when it changes, never re-asserted: the widget is rebuilt every frame and carries the same number each time, so a view that obeyed it on every frame could not be swiped at all — the finger would move the offset and the next frame would put it straight back.

The first sighting of a region is its initial page, and arrives without an animation: an application opening on page 3 wants to be on page 3, not to watch it fly there.

Source

pub fn sync_visible(&mut self, regions: &[Scrollable])

Brings each region’s kept box into view when it has changed.

A tab bar wider than its window is what this is for: the application selects the eighth tab and the bar is still showing the first three, with nothing to say the selection went anywhere.

Acted on when the key changes, never re-asserted. The box moves as the region scrolls, so a region that chased the box itself would pin the strip in place and no finger could move it — the same trap Runtime::sync_pages avoids, and the same answer.

The first sighting arrives without an animation — a bar restored on its eighth tab wants to be on the eighth tab, not to watch it slide there — and the walk has already drawn that first frame at the same offset, so the jump is invisible. It is retained here all the same: without it the region would have no offset of its own, and the frame after would find nothing to keep it there.

Source

pub fn page_changes(&mut self, regions: &[Scrollable]) -> Vec<(WidgetId, usize)>

The paged views whose page on screen has just changed, and the page each now shows.

Reported as soon as the rounding tips — mid-drag, not once the spring has settled — because that is when a reader would say they are on the next page. A caller turns each into a message; the runtime holds no messages of its own.

A view appearing is not a page change: the first sighting of a region is recorded silently, whatever page it opens on. An application that opens on page 3 already knows it is on page 3, and being told so on the first frame would only invite it to answer.

Source

pub fn scroll_at_rest(&self, id: WidgetId) -> bool

Is region id still? Nothing is driving it: no finger, no fling, and no spring left to run.

The three writers of an offset, asked in one place. A caller that asked only two of them would call a region at rest in the middle of a fling.

Source

pub fn scroll_offset_within( &self, id: WidgetId, max: (f32, f32), ) -> Option<(f32, f32)>

Where region id is drawn, its content now reaching no further than max: the retained offset, brought inside [0, max] when nothing owns it. None when it has never been scrolled.

The walk reads this rather than the map because the content can shrink in the very frame being built — a row of labels at a smaller text size — and that frame should already show the content where it rests, as the reference corrects its position during layout. Runtime::keep_scroll_in_range retains the same answer afterwards. A finger, a fling or a glide keeps what it has: each of them owns the offset, and each already brings it home when it lets go.

Source

pub fn keep_scroll_in_range(&mut self, regions: &[Scrollable]) -> bool

Brings every region nobody owns back inside its content, and answers whether any had strayed.

An offset at rest can only be out of range because the content or the viewport changed under it: a drag, a fling and a glide all settle inside. Found on a phone in milestone 533 — a row of filters swiped to its end at a large text size stayed swiped once the text was small again and the row fitted, its first label cut at the left and empty room at the right.

Corrected at once rather than sprung, as the reference’s default physics does for a position that was in range and is not animating. The scrollbar is not summoned for it: nothing scrolled, the content changed.

Source

pub fn scroll_changes( &mut self, regions: &[Scrollable], grain: impl Fn(WidgetId) -> f32, ) -> Vec<(WidgetId, ScrollPosition)>

The scroll regions whose offset is worth reporting this frame, and where each is — the regions’ half of crate::Widget::on_scroll. grain answers crate::Widget::scroll_grain for a region; a caller turns each result into a message, the runtime holding none of its own.

Three rules, and each of them is a decision:

  • A region appearing is not a movement — as long as it appears where an application would assume it is. A region seen for the first time at rest at (0, 0) is recorded silently: telling an application on the first frame of every screen that its list is at the top would only invite it to answer, and it already knew. A region that appears somewhere else — restored, or opened at a box it was asked to keep in view — is reported, because that one is news.
  • A grain suppresses the reports in between, never the last one. While the region is moving, nothing under grain pixels from the last report is sent; the moment it comes to rest, a position different from the last reported one is sent whatever the distance. A coarse grain therefore costs frames, never accuracy.
  • The baseline is what was reported, not the previous frame. Measuring against the previous frame would let a slow drag creep the whole way down a list, a fraction of a grain at a time, without ever saying so.
Source

pub fn scroll_to(&mut self, area: &Scrollable, request: ScrollTo) -> bool

Moves region area where request asks. true when it was acted on.

A finger refuses it. An offset has one owner at a time, and while a hand is on the content that owner is the hand — a list that jumped out from under a finger because a timer fired would be the framework overruling the reader.

Source

pub fn record_edit( &mut self, id: WidgetId, before: EditSnapshot, kind: EditKind, since: f32, )

A finger takes hold of id: from now until Runtime::release_scroll, this region’s offset moves only when the finger says so. Any fling in flight is caught, since the finger has just overruled it. Records a change to field id, which was before, since seconds after the last one — see crate::UndoHistory::record for what counts as one step.

Source

pub fn close_edit_run(&mut self, id: WidgetId)

Ends the run in progress in field id: the caret moved, so what is typed next is a step of its own.

Source

pub fn undo_edit( &mut self, id: WidgetId, current: EditSnapshot, ) -> Option<EditSnapshot>

Steps field id back one change, current being where it is now. None when there is nothing to undo.

Source

pub fn redo_edit( &mut self, id: WidgetId, current: EditSnapshot, ) -> Option<EditSnapshot>

Steps field id forward again. None when nothing was undone.

Source

pub fn hold_scroll(&mut self, id: WidgetId)

A finger takes hold of the region id. A scroll offset has one owner at a time, so nothing else moves it until release_scroll; see scroll_held.

Source

pub fn release_scroll(&mut self, id: WidgetId)

The finger lets go: the offset is up for grabs again — a fling, a spring back from an overscroll, or nothing.

Source

pub fn refresh_pull(&mut self, id: WidgetId, overscroll: f32, extent: f32)

Feeds overscroll px of refused movement into the pull of the refresh area id, over a scrollable of extent px.

This is the same measurement the glow is fed — what apply_boundary_conditions refused — routed to a different consumer. Where a refresh area is listening, the glow on that edge stands down: two answers to one gesture would say the same thing twice.

Source

pub fn dismiss_drag( &mut self, id: WidgetId, delta: f32, extent: f32, axis: DismissAxis, )

Moves the dismissible id by delta px along its axis, over an item of extent px.

Source

pub fn dismiss_release( &mut self, id: WidgetId, velocity: f32, cross: f32, axis: DismissAxis, threshold: f32, ) -> Option<DismissDirection>

The finger lets go of the dismissible id. Returns the direction it is being dismissed in, or None when it slides back.

Source

pub fn dismiss_extent_factor(&self, id: WidgetId) -> Option<f32>

How much of a dismissed item’s box is left, while its gap closes. None = not collapsing, so the item keeps the size its style asks for.

Source

pub fn advance_dismiss( &mut self, items: &[Dismissable], dt: f32, ) -> (bool, Vec<(WidgetId, DismissDirection)>)

Advances every dismissible of the frame by dt. Returns (still animating, the items whose gap has just closed) — the second being what the shell turns into messages.

Source

pub fn sheet_size(&self, id: WidgetId, spec: &SheetSpec) -> f32

The height of the sheet id, as a share of its box: the retained one, or its initial one while nothing has moved it.

Source

pub fn sheet_drag( &mut self, id: WidgetId, spec: &SheetSpec, delta: f32, available: f32, )

Moves the sheet id by delta, a share of its box — held by the finger until Runtime::sheet_release.

Source

pub fn sheet_hold(&mut self, id: WidgetId)

A finger lands on the sheet id: a settle in progress stops where it is.

Source

pub fn sheet_release( &mut self, id: WidgetId, spec: &SheetSpec, available: f32, velocity: f32, list: Option<WidgetId>, )

The finger lets go of the sheet id at velocity px/s, positive growing it, over a box available px tall — from list, when the finger was on the list inside it, which is then handed whatever is left of a throw that reaches full height.

Source

pub fn sheet_to(&mut self, id: WidgetId, spec: &SheetSpec, to: &SheetTo) -> bool

Asks the sheet id for to — an application’s request, by way of Command::sheet. false when a finger is on it, which refuses it, as a finger refuses a scroll request.

Source

pub fn advance_sheets( &mut self, areas: &[SheetArea], dt: f32, ) -> (bool, Vec<WidgetId>)

Advances every sheet of the frame by dt. Returns (still moving, the sheets lowered to nothing on this frame) — the second being what the shell turns into messages. A throw that reached full height is kept for Runtime::take_sheet_handovers.

Source

pub fn take_sheet_handovers(&mut self) -> Vec<(WidgetId, f32)>

The throws that carried a sheet to full height since the last call: the list each goes on in, and the velocity to fling it at, in px/s growing its offset.

The sheet does not fling the list itself, because a fling is started under the list’s physics, and those are the application’s to choose.

Source

pub fn refresh_cancel(&mut self, id: WidgetId)

Calls off the pull of id without asking for anything — the list scrolled away from its top edge, or the gesture was cancelled.

Source

pub fn refresh_release(&mut self, id: WidgetId) -> bool

Ends the pull of id. Returns true when it was armed, and so when the application should be asked to refresh.

Source

pub fn advance_refresh(&mut self, areas: &[Refreshable], dt: f32) -> bool

Advances every refresh area of the frame by dt, reading each one’s current refreshing flag from areas, and drops those that have gone quiet. Returns true while any is still moving.

Source

pub fn glow_pull( &mut self, id: WidgetId, edge: GlowEdge, overscroll: f32, extent: f32, cross_offset: f32, cross_extent: f32, )

Tells the glow on one edge of id that a finger is dragging past it.

overscroll is the movement the physics refused — which is exactly the distance the user asked for and did not get, and so exactly what the glow is there to acknowledge.

Source

pub fn glow_absorb(&mut self, id: WidgetId, edge: GlowEdge, velocity: f32)

Tells the glow on one edge of id that a fling just landed on it.

Source

pub fn glow_scroll_end(&mut self, id: WidgetId)

Tells every glow of id that the gesture is over, so a held pull can fade.

Source

pub fn advance_glow(&mut self, dt: f32) -> bool

Advances every glow by dt, dropping those that have gone quiet. Returns true while any is still animating.

Source

pub fn ink_press(&mut self, id: WidgetId, origin: Point, size: Size)

A finger landed on the inked surface id, at origin in the surface’s own coordinates, on a box of size. Starts a splash.

Source

pub fn ink_confirm(&mut self, id: WidgetId)

The tap on id completed: its splash finishes growing and begins to fade.

Source

pub fn advance_ink(&mut self, dt: f32) -> bool

Advances every splash by dt, dropping those that have gone. Returns true while any is still moving.

A splash still waiting for a finger that is no longer down is cancelled here rather than left hanging. A release that lands on the widget confirms it first (the shell calls Runtime::ink_confirm before the next frame); anything else — the finger slid off, the widget was unmounted mid-press, a gesture was taken over by a scroll — leaves nothing to confirm it, and without this sweep the ink would sit there for the life of the application.

Source

pub fn stop_scroll_fling(&mut self, id: WidgetId) -> Option<ScrollBallistic>

Cancels any fling on id — a new gesture, a wheel notch or a programmatic scroll takes precedence over momentum from the last one.

Source

pub fn catch_scroll_fling( &mut self, id: WidgetId, physics: ScrollPhysics, ) -> (f32, f32)

Catches a fling under a new press: stops it, and returns the momentum the next release inherits from it, per axis, in px/s.

It is what makes repeated swipes accelerate on the platforms that do that; where they do not, ScrollPhysics::carried_momentum returns zero and this is simply a stop.

Source

pub fn advance_interactive( &mut self, viewports: &[(WidgetId, Rect)], dt: f32, ) -> bool

Advances the pan fling of the interactive viewports: each velocity moves the translation (decelerated by exponential friction) and is then clamped to its viewport — hitting an edge cancels the velocity on that axis. viewports supplies the viewport of each interactive viewer (from the current frame). Returns true if a fling is still running.

Source

pub fn advance_leaving(&mut self, dt: f32) -> bool

Fades out the opacity of outgoing subtrees; forgets those that have reached 0. Returns true if an exit is still running.

Trait Implementations§

Source§

impl Default for Runtime

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<Msg> IntoMsg<Msg> for Msg

Source§

fn defer(work: impl Fn() -> Msg + 'static) -> Msg

The message that stands for work’s result.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.