Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Calendar: the hours scroll only toward where an event is carried

Yashwanth Kamireddi70a9406dbc18
diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsx
index e02a24b..083ddf2 100644
--- a/src/screens/calendar/CalendarView.tsx
+++ b/src/screens/calendar/CalendarView.tsx
@@ -2509,8 +2509,12 @@ const TimeGrid = memo(function TimeGrid({
const el = scroller.current;
if (!el || !last || !dragRef.current || dragRef.current.kind === "days") return;
const r = el.getBoundingClientRect();
- const ZONE_PX = 32;
- const into = last.y < r.top + ZONE_PX ? last.y - (r.top + ZONE_PX) : last.y > r.bottom - ZONE_PX ? last.y - (r.bottom - ZONE_PX) : 0;
+ const ZONE_PX = 28;
+ // Toward the edge it was carried to, never the other way: an event taken near the top
+ // and carried across to another day stays at its hour.
+ const up = first && last.y < first.y - 8;
+ const down = first && last.y > first.y + 8;
+ const into = up && last.y < r.top + ZONE_PX ? last.y - (r.top + ZONE_PX) : down && last.y > r.bottom - ZONE_PX ? last.y - (r.bottom - ZONE_PX) : 0;
if (!into) return;
const before = el.scrollTop;
el.scrollTop += Math.max(-16, Math.min(16, into / 2));