From 6b0ae543523fcc4aa3e96b1d3c2ad91ccba739be Mon Sep 17 00:00:00 2001 From: tdgao Date: Wed, 26 Aug 2026 17:27:50 -0600 Subject: [PATCH] fix: grab cursor when nothing to drag --- .../ui/moderation/ModerationProjectNags.vue | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/frontend/src/components/ui/moderation/ModerationProjectNags.vue b/apps/frontend/src/components/ui/moderation/ModerationProjectNags.vue index 20723d3046..cb5a0452dd 100644 --- a/apps/frontend/src/components/ui/moderation/ModerationProjectNags.vue +++ b/apps/frontend/src/components/ui/moderation/ModerationProjectNags.vue @@ -43,8 +43,11 @@ />
props.project.status === 'processing') const nagScroller = ref(null) +const canScrollNags = ref(false) const showLeftNagShadow = ref(false) const showRightNagShadow = ref(false) const draggingNags = ref(false) @@ -224,13 +228,16 @@ let suppressNagClickTimeout: ReturnType | null = null function updateNagScrollShadows() { const el = nagScroller.value if (!el) { + canScrollNags.value = false showLeftNagShadow.value = false showRightNagShadow.value = false return } - showLeftNagShadow.value = el.scrollLeft > 0 - showRightNagShadow.value = el.scrollLeft < el.scrollWidth - el.clientWidth - 1 + canScrollNags.value = el.scrollWidth > el.clientWidth + 1 + showLeftNagShadow.value = canScrollNags.value && el.scrollLeft > 0 + showRightNagShadow.value = + canScrollNags.value && el.scrollLeft < el.scrollWidth - el.clientWidth - 1 } function onNagWheel(event: WheelEvent) { @@ -244,7 +251,13 @@ function onNagWheel(event: WheelEvent) { function onNagPointerDown(event: PointerEvent) { const el = nagScroller.value - if (!el || event.pointerType === 'touch' || event.button !== 0) return + if ( + !el || + el.scrollWidth <= el.clientWidth + 1 || + event.pointerType === 'touch' || + event.button !== 0 + ) + return nagDragPointerId = event.pointerId nagDragStartX = event.clientX