-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Update the size of the scrollbar for the editor on touchscreen devices #71657
Update the size of the scrollbar for the editor on touchscreen devices #71657
Conversation
I don't know what the current state of using /editor in /scene is like, but FYI: |
I wonder if this could be set via the editor theme instead? CC @YuriSizov @Calinou |
@akien-mga I tried that approach first, and the current theming options for the scrollbar do not allow to control its width/height. I can look into adding a |
You should be able to with the margins of the I recall there was some recent talk, a proposal, or maybe even a PR about these stylebox size values. I'll try to look it up. |
I played around for a couple hours with the margins on the |
It's accounted for here: godot/scene/gui/scroll_bar.cpp Lines 496 to 519 in 14fdd28
The problem is that this takes a sum of the min size of the stylebox (which is just its margins) and the center size. Normally, the center size doesn't do anything, but in the StyleBoxTexture it is computed as the size of the texture minus the min size. So the resulting size for the scrollbar becomes It should work just fine with just margins if it's StyleBoxFlat though. Not sure what could've been a problem. |
I made #71686, which should make it possible to properly implement this. |
4c1d02f
to
fc6c7bc
Compare
Could we keep the scrollbars visually as thin as they were before, but increase their draggable area (e.g. using expand/content margin)? It'd probably look better. |
@Calinou It's bad UX for touchscreen devices as it creates confusion for the user:
Also, I'm not sure if there's capability for that. The I took the approach of providing a new |
It's probably better as a settings flag that affects any theme, so you can still pick any default theme, or choose your own colors, while keeping this accessibility feature available. |
Sounds like a good option! I'll update the PR. |
fc6c7bc
to
3ba8bf0
Compare
…ents (e.g: scrollbar) for the editor on touchscreen devices
3ba8bf0
to
63c88df
Compare
@@ -453,6 +453,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { | |||
|
|||
// Theme | |||
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_ENUM, "interface/theme/preset", "Default", "Default,Breeze Dark,Godot 2,Gray,Light,Solarized (Dark),Solarized (Light),Black (OLED),Custom") | |||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/theme/enable_touchscreen_touch_area", DisplayServer::get_singleton()->is_touchscreen_available(), "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check but this might make it appear on my Linux laptop with touchscreen, which would be unwanted.
We probably want to use the same criteria as for the 3D viewport touch sticks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setting uses the same default as the 3D viewport touch sticks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, it seems DisplayServer::is_touchscreen_available()
is only implemented on Android, iOS and Web currently.
I think if/when it gets properly implemented on other platforms we might start getting complaints about those. We should probably rethink that eventually and see if we should differentiate between supporting and preferring touchscreen input.
$ rg ::is_touchscreen_available
servers/display_server.cpp
389:bool DisplayServer::is_touchscreen_available() const {
658: ClassDB::bind_method(D_METHOD("is_touchscreen_available"), &DisplayServer::is_touchscreen_available, DEFVAL(SCREEN_OF_MAIN_WINDOW));
platform/ios/display_server_ios.mm
581:bool DisplayServerIOS::is_touchscreen_available() const {
platform/android/display_server_android.cpp
239:bool DisplayServerAndroid::is_touchscreen_available() const {
platform/web/display_server_web.cpp
591:bool DisplayServerWeb::is_touchscreen_available() const {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theme changes look fine.
Thanks! |
Add a theme usability setting which updates the touch area of UI elements (e.g: scrollbar) for the editor on touchscreen devices.
This PR updates the scroll dimension to improve the scrolling experience on touchscreen.
3.x version