euv_ui/component/resizable/view/struct.rs
1use super::*;
2
3/// Props for the [`euv_resizable_panel_group`] component.
4///
5/// The group carries the direction its panels are laid out in.
6#[derive(Clone, CustomDebug, Default)]
7pub struct EuvResizablePanelGroupProps {
8 /// The direction the panels are laid out in.
9 pub direction: EuvResizableDirection,
10}
11
12/// Props for the [`euv_resizable_panel`] component.
13///
14/// The panel carries the share of the group it takes. The handle beside
15/// it writes that same share, so a drag moves the panel.
16#[derive(Clone, CustomDebug, Default)]
17pub struct EuvResizablePanelProps {
18 /// The share of the group the panel takes, in percent.
19 pub size: Signal<f64>,
20}
21
22/// Props for the [`euv_resizable_handle`] component.
23///
24/// The handle carries the share it moves, the bounds the share may
25/// move within, and the direction of the group it belongs to.
26#[derive(Clone, CustomDebug, Default)]
27pub struct EuvResizableHandleProps {
28 /// The share of the group the panel takes, in percent.
29 pub size: Signal<f64>,
30 /// The smallest share the panel may take, in percent.
31 pub min: f64,
32 /// The largest share the panel may take, in percent.
33 pub max: f64,
34 /// The direction of the group the handle belongs to.
35 pub direction: EuvResizableDirection,
36}
37
38/// The live state of one resizable drag.
39///
40/// The `mousemove` and `mouseup` handlers live here so they can be
41/// taken off the document when the drag ends; dropping the session
42/// drops both closures with it.
43///
44/// The handlers are browser-only: a host build has no pointer to
45/// follow, so the session is an empty shell there.
46pub(crate) struct ResizableDragSession {
47 /// The handler that follows the pointer.
48 #[cfg(target_arch = "wasm32")]
49 pub(crate) on_move: Closure<dyn FnMut(Event)>,
50 /// The handler that ends the drag.
51 #[cfg(target_arch = "wasm32")]
52 pub(crate) on_up: Closure<dyn FnMut(Event)>,
53}