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

Script editor doesn't track scrolling via Touchpad smoothly (or at all when scrolling is slow) #28149

Closed
ArdaE opened this issue Apr 18, 2019 · 12 comments · Fixed by #73502
Closed

Comments

@ArdaE
Copy link
Contributor

ArdaE commented Apr 18, 2019

Godot version:
3.1

OS/device including version:
macOS 10.13.6 (High Sierra)
MacBook Pro Retina (mid 2012)

Issue description:
Touchpad/trackpad two-finger scroll takes effort to scroll the text editor areas (script editor and the textual shader editor). All other views in Godot (including those that contain text, such as the FileSystem, Inspector, Node, and Scene tabs) all move very smoothly, instantly tracking the two-finger scroll on the touchpad. However, the script editor and the textual shader editor seem to wait for a certain amount of fast scroll before starting to scroll, which causes not only effort to get the scrolling going, but also causes these views to not scroll at all if the fingers are moved slowly. I can move my fingers from the top of the trackpad all the way to the bottom slowly without Godot scrolling the script a single line. Other views such as the Inspector track the finger movements immediately, even if the fingers are moved very slowly.

Steps to reproduce:
Try to scroll using multitouch on a MacBook touchpad/trackpad, using a slow motion of the fingers. Note that the script editor does not move at all unless you move your fingers fast, but then the scrolling is fast too.

P.S. This doesn't seem to be related to issue #11030, but issues #8953, #7884, and #7864 may be relevant, but they all treat smooth-scrolling as fixed, while there's clearly an issue with it in Godot 3.1.

@ArdaE ArdaE changed the title Script editor Touchpad scroll Script editor doesn't track scrolling via Touchpad smoothly (or at all when scrolling is slow) Apr 18, 2019
@ArdaE
Copy link
Contributor Author

ArdaE commented Apr 18, 2019

Horizontal scrolling works very smoothly in the views that have the problem. It's only the vertical scrolling that has the problem. If possible, the code that's used for horizontal scrolling should be replicated for vertical scrolling to fix the issue.

@jamie-pate
Copy link
Contributor

Related? #28369
Seems to be rounding the delta values down to 0 unless you scroll really fast.
Also happens in the game ui.

@Calinou
Copy link
Member

Calinou commented Apr 25, 2019

@jamie-pate If so, the cause also sounds similar to #28385.

@Calinou
Copy link
Member

Calinou commented Sep 1, 2021

Closing in favor of #49873.

@ArdaE
Copy link
Contributor Author

ArdaE commented Sep 4, 2021

Closing in favor of #49873.

@Calinou, I'm not sure if #49873 and this are the same issue. I don't have the problem that #49873 describes on MacBook at all. The 2D view and the visual script editor in the Godot editor, and ScrollContainer in exported apps all work perfectly smoothly for me, with no difference between horizontal and vertical scrolling (both axes moving very smoothly).

The issue I describe applies only to text editor views (the GDScript editor and the textual shader editor within Godot, and TextEdit control in exported apps). Further, the issue I experience isn't that the vertical axis moves fast, but rather that it doesn't move at all unless one moves their fingers fast on the touchpad. Any fast movement that occurs in my case is simply the result of the fast movement of the fingers that's required to get the scrolling going, which is very different than the discrete/large scroll steps that are visible in #49873's demo video.

In #49873, the issue seems to be that the vertical axis of the touchpad is somehow mapped to discrete, keystroke-like up/down key presses.

