Ease divider snap into place over ~100ms

After releasing a divider, the boundary now eases (cubic ease-out, ~100ms) from
where the finger lifted to the snapped fraction instead of jumping. Starting a
new drag cancels an in-flight ease; membership changes still apply instantly.
This commit is contained in:
Skyler Lehmkuhl
2026-06-30 01:39:53 -04:00
parent 3b39e80e40
commit 01fe14f197
2 changed files with 57 additions and 12 deletions
@@ -118,6 +118,15 @@ pub struct StackDrag {
pub offset: f32,
}
/// A short ease of the visible pane weights toward their snapped values after a divider release.
#[derive(Debug, Clone, Copy)]
pub struct SnapAnim {
pub from: [f32; 3],
pub to: [f32; 3],
/// egui time (seconds) when the animation started.
pub start: f64,
}
/// Persistent mobile-shell state, cached on `EditorApp`.
pub struct MobileState {
/// Index into `STACK` of the topmost visible pane.
@@ -131,6 +140,8 @@ pub struct MobileState {
pub show_instruments: bool,
/// Active handle drag (transient).
pub drag: Option<StackDrag>,
/// In-flight snap ease after a divider release (transient).
pub snap_anim: Option<SnapAnim>,
}
impl Default for MobileState {
@@ -142,6 +153,7 @@ impl Default for MobileState {
weights: [1.0, 1.0, 1.0],
show_instruments: false,
drag: None,
snap_anim: None,
}
}
}