summaryrefslogtreecommitdiff
path: root/apps/web/src/components/editor/timeline/timeline-wheel-handler.tsx
diff options
context:
space:
mode:
authorMaze Winther <mazewinther@gmail.com>2025-07-17 13:38:16 +0200
committerMaze Winther <mazewinther@gmail.com>2025-07-17 13:38:16 +0200
commite577c9659f38eb9702f0c85a6bdcbc52d2720f2f (patch)
tree569f0314338f20c3bcfe11113bfcb6f274839d40 /apps/web/src/components/editor/timeline/timeline-wheel-handler.tsx
parent8efc696dcddc94b1c248a099207ad97c932a545b (diff)
parentb1efc90157c87e93de422c900de74a3538040eed (diff)
downloadopencut-e577c9659f38eb9702f0c85a6bdcbc52d2720f2f.tar.gz
Merge branch 'staging' of https://github.com/mazeincoding/AppCut into staging
Diffstat (limited to 'apps/web/src/components/editor/timeline/timeline-wheel-handler.tsx')
-rw-r--r--apps/web/src/components/editor/timeline/timeline-wheel-handler.tsx32
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/web/src/components/editor/timeline/timeline-wheel-handler.tsx b/apps/web/src/components/editor/timeline/timeline-wheel-handler.tsx
new file mode 100644
index 00000000..8036b96c
--- /dev/null
+++ b/apps/web/src/components/editor/timeline/timeline-wheel-handler.tsx
@@ -0,0 +1,32 @@
+import { useEffect } from "react";
+
+export interface TimelineWheelHandlerProps {
+ timelineRef: React.RefObject<HTMLDivElement>;
+ isInTimeline: boolean;
+ handleWheel: (e: React.WheelEvent) => void;
+}
+
+export function useTimelineWheelHandler({
+ timelineRef,
+ isInTimeline,
+ handleWheel,
+}: TimelineWheelHandlerProps) {
+ useEffect(() => {
+ const timelineContainer = timelineRef.current;
+ if (!timelineContainer || !isInTimeline) return;
+
+ const handleWheelCapture = (e: WheelEvent) => {
+ handleWheel(e as any);
+ };
+
+ timelineContainer.addEventListener("wheel", handleWheelCapture, {
+ passive: false,
+ });
+
+ return () => {
+ timelineContainer.removeEventListener("wheel", handleWheelCapture);
+ };
+ }, [handleWheel, isInTimeline, timelineRef]);
+
+ return null;
+}