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

Improve rotate experience when close to center #5104

Merged
merged 10 commits into from
Nov 27, 2024
Merged

Conversation

HarelM
Copy link
Collaborator

@HarelM HarelM commented Nov 24, 2024

Launch Checklist

This is a continue of the following PR, where a comment mention that the experience around the center it not great.

I have reverted to experience around the center to be as it was before my change.
Up until 100 pixels from the center.
Simplified the navigation control to use a single handler.

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Add an entry to CHANGELOG.md under the ## main section.

Copy link

codecov bot commented Nov 24, 2024

Codecov Report

Attention: Patch coverage is 98.73418% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.81%. Comparing base (662700d) to head (27a21da).
Report is 2 commits behind head on main.

❌ We are unable to process any of the uploaded JUnit XML files. Please ensure your files are in the right format.

Files with missing lines Patch % Lines
src/ui/handler/drag_move_state_manager.ts 96.15% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5104      +/-   ##
==========================================
- Coverage   91.81%   91.81%   -0.01%     
==========================================
  Files         279      278       -1     
  Lines       38347    38318      -29     
  Branches     6702     6703       +1     
==========================================
- Hits        35209    35181      -28     
+ Misses       3006     3004       -2     
- Partials      132      133       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HarelM HarelM mentioned this pull request Nov 24, 2024
6 tasks
Copy link
Collaborator

@kubapelc kubapelc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works much better around the center!

I'm still not a fan of this control scheme as a whole though, I can't intuitively predict how will mouse movements translate to map rotation, even after playing with the map for a while and reading about how the new rotation controls work.

@HarelM
Copy link
Collaborator Author

HarelM commented Nov 25, 2024

I think only you and I have rotated the map on the desktop and are aware of this issue :-) otherwise I would've expected other people to complain about the behavior...
Thanks for the review!

@HarelM
Copy link
Collaborator Author

HarelM commented Nov 25, 2024

I see now that coverage is a bit lacking, I'll see if I can solve that.

@HarelM
Copy link
Collaborator Author

HarelM commented Nov 26, 2024

@kubapelc let me know if you want to review this again, I've changed the navigation control heavily...

Copy link
Collaborator

@ibesora ibesora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @kubapelc that the handling is not great via mouse because you don't get an intuition of what will happen but this is an improvement over what we have currently.

Added a couple of minor comments but approving either way

@@ -84,7 +84,7 @@ describe('NavigationControl', () => {
const navRect = navButton.getClientRects();

const buttonX = (navRect.x ?? 0) + (navRect.width ?? 0) / 2;
const buttonY = (navRect.y ?? 0) + (navRect.height ?? 0) / 2;
const buttonY = (navRect.y ?? 0) + (navRect.height ?? 0) / 2 - 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this -1 doing here?
Can we add a comment so it's clear what it's doing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of dragging from the exact center of the button where it won't change the rotation I moved the drag to be one pixel lower.

@@ -168,7 +168,7 @@ describe('NavigationControl', () => {
const navRect = navButton.getClientRects();

const buttonX = (navRect.x ?? 0) + (navRect.width ?? 0) / 2;
const buttonY = (navRect.y ?? 0) + (navRect.height ?? 0) / 2;
const buttonY = (navRect.y ?? 0) + (navRect.height ?? 0) / 2 - 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

src/ui/handler/drag_move_state_manager.ts Show resolved Hide resolved
@HarelM HarelM enabled auto-merge (squash) November 27, 2024 11:36
@HarelM HarelM merged commit 985b657 into main Nov 27, 2024
17 checks passed
@HarelM HarelM deleted the improve-ux-for-rotation branch November 27, 2024 11:48
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.

3 participants