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

scrubbing below 0 with clipped values still decrements the internal counter #6299

Closed
maltenuhn opened this issue Sep 3, 2024 · 0 comments · Fixed by #6331
Closed

scrubbing below 0 with clipped values still decrements the internal counter #6299

maltenuhn opened this issue Sep 3, 2024 · 0 comments · Fixed by #6331
Assignees

Comments

@maltenuhn
Copy link
Member

maltenuhn commented Sep 3, 2024

Problem
the new scrubbing algo will clip the resulting value (eg opacity can't go below 0), but the internal variable tracking the distance travelled still continues to decrease when you move the pointer further left, meaning you need to travel an indeterminate (because of OS pointer acceleration algo) distance to the right before you hit 0 again. This is annoying if you're trying to set eg a low, but not zero, value.

The same probably true with clipped upper bounds.

Solution
The internal variable tracking the distance should not decrement further if the clipping of the target variable has been triggered on either side (but the mouse pointer should still be allowed to move.

Example: initial value is opacity: 50%. Drag to the left, value decreases to 10%, then 0%. Keep dragging a few hundred pixels further to the left, value stays (clipped) at 0%. Now change direction and drag a few pixels to the right. Expected: the value increases immediately-ish after the direction change.

@liady liady self-assigned this Sep 6, 2024
liady added a commit that referenced this issue Sep 6, 2024
#6331)

**Problem:**
Today when scrubbing the value on mouse movement we still keep track of
the original movement delta, causing an issue where it's hard to return
after passing the thresholds

<video
src="https://github.com/user-attachments/assets/4298be75-4449-45dd-a961-df89094300d7"></video>

**Fix:**
Keep track of the clamped mouse movement as well. This required adding a
way to invert our `calculateDragDelta` function, in order to retrieve
the "clamped" mouse movements after clamping the total value.

<video
src="https://github.com/user-attachments/assets/d7005f59-b12b-46d8-9a3d-9fad3961e717"></video>

**Manual Tests:**
I hereby swear that:

- [X] I opened a hydrogen project and it loaded
- [X] I could navigate to various routes in Preview mode

Fixes #6299
liady added a commit that referenced this issue Dec 13, 2024
#6331)

**Problem:**
Today when scrubbing the value on mouse movement we still keep track of
the original movement delta, causing an issue where it's hard to return
after passing the thresholds

<video
src="https://github.com/user-attachments/assets/4298be75-4449-45dd-a961-df89094300d7"></video>

**Fix:**
Keep track of the clamped mouse movement as well. This required adding a
way to invert our `calculateDragDelta` function, in order to retrieve
the "clamped" mouse movements after clamping the total value.

<video
src="https://github.com/user-attachments/assets/d7005f59-b12b-46d8-9a3d-9fad3961e717"></video>

**Manual Tests:**
I hereby swear that:

- [X] I opened a hydrogen project and it loaded
- [X] I could navigate to various routes in Preview mode

Fixes #6299
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 a pull request may close this issue.

2 participants