mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Improve SplitContainer usability in the Android editor
This commit is contained in:
parent
bccf36b27b
commit
b5dad5a0b2
9 changed files with 35 additions and 15 deletions
|
|
@ -1116,8 +1116,8 @@
|
|||
If [code]true[/code], enable two finger pan and scale gestures on touchscreen devices.
|
||||
[b]Note:[/b] Defaults to [code]true[/code] on touchscreen devices.
|
||||
</member>
|
||||
<member name="interface/touchscreen/increase_scrollbar_touch_area" type="bool" setter="" getter="">
|
||||
If [code]true[/code], increases the scrollbar touch area to improve usability on touchscreen devices.
|
||||
<member name="interface/touchscreen/enable_touch_optimizations" type="bool" setter="" getter="">
|
||||
If [code]true[/code], increases the scrollbar touch area and enables a larger dragger for split containers to improve usability on touchscreen devices
|
||||
[b]Note:[/b] Defaults to [code]true[/code] on touchscreen devices.
|
||||
</member>
|
||||
<member name="interface/touchscreen/scale_gizmo_handles" type="float" setter="" getter="">
|
||||
|
|
|
|||
|
|
@ -114,6 +114,12 @@ void DockSplitContainer::remove_child_notify(Node *p_child) {
|
|||
_update_visibility();
|
||||
}
|
||||
|
||||
DockSplitContainer::DockSplitContainer() {
|
||||
if (EDITOR_GET("interface/touchscreen/enable_touch_optimizations")) {
|
||||
callable_mp((SplitContainer *)this, &SplitContainer::set_touch_dragger_enabled).call_deferred(true);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorDockManager::_dock_split_dragged(int p_offset) {
|
||||
EditorNode::get_singleton()->save_editor_layout_delayed();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,9 @@ protected:
|
|||
|
||||
virtual void add_child_notify(Node *p_child) override;
|
||||
virtual void remove_child_notify(Node *p_child) override;
|
||||
|
||||
public:
|
||||
DockSplitContainer();
|
||||
};
|
||||
|
||||
class DockContextPopup;
|
||||
|
|
|
|||
|
|
@ -592,19 +592,19 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
|
||||
// Touchscreen
|
||||
bool has_touchscreen_ui = DisplayServer::get_singleton()->is_touchscreen_available();
|
||||
bool is_native_touchscreen = has_touchscreen_ui && !OS::get_singleton()->has_feature("xr_editor"); // Disable some touchscreen settings by default for the XR Editor.
|
||||
|
||||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_touch_optimizations", is_native_touchscreen, "")
|
||||
set_restart_if_changed("interface/touchscreen/enable_touch_optimizations", true);
|
||||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_long_press_as_right_click", is_native_touchscreen, "")
|
||||
set_restart_if_changed("interface/touchscreen/enable_long_press_as_right_click", true);
|
||||
|
||||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_pan_and_scale_gestures", has_touchscreen_ui, "")
|
||||
set_restart_if_changed("interface/touchscreen/enable_pan_and_scale_gestures", true);
|
||||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/touchscreen/scale_gizmo_handles", has_touchscreen_ui ? 3 : 1, "1,5,1")
|
||||
set_restart_if_changed("interface/touchscreen/scale_gizmo_handles", true);
|
||||
|
||||
// Disable some touchscreen settings by default for the XR Editor.
|
||||
bool is_native_touchscreen = has_touchscreen_ui && !OS::get_singleton()->has_feature("xr_editor");
|
||||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/enable_long_press_as_right_click", is_native_touchscreen, "")
|
||||
set_restart_if_changed("interface/touchscreen/enable_long_press_as_right_click", true);
|
||||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/touchscreen/increase_scrollbar_touch_area", is_native_touchscreen, "")
|
||||
set_restart_if_changed("interface/touchscreen/increase_scrollbar_touch_area", true);
|
||||
|
||||
// Only available in the Android editor.
|
||||
// Only available in the Android/XR editor.
|
||||
String touch_actions_panel_hints = "Disabled:0,Embedded Panel:1,Floating Panel:2";
|
||||
EDITOR_SETTING_BASIC(Variant::INT, PROPERTY_HINT_ENUM, "interface/touchscreen/touch_actions_panel", 1, touch_actions_panel_hints)
|
||||
|
||||
|
|
|
|||
|
|
@ -923,6 +923,10 @@ EditorSettingsDialog::EditorSettingsDialog() {
|
|||
inspector->get_inspector()->connect("property_edited", callable_mp(this, &EditorSettingsDialog::_settings_property_edited));
|
||||
inspector->get_inspector()->connect("restart_requested", callable_mp(this, &EditorSettingsDialog::_editor_restart_request));
|
||||
|
||||
if (EDITOR_GET("interface/touchscreen/enable_touch_optimizations")) {
|
||||
inspector->set_touch_dragger_enabled(true);
|
||||
}
|
||||
|
||||
restart_container = memnew(PanelContainer);
|
||||
tab_general->add_child(restart_container);
|
||||
HBoxContainer *restart_hb = memnew(HBoxContainer);
|
||||
|
|
|
|||
|
|
@ -1437,6 +1437,9 @@ ProjectExportDialog::ProjectExportDialog() {
|
|||
HSplitContainer *hbox = memnew(HSplitContainer);
|
||||
main_vb->add_child(hbox);
|
||||
hbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
if (EDITOR_GET("interface/touchscreen/enable_touch_optimizations")) {
|
||||
hbox->set_touch_dragger_enabled(true);
|
||||
}
|
||||
|
||||
// Presets list.
|
||||
|
||||
|
|
|
|||
|
|
@ -719,6 +719,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
|
|||
general_settings_inspector->get_inspector()->connect("restart_requested", callable_mp(this, &ProjectSettingsEditor::_editor_restart_request));
|
||||
general_editor->add_child(general_settings_inspector);
|
||||
|
||||
if (EDITOR_GET("interface/touchscreen/enable_touch_optimizations")) {
|
||||
general_settings_inspector->set_touch_dragger_enabled(true);
|
||||
}
|
||||
|
||||
restart_container = memnew(PanelContainer);
|
||||
general_editor->add_child(restart_container);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ uint32_t EditorThemeManager::ThemeConfiguration::hash() {
|
|||
hash = hash_murmur3_one_float(relationship_line_opacity, hash);
|
||||
hash = hash_murmur3_one_32(thumb_size, hash);
|
||||
hash = hash_murmur3_one_32(class_icon_size, hash);
|
||||
hash = hash_murmur3_one_32((int)increase_scrollbar_touch_area, hash);
|
||||
hash = hash_murmur3_one_32((int)enable_touch_optimizations, hash);
|
||||
hash = hash_murmur3_one_float(gizmo_handle_scale, hash);
|
||||
hash = hash_murmur3_one_32(color_picker_button_height, hash);
|
||||
hash = hash_murmur3_one_float(subresource_hue_tint, hash);
|
||||
|
|
@ -246,7 +246,7 @@ EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config(
|
|||
config.relationship_line_opacity = EDITOR_GET("interface/theme/relationship_line_opacity");
|
||||
config.thumb_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size");
|
||||
config.class_icon_size = 16 * EDSCALE;
|
||||
config.increase_scrollbar_touch_area = EDITOR_GET("interface/touchscreen/increase_scrollbar_touch_area");
|
||||
config.enable_touch_optimizations = EDITOR_GET("interface/touchscreen/enable_touch_optimizations");
|
||||
config.gizmo_handle_scale = EDITOR_GET("interface/touchscreen/scale_gizmo_handles");
|
||||
config.color_picker_button_height = 28 * EDSCALE;
|
||||
config.subresource_hue_tint = EDITOR_GET("docks/property_editor/subresource_hue_tint");
|
||||
|
|
@ -1437,7 +1437,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
|
|||
|
||||
// HScrollBar.
|
||||
|
||||
if (p_config.increase_scrollbar_touch_area) {
|
||||
if (p_config.enable_touch_optimizations) {
|
||||
p_theme->set_stylebox("scroll", "HScrollBar", make_line_stylebox(p_config.separator_color, 50));
|
||||
} else {
|
||||
p_theme->set_stylebox("scroll", "HScrollBar", make_stylebox(p_theme->get_icon(SNAME("GuiScrollBg"), EditorStringName(EditorIcons)), 5, 5, 5, 5, -5, 1, -5, 1));
|
||||
|
|
@ -1456,7 +1456,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
|
|||
|
||||
// VScrollBar.
|
||||
|
||||
if (p_config.increase_scrollbar_touch_area) {
|
||||
if (p_config.enable_touch_optimizations) {
|
||||
p_theme->set_stylebox("scroll", "VScrollBar", make_line_stylebox(p_config.separator_color, 50, 1, 1, true));
|
||||
} else {
|
||||
p_theme->set_stylebox("scroll", "VScrollBar", make_stylebox(p_theme->get_icon(SNAME("GuiScrollBg"), EditorStringName(EditorIcons)), 5, 5, 5, 5, 1, -5, 1, -5));
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class EditorThemeManager {
|
|||
float relationship_line_opacity = 1.0;
|
||||
int thumb_size = 16;
|
||||
int class_icon_size = 16;
|
||||
bool increase_scrollbar_touch_area = false;
|
||||
bool enable_touch_optimizations = false;
|
||||
float gizmo_handle_scale = 1.0;
|
||||
int color_picker_button_height = 28;
|
||||
float subresource_hue_tint = 0.0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue