Skip to content

Build your personal knowledge base with Trilium Notes

client/ui/sortable card: make the edge scrolling slower

Adorian Doran0bdcaafbe822
diff --git a/apps/client/src/widgets/react/SortableCard.tsx b/apps/client/src/widgets/react/SortableCard.tsx
index 122f533320..0563249c65 100644
--- a/apps/client/src/widgets/react/SortableCard.tsx
+++ b/apps/client/src/widgets/react/SortableCard.tsx
@@ -33,6 +33,13 @@ const TOUCH_SLACK_PX = 8;
const SCROLL_MARGIN = 60;
const TOUCH_SCROLL_MARGIN = 100;
+/**
+ * How fast the card scrolls with the pointer at the very edge, in pixels a second. Slower than the
+ * edge scroller's default: a card's segments are short, so the whole list passes by in a few
+ * hundred pixels.
+ */
+const SCROLL_SPEED = 600;
+
/**
* Elements that handle a press themselves, so a press starting on one never drags the segment.
* `renderItem` can draw anything, so ARIA roles and `contenteditable` count as well as the native
@@ -132,6 +139,7 @@ export function SortableCard<T extends SortableItem>({
margin: matchMedia("(pointer: coarse)").matches
? TOUCH_SCROLL_MARGIN
: SCROLL_MARGIN,
+ speed: SCROLL_SPEED,
reach: () => reachRef.current,
// The pointer has not moved, but the content under it has.
onScroll: () => dragToRef.current(pointerRef.current.y)