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 TextEdit v_scroll_speed invalid values breaks wheel scrolling #58010

Merged
merged 1 commit into from
Apr 4, 2022

Conversation

jmb462
Copy link
Contributor

@jmb462 jmb462 commented Feb 12, 2022

Fixes #58009

Issue description

Some values of text_editor/behavior/navigation/v_scroll_speed Editor settings breaks mouse wheel scrolling of TextEdit.

Identified causes

  • Missing hint_range in property declaration to prevent null or negative values
  • If the value is under 8, the increment in vscroll position is under its range step, so the value keeps unchanged and wheel scroll is blocked.

Fix proposal

  • Add hint_range "1, 10000,1" in property declaration
    10000 leads to immediately scroll to destination. As comparison, clicking on minimap leads to a 3000 scrolling speed and is already nearly instantaneous.

  • Ensure that scrolling speed is equal or greater than the scrollbar step to prevent blocking mouse wheel scroll.

After (I roll the mouse wheel a LOT to see the scrolling speed)

fixed

@jmb462 jmb462 requested a review from a team as a code owner February 12, 2022 14:08
@Calinou Calinou added this to the 4.0 milestone Feb 12, 2022
Copy link
Member

@bruvzg bruvzg left a comment

Choose a reason for hiding this comment

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

In addition to the property hint, it's probably worth adding the same checks to the TextEdit::set_v_scroll_speed and reject invalid values. Property hint will help when it's set from UI, but won't if it's set in the config file or set_v_scroll_speed is called directly.

@jmb462 jmb462 force-pushed the fix-TextEdit-v_scroll_speed branch from 718bcdc to b6f1918 Compare February 21, 2022 10:48
@jmb462
Copy link
Contributor Author

jmb462 commented Feb 21, 2022

For too low values, should we set it to the minimum accepted value or should we return without modifying the value and throw an error/warning ? (I've pushed the first way but a doubt has raised now)

Higher values are not really a problem. It will be "instant" scroll.

Copy link
Member

@Paulb23 Paulb23 left a comment

Choose a reason for hiding this comment

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

Would suggest using ERR_FAIL_COND rather then MAX otherwise looks good.

@jmb462 jmb462 force-pushed the fix-TextEdit-v_scroll_speed branch from b6f1918 to 876f14f Compare April 3, 2022 17:32
@jmb462
Copy link
Contributor Author

jmb462 commented Apr 3, 2022

Would suggest using ERR_FAIL_COND rather then MAX otherwise looks good.

You're right. Done.

@jmb462 jmb462 force-pushed the fix-TextEdit-v_scroll_speed branch from 876f14f to 0d17903 Compare April 3, 2022 19:07
@akien-mga akien-mga merged commit f1592cb into godotengine:master Apr 4, 2022
@akien-mga
Copy link
Member

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.

Text editor v_scroll_speed setting can break mouse wheel scrolling
5 participants