In this PR (#28149), the issue is that the vertical movement of the trackpad appears to be reset unless the movement is large enough within a certain time period. No vertical scrolling occurs at all if the fingers are moved somewhat slowly, regardless of how long I drag my fingers.

@Calinou
Copy link
Member

Calinou commented Sep 4, 2021

@ArdaE Can you reproduce this after disabling smooth scrolling in the Editor Settings? Also, does your project use a Physics FPS value above 60?

@ArdaE
Copy link
Contributor Author

ArdaE commented Sep 4, 2021

@ArdaE Can you reproduce this after disabling smooth scrolling in the Editor Settings?

Yes; it gets quite worse actually. When smooth scrolling is disabled, the speed needed to get the vertical scrolling going is even higher and scrolling is choppy once it gets going. When smooth scrolling is enabled, vertical scrolling is smooth once it starts.

Regardless of whether smooth scrolling is enabled or not, I never get the behaviour shown in #49873. All non-textual views always scroll very smoothly in both axes.

does your project use a Physics FPS value above 60?

Nope; Physics FPS is set to 60. The issue occurs both in the editor and in newly created projects with default settings. The scrolling difficulty of TextEdit in a running project seems to be the same no matter what I set Physics FPS to (1000 and 1 feel the same).


In case it might help, here's some extra information:

While dragging fingers on the touchpad below a certain speed doesn't result in any scrolling, the momentum that's created by the drag does result in a nice smooth residual vertical scroll once the fingers are lifted off the touchpad. So the speed that the touchpad reports once the fingers are lifted seems to be used correctly by Godot.

@Calinou Calinou reopened this Sep 4, 2021
@paxer
Copy link

paxer commented Dec 5, 2021

I can confirm the same issue

Godot 3.4.stable
macOS 12.0.1, Monterey
MBP 14 (late 2021)

@BoydWiglaf
Copy link

BoydWiglaf commented Mar 27, 2022

I am having the same issue. Scrolling works great everywhere except with editing scripts. It is an effort to scroll vertically and a lot of the time it will scroll horizontally when i am trying to scroll vertically.
Godot 3.4.2
macOS 12.3
MBA M1 2020

@NickMakesGames
Copy link

any news on this issue? I'm also experiencing it on a 2021 Macbook Pro with the M1 chip. Seeing it on both the latest Godot4 RC and the stable 3.5.1 release.

@Kurble
Copy link
Contributor

Kurble commented Feb 17, 2023

I've done some investigating as I'm having this problem as well, and I found that this issue occurs because of the scrolling step size that is set in text_edit.cpp:

if (total_rows > visible_rows) {
	v_scroll->show();
	v_scroll->set_max(total_rows + _get_visible_lines_offset());
	v_scroll->set_page(visible_rows + _get_visible_lines_offset());
	if (smooth_scroll_enabled) {
		v_scroll->set_step(0.25);
	} else {
		v_scroll->set_step(1.0);
	}
	set_v_scroll(get_v_scroll());

}

Any scroll event that would result in a scrolling distance smaller than this step size is ignored. This is especially noticeable on macOS where scrolling events are reported for every frame, so that the rate of change in each event is very small. For godot to pickup on trackpad scrolling events you have to scroll pretty fast to get above the threshold! It's even worse when you turn smooth scrolling off, as the threshold is then 4 times as high. Even when using a normal mouse with scroll wheel, the first few scroll events are ignored, as macOS annoyingly applies an acceleration curve to the mouse wheel events.

Changing the step size to 0 for both code paths fixes all scrolling issues for me, but I assume that this behavior is desired by at least some people.

Other possible fixes include:

  • Setting the step size to 0 for macOS only;
  • Keep track of small changes until they accumulate enough to pass the threshold;
  • Add a checkbox to the settings to turn off the step size.

@RedworkDE
Copy link
Member

Can confirm that this issue exists on master on Windows as well, the speed at which you can scroll is just way lower than on macOS.

This issue is most noticeable when zooming in a lot and then scrolling diagonally, which will cause the editor to smoothly scroll horizontally, but it will jump (in quarter line steps) / not scroll at all vertically (depending on the actual scroll speed)

The fix probably is to change the step for smooth scrolling to 0 (it is smooth scrolling. not quarter line step scrolling) and to introduce an accumulator to fix per line scrolling with touchpads and accelerated / free-scrolling mouse wheels.

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

Successfully merging a pull request may close this issue.

10 participants