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

Fix horizontal scroll in editor's 2D view #85473

Merged

Conversation

miv391
Copy link
Contributor

@miv391 miv391 commented Nov 28, 2023

Fixes #77212

Some mouses (for example Logitech G502) have wheels with horizontal scrolling feature. A slight horizonal click of wheel will send WHEEL_RIGHT and WHEEL_LEFT messages. When using the wheel for zooming (by rotating it, WHEEL_UP/WHEEL_DOWN) and clicking the wheel (for panning) it is very easy to unintentionally to activate the horizontal scrolling.

Currently horizontal scrolling in editor's 2D view causes zooming. No other view (3D, code) works like this. 2D view is pretty much unusable with a mouse which has horizontal scrolling feature, you are almost constantly doing unintentional zooming while trying to pan the view. In Godot 3.5 horizontal scrolling does not cause zooming in 2D view.

This PR fixes this problem by using only vertical scrolling for zooming.

@miv391 miv391 requested a review from a team as a code owner November 28, 2023 14:43
@AThousandShips AThousandShips changed the title Fix horizontal mouse wheeling in editor's 2D view Fix horizontal scroll in editor's 2D view Nov 28, 2023
@AThousandShips AThousandShips added this to the 4.3 milestone Nov 28, 2023
@groud
Copy link
Member

groud commented Nov 28, 2023

Those are fair points. I simply hope no one use the thumb scrollwheel to zoom-in/out.
If we are ok with the change, the code looks technically good to me.

@KoBeWi
Copy link
Member

KoBeWi commented Nov 28, 2023

You need to add similar changes in line 49.

@miv391 miv391 force-pushed the fix-horizontal-mouse-wheeling-in-2d-view branch from 00dda71 to 2f98e38 Compare November 28, 2023 15:09
@miv391
Copy link
Contributor Author

miv391 commented Nov 28, 2023

You need to add similar changes in line 49.

Fixed.

@miv391 miv391 force-pushed the fix-horizontal-mouse-wheeling-in-2d-view branch from 2f98e38 to 187bb61 Compare November 28, 2023 15:36
Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

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

I don't have a device to test horizontal scrolling, but the code looks fine.

@YuriSizov YuriSizov merged commit 547374b into godotengine:master Dec 19, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Horizontal mouse wheel scrolling causes zooming in the 2D editor in 4.x (unlike 3.x)
5 participants