pub const SUB_PANE_HIT_TOLERANCE: f64 = 6.0;
pub const SUB_PANE_MIN_SIZE_DRAG: f64 = 80.0;
pub const SUB_PANE_MIN_SIZE_LAYOUT: f64 = 30.0;
pub const SPLIT_PANEL_THICKNESS_IDLE: f64 = 2.0;
pub const SPLIT_PANEL_THICKNESS_HOVER_DRAG: f64 = 4.0;
pub const SPLIT_PANEL_HIT_ZONE: f64 = 8.0;
pub const SIDEBAR_VISUAL_THICKNESS: f64 = 1.0;
pub const SIDEBAR_HIT_ZONE: f64 = 8.0;
pub const SIDEBAR_MIN_WIDTH: f64 = 280.0;
pub trait SeparatorStyle {
fn thickness(&self) -> f64;
fn margin(&self) -> f64;
fn handle_hit_thickness(&self) -> f64;
}
pub struct DefaultSeparatorStyle;
impl Default for DefaultSeparatorStyle {
fn default() -> Self {
Self
}
}
impl SeparatorStyle for DefaultSeparatorStyle {
fn thickness(&self) -> f64 {
1.0
}
fn margin(&self) -> f64 {
0.0
}
fn handle_hit_thickness(&self) -> f64 {
6.0
}
}
pub struct SubPaneSeparatorStyle;
impl Default for SubPaneSeparatorStyle {
fn default() -> Self {
Self
}
}
impl SeparatorStyle for SubPaneSeparatorStyle {
fn thickness(&self) -> f64 {
1.0
}
fn margin(&self) -> f64 {
0.0
}
fn handle_hit_thickness(&self) -> f64 {
SUB_PANE_HIT_TOLERANCE * 2.0
}
}
impl SubPaneSeparatorStyle {
pub fn min_size_drag(&self) -> f64 {
SUB_PANE_MIN_SIZE_DRAG
}
pub fn min_size_layout(&self) -> f64 {
SUB_PANE_MIN_SIZE_LAYOUT
}
}
pub struct SplitPanelSeparatorStyle {
pub active: bool,
}
impl Default for SplitPanelSeparatorStyle {
fn default() -> Self {
Self { active: false }
}
}
impl SeparatorStyle for SplitPanelSeparatorStyle {
fn thickness(&self) -> f64 {
if self.active {
SPLIT_PANEL_THICKNESS_HOVER_DRAG
} else {
SPLIT_PANEL_THICKNESS_IDLE
}
}
fn margin(&self) -> f64 {
0.0
}
fn handle_hit_thickness(&self) -> f64 {
SPLIT_PANEL_HIT_ZONE
}
}
pub struct SidebarSeparatorStyle;
impl Default for SidebarSeparatorStyle {
fn default() -> Self {
Self
}
}
impl SeparatorStyle for SidebarSeparatorStyle {
fn thickness(&self) -> f64 {
SIDEBAR_VISUAL_THICKNESS
}
fn margin(&self) -> f64 {
0.0
}
fn handle_hit_thickness(&self) -> f64 {
SIDEBAR_HIT_ZONE
}
}
impl SidebarSeparatorStyle {
pub fn min_size_drag(&self) -> f64 {
SIDEBAR_MIN_WIDTH
}
}
pub struct ModalSectionDividerStyle;
impl Default for ModalSectionDividerStyle {
fn default() -> Self {
Self
}
}
impl SeparatorStyle for ModalSectionDividerStyle {
fn thickness(&self) -> f64 {
1.0
}
fn margin(&self) -> f64 {
0.0
}
fn handle_hit_thickness(&self) -> f64 {
0.0
}
}