diff --git a/apps/client/src/widgets/collections/board/index.tsx b/apps/client/src/widgets/collections/board/index.tsx
index cc00b7b10..5c2c44603 100644
--- a/apps/client/src/widgets/collections/board/index.tsx
+++ b/apps/client/src/widgets/collections/board/index.tsx
@@ -13,6 +13,7 @@ import branchService from "../../../services/branches";
import { openColumnContextMenu, openNoteContextMenu } from "./context_menu";
import { ContextMenuEvent } from "../../../menus/context_menu";
import { createContext } from "preact";
+import { onWheelHorizontalScroll } from "../../widget_utils";
export interface BoardViewData {
columns?: BoardColumnData[];
@@ -79,7 +80,6 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
saveConfig(newViewConfig);
setColumns(newColumns);
- console.log("New columns are ", newColumns);
setDraggedColumn(null);
setColumnDropPosition(null);
}, [columns, viewConfig, saveConfig]);
@@ -136,7 +136,10 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC
}, [draggedColumn, columnDropPosition, handleColumnDrop]);
return (
-
+
{
super(args, "board");
this.$root = $(TPL);
- setupHorizontalScrollViaWheel(this.$root);
this.$container = this.$root.find(".board-view-container");
this.spacedUpdate = new SpacedUpdate(() => this.onSave(), 5_000);
this.persistentData = {
diff --git a/apps/client/src/widgets/widget_utils.ts b/apps/client/src/widgets/widget_utils.ts
index f27fe6814..ba48a38df 100644
--- a/apps/client/src/widgets/widget_utils.ts
+++ b/apps/client/src/widgets/widget_utils.ts
@@ -7,12 +7,15 @@ import utils from "../services/utils.js";
*/
export function setupHorizontalScrollViaWheel($container: JQuery) {
$container.on("wheel", (event) => {
- const wheelEvent = event.originalEvent as WheelEvent;
- if (utils.isCtrlKey(event) || event.altKey || event.shiftKey) {
- return;
- }
- event.preventDefault();
- event.stopImmediatePropagation();
- event.currentTarget.scrollLeft += wheelEvent.deltaY + wheelEvent.deltaX;
+ onWheelHorizontalScroll(event.originalEvent as WheelEvent);
});
}
+
+export function onWheelHorizontalScroll(event: WheelEvent) {
+ if (!event.currentTarget || utils.isCtrlKey(event) || event.altKey || event.shiftKey) {
+ return;
+ }
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ (event.currentTarget as HTMLElement).scrollLeft += event.deltaY + event.deltaX;
+}