euv_ui/component/splitter/view/struct.rs
1use super::*;
2
3/// Props for the [`euv_splitter`] component.
4///
5/// Defines the strongly-typed interface for a resizable split view: how
6/// much of the space the first pane takes, and the bounds the drag may
7/// move it within.
8#[derive(Clone, CustomDebug, Default)]
9pub struct EuvSplitterProps {
10 /// The share of the width the first pane takes, in percent.
11 ///
12 /// The caller owns the value, so the size survives re-renders and
13 /// can be seeded from a stored preference.
14 pub size: Signal<f64>,
15 /// The smallest share the first pane may take, in percent.
16 pub min: f64,
17 /// The largest share the first pane may take, in percent.
18 pub max: f64,
19}
20
21/// The live state of one splitter drag.
22///
23/// The `mousemove` and `mouseup` handlers live here so they can be
24/// taken off the document when the drag ends; dropping the session
25/// drops both closures with it.
26///
27/// The handlers are browser-only: a host build has no pointer to
28/// follow, so the session is an empty shell there.
29pub(crate) struct DragSession {
30 /// The handler that follows the pointer.
31 #[cfg(target_arch = "wasm32")]
32 pub(crate) on_move: Closure<dyn FnMut(Event)>,
33 /// The handler that ends the drag.
34 #[cfg(target_arch = "wasm32")]
35 pub(crate) on_up: Closure<dyn FnMut(Event)>,
36}