refactor(ui-egui): move motion.rs into platform/

This commit is contained in:
aiongg
2026-10-27 00:34:32 +00:00
parent 6638646314
commit d3cfadd9e2
4 changed files with 4 additions and 5 deletions
+1 -1
View File
@@ -48,7 +48,6 @@ pub mod folders_ui;
mod home;
pub mod last_session;
pub mod last_view;
pub mod motion;
mod panels;
#[cfg(not(target_arch = "wasm32"))]
mod pickers;
@@ -125,6 +124,7 @@ use platform::drag_pointer;
pub use platform::file_watch;
#[cfg(target_os = "macos")]
use platform::macos_association;
pub use platform::motion;
#[cfg(test)]
use state::CopyPage;
#[cfg(not(target_arch = "wasm32"))]
+1
View File
@@ -3,3 +3,4 @@ pub(super) mod drag_pointer;
pub mod file_watch;
#[cfg(target_os = "macos")]
pub(super) mod macos_association;
pub mod motion;
@@ -46,8 +46,7 @@ fn a_touch_gesture_keeps_its_modifiers_and_ends_clean() {
let options = egui::InputOptions::default();
let point = |dy: f32, phase, modifiers| wheel(MouseWheelUnit::Point, vec2(0.0, dy), phase, modifiers);
// ⌘ held as the fingers land, let go before the momentum: still zooming.
let began =
reader.read(&[point(0.0, TouchPhase::Start, Modifiers::COMMAND), point(20.0, TouchPhase::Move, Modifiers::COMMAND)], 600.0, &options);
let began = reader.read(&[point(0.0, TouchPhase::Start, Modifiers::COMMAND), point(20.0, TouchPhase::Move, Modifiers::COMMAND)], 600.0, &options);
assert!(began.zoom > 1.0 && began.scroll == Vec2::ZERO, "{began:?}");
let momentum = reader.read(&[point(20.0, TouchPhase::Move, Modifiers::NONE)], 600.0, &options);
assert!(momentum.zoom > 1.0 && momentum.scroll == Vec2::ZERO, "{momentum:?}");
@@ -204,8 +203,7 @@ fn the_preference_overrides_the_system_for_every_animation() {
let ctx = egui::Context::default();
let mut motion = Motion::default();
let mut time = 0.0;
for (effects, times) in [(Off, (0.0, ScrollAnimation::none())), (System, egui_times), (Off, (0.0, ScrollAnimation::none())), (On, egui_times)]
{
for (effects, times) in [(Off, (0.0, ScrollAnimation::none())), (System, egui_times), (Off, (0.0, ScrollAnimation::none())), (On, egui_times)] {
pass(&ctx, &mut time, Vec::new(), |ctx| motion.begin_pass(ctx, effects));
let style = ctx.global_style();
assert_eq!((style.animation_time, style.scroll_animation), times, "{effects:?}");