mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 20:45:00 -05:00
Dragging empty space to scroll already worked on the board Swimlanes view but not on these pages. The dragscroll library scrolls whichever element carries the `dragscroll` class, and that element must be the actual scroll container. On All Boards, My Cards, Login and Register the page scroll container is `<body>` (the previous `dragscroll` class on `ul.board-list` only scrolled in mobile view), so a small shared helper (`client/lib/pageDragscroll.js`) now toggles the `dragscroll` class on `<body>` while those templates are mounted and calls `dragscroll.reset()`; the library has a dedicated `el == document.body` branch for whole-page scrolling. In the board Lists view the `.board-canvas` only received `dragscroll` when the board had swimlanes, so vertical drag-scroll failed on swimlane-less boards; the canvas now always carries the class. One-finger touch scrolling (client/lib/dragscrollTouch.js) covers these too. Thanks to xet7 and Claude.
28 lines
1.2 KiB
JavaScript
28 lines
1.2 KiB
JavaScript
import dragscroll from '@wekanteam/dragscroll';
|
|
import '/client/lib/dragscrollTouch';
|
|
|
|
// Enable / disable mouse drag-to-scroll for whole-page layouts.
|
|
//
|
|
// On pages like All Boards, Login and Register the scroll container is the
|
|
// <body> element itself (it has `overflow-y: auto; height: 100vh`), not an
|
|
// inner board canvas or swimlane. The dragscroll library scrolls whichever
|
|
// element carries the `dragscroll` class and has a dedicated `el ==
|
|
// document.body` branch that also scrolls document.documentElement, so tagging
|
|
// <body> makes dragging empty page space scroll the page — the same gesture
|
|
// that already works on the board swimlanes view.
|
|
//
|
|
// The class is toggled per template (onRendered / onDestroyed) so it only
|
|
// applies on those pages; dragscroll.reset() re-scans the DOM and (re)binds the
|
|
// mouse listeners after the class is added or removed. Touch (one-finger)
|
|
// scrolling is handled separately by client/lib/dragscrollTouch.js.
|
|
|
|
export function enablePageDragscroll() {
|
|
document.body.classList.add('dragscroll');
|
|
dragscroll.reset();
|
|
}
|
|
|
|
export function disablePageDragscroll() {
|
|
document.body.classList.remove('dragscroll');
|
|
dragscroll.reset();
|
|
}
|