Skip to content

fix(drag-n-drop): account for zoomScale in vertical autoscroll#34

Draft
sgandhi-gg wants to merge 1 commit into
fix/now-line-debounce-delayfrom
fix/drag-autoscroll-zoom-scale
Draft

fix(drag-n-drop): account for zoomScale in vertical autoscroll#34
sgandhi-gg wants to merge 1 commit into
fix/now-line-debounce-delayfrom
fix/drag-autoscroll-zoom-scale

Conversation

@sgandhi-gg

Copy link
Copy Markdown
Collaborator

Summary

Stacked on top of #33.

The DragEventProvider auto-scroll-during-drag computes maxOffsetY from the unscaled timelineHeight, but the ScrollView's outer-spacer content height is timelineHeight * zoomScale (set in CalendarBody). At zoom > 1, downward auto-scroll clamps to the unzoomed bottom and stops roughly half-way through the visible content. The diffY → minutes conversion during auto-scroll also ignores zoomScale, so the dragged event's time shifts faster than the finger at higher zoom levels.

Changes

  • Destructure zoomScale from useCalendar() in DragEventProvider
  • maxOffsetY = timelineHeight.value * zoomScale.value - scrollVisibleHeightAnim.value
  • minutes = diffY / (minuteHeight.value * zoomScale.value) (matches the conversion already used in CalendarContainer.tsx)

Test plan

  • Pinch the calendar to 2x zoom
  • Long-press to start dragging an event
  • Drag toward the bottom edge — calendar auto-scrolls to the end of day (not stuck at the unzoomed bottom)
  • Drag toward the top edge — auto-scrolls correctly
  • During auto-scroll, the dragged event's time tracks the finger
  • At 1x zoom, behavior is unchanged

The auto-scroll-during-drag computed `maxOffsetY` from unscaled
`timelineHeight`, but the underlying ScrollView content height is
`timelineHeight * zoomScale` (set by CalendarBody's outer spacer).
At zoom > 1, downward auto-scroll clamped to the unzoomed bottom and
stopped roughly half-way through the visible content.

The minutes-per-pixel divisor used during auto-scroll also ignored
`zoomScale`, so the dragged event's time shifted faster than the
finger at higher zoom levels.

Pull `zoomScale` from `useCalendar()` and apply it to both
`maxOffsetY` and the `diffY → minutes` conversion (matching the
conversion already used elsewhere in CalendarContainer).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant