pub struct EngineControl { /* private fields */ }Expand description
A cheap, cloneable handle for sending input to the engine from any thread.
Implementations§
Source§impl EngineControl
impl EngineControl
Sourcepub fn dispatch_event(
&self,
id: NodeId,
event: EventKind,
payload: EventPayload,
)
pub fn dispatch_event( &self, id: NodeId, event: EventKind, payload: EventPayload, )
Delivers an input event (and its data) to a node.
Sourcepub fn scroll(&self, id: NodeId, x: f32, y: f32, applied: u32)
pub fn scroll(&self, id: NodeId, x: f32, y: f32, applied: u32)
Reports the content offset of a scroll view or list, and how many
scrolls the core asked for (MountItem::ScrollBy items and
Command::ScrollTo commands for the view) were applied before it.
Cheap to call on every scroll frame: offsets are coalesced per
engine frame.
Sourcepub fn zoom(&self, id: NodeId, scale: f32)
pub fn zoom(&self, id: NodeId, scale: f32)
Reports the zoom scale of a zoomable scroll view (before the offset
the zoom changed); onScroll carries it.
Sourcepub fn set_component_size(&self, id: NodeId, size: Size)
pub fn set_component_size(&self, id: NodeId, size: Size)
A registered native component’s own size (points): it is laid out at it where its style leaves a dimension open.
Sourcepub fn animations_finished(&self, finished: Vec<Finished>)
pub fn animations_finished(&self, finished: Vec<Finished>)
Reports native animations that finished or were interrupted.
Sourcepub fn set_environment(&self, environment: Environment)
pub fn set_environment(&self, environment: Environment)
Reports a change of the surface’s environment (safe area, keyboard, appearance…).
Sourcepub fn set_root_size(&self, id: NodeId, size: Size, insets: EdgeInsets)
pub fn set_root_size(&self, id: NodeId, size: Size, insets: EdgeInsets)
The platform presents root id (a modal) at size, with insets
of it covered by system UI.
Sourcepub fn set_screen_header(&self, id: NodeId, height: Option<f32>)
pub fn set_screen_header(&self, id: NodeId, height: Option<f32>)
The platform measured where the content of screen id starts below
its header (None: let the core estimate it).
Sourcepub fn hot_update(&self, update: HotUpdate)
pub fn hot_update(&self, update: HotUpdate)
Applies a development update in place. When it cannot be applied,
MountSink::hot_update_failed asks the platform to reload.
Sourcepub fn frame(&self)
pub fn frame(&self)
A display frame began, after MountSink::request_frame: runs the
requestAnimationFrame callbacks and the tasks waiting for it.
Sourcepub fn set_states(&self, id: NodeId, states: u8)
pub fn set_states(&self, id: NodeId, states: u8)
Reports the interaction states of view id that the core asked to
track (nsh_core::MountItem::TrackStates; bits of
nsh_core::tailwind::state). Class styles that depend on them
(active:, hover:, focus:) update without JS.
Sourcepub fn set_perf_monitor(&self, monitor: Option<Arc<PerfMonitor>>)
pub fn set_perf_monitor(&self, monitor: Option<Arc<PerfMonitor>>)
Records the engine’s commits into monitor from now on (None:
stops). Measuring costs nothing while no monitor is installed.
Sourcepub fn set_theme(&self, theme: Option<Theme>)
pub fn set_theme(&self, theme: Option<Theme>)
Sets the embedding app’s theme, which the UI sets’ components
render with instead of the app’s own (None: the app’s again;
Core::set_host_theme). Sent from Engine::start_with’s
setup, it is in the first frame.