Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Feat: Auto scroll when dragging #262

Conversation

that-one-arab
Copy link
Contributor

@that-one-arab that-one-arab commented Feb 17, 2025

Description

Closes issue

This PR implements an auto scroll feature to auto scroll the user when they drag an event to the bottom or top edge of the main grid area.

It handled refactoring parts of the code along the way, mainly removing gridScrollRef to simplify the code.

It also handled fixing a bug caused by an edge case that was always present, but became more apparent with this new feature. The bug is: when dragging an event to the very bottom of the screen, you can place the event in a way that the end date would overflow outside the bottom edge of the main grid area container. Details in below video:

Summary:

  • Feature: Implement auto scroll when user drags an event to the bottom/top of the main grid
  • Chore: Remove gridScrollRef
  • handle edge case with dragging an event to very bottom of the page

Introduces known bugs: #267 #266

Videos

Before

auto_scroll_event_overflow_jittering_before.webm
auto_scroll_before.webm

After

auto_scroll_event_overflow_jittering_after.webm
auto_scroll_after.webm

- Remove `gridScrollRef` and replace with `mainGridRef`. Having `gridScrollRef` as a separate entity and having `mainGridRef` as a callback function that is not a ref and does not return a ref did not makes sense to me. I believe this change makes the code simpler and more readable.
- Remove unused `react-merge-refs` dependency as a consequence of above change
- Handle few TS errors
@that-one-arab that-one-arab force-pushed the feature_smart_scroll_when_dragging branch from 5790944 to 44abdea Compare February 18, 2025 16:44
…he page, causing event to overflow past container. Refactor code

this occurs when we drag an event to the very bottom until the event's end time is past midnight, instead of preventing me from dragging the event past midnight, the event overflows past its container.
@that-one-arab that-one-arab force-pushed the feature_smart_scroll_when_dragging branch from ea3ff50 to c80757d Compare February 19, 2025 05:38
@that-one-arab that-one-arab changed the title WIP: Smart scroll when dragging Auto scroll when dragging Feb 20, 2025
@that-one-arab that-one-arab marked this pull request as ready for review February 20, 2025 04:35
@tyler-dane tyler-dane changed the title Auto scroll when dragging ✨ Auto scroll when dragging Feb 20, 2025
@tyler-dane tyler-dane changed the title ✨ Auto scroll when dragging ✨ Feat: Auto scroll when dragging Feb 20, 2025
without this, the main grid would screen when dragging an all-day event
@tyler-dane tyler-dane merged commit 6a356e0 into SwitchbackTech:main Feb 20, 2025
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.

Scroll up/down when dragging grid event
2 participants