Merge pull request #50671 from winston-yallow/improve-editor-spin-slider
Add editor setting for spin slider sensibility
This commit is contained in:
commit
f43b39a7c0
4 changed files with 12 additions and 2 deletions
|
@ -571,6 +571,9 @@
|
|||
If [code]true[/code], editor main menu is using embedded [MenuBar] instead of system global menu.
|
||||
Specific to the macOS platform.
|
||||
</member>
|
||||
<member name="interface/inspector/float_drag_speed" type="float" setter="" getter="">
|
||||
Base speed for increasing/decreasing float values by dragging them in the inspector.
|
||||
</member>
|
||||
<member name="interface/inspector/max_array_dictionary_items_per_page" type="int" setter="" getter="">
|
||||
The number of [Array] or [Dictionary] items to display on each "page" in the inspector. Higher values allow viewing more values per page, but take more time to load. This increased load time is noticeable when selecting nodes that have array or dictionary properties in the editor.
|
||||
</member>
|
||||
|
|
|
@ -454,6 +454,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
|
|||
// Inspector
|
||||
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "interface/inspector/max_array_dictionary_items_per_page", 20, "10,100,1")
|
||||
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/inspector/show_low_level_opentype_features", false, "")
|
||||
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/inspector/float_drag_speed", 5.0, "0.1,100,0.01")
|
||||
|
||||
// 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")
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "core/math/expression.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "editor/editor_scale.h"
|
||||
#include "editor/editor_settings.h"
|
||||
|
||||
String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const {
|
||||
if (grabber->is_visible()) {
|
||||
|
@ -103,7 +104,7 @@ void EditorSpinSlider::gui_input(const Ref<InputEvent> &p_event) {
|
|||
if (mm->is_shift_pressed() && grabbing_spinner) {
|
||||
diff_x *= 0.1;
|
||||
}
|
||||
grabbing_spinner_dist_cache += diff_x;
|
||||
grabbing_spinner_dist_cache += diff_x * grabbing_spinner_speed;
|
||||
|
||||
if (!grabbing_spinner && ABS(grabbing_spinner_dist_cache) > 4 * EDSCALE) {
|
||||
Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED);
|
||||
|
@ -439,7 +440,11 @@ void EditorSpinSlider::_draw_spin_slider() {
|
|||
|
||||
void EditorSpinSlider::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
grabbing_spinner_speed = EditorSettings::get_singleton()->get("interface/inspector/float_drag_speed");
|
||||
_update_value_input_stylebox();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
_update_value_input_stylebox();
|
||||
} break;
|
||||
|
|
|
@ -60,6 +60,7 @@ class EditorSpinSlider : public Range {
|
|||
|
||||
bool read_only = false;
|
||||
float grabbing_spinner_dist_cache = 0.0f;
|
||||
float grabbing_spinner_speed = 0.0f;
|
||||
Vector2 grabbing_spinner_mouse_pos;
|
||||
double pre_grab_value = 0.0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue