Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
915ab506
Commit
915ab506
authored
May 06, 2020
by
Eric M
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated editor spin slider to have better behaviour and adjusted control's…
Updated editor spin slider to have better behaviour and adjusted control's size_flags_stretch_ratio value range
parent
2435d4bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
editor_spin_slider.cpp
editor/editor_spin_slider.cpp
+17
-0
control.cpp
scene/gui/control.cpp
+1
-1
No files found.
editor/editor_spin_slider.cpp
View file @
915ab506
...
...
@@ -36,6 +36,9 @@
#include "editor_scale.h"
String
EditorSpinSlider
::
get_tooltip
(
const
Point2
&
p_pos
)
const
{
if
(
grabber
->
is_visible
())
{
return
rtos
(
get_value
())
+
"
\n\n
"
+
TTR
(
"Hold Ctrl to round to integers. Hold Shift for more precise changes."
);
}
return
rtos
(
get_value
());
}
...
...
@@ -111,7 +114,21 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
}
if
(
grabbing_spinner
)
{
// Don't make the user scroll all the way back to 'in range' if they went off the end.
if
(
pre_grab_value
<
get_min
()
&&
!
is_lesser_allowed
())
{
pre_grab_value
=
get_min
();
}
if
(
pre_grab_value
>
get_max
()
&&
!
is_greater_allowed
())
{
pre_grab_value
=
get_max
();
}
if
(
mm
->
get_control
())
{
// If control was just pressed, don't make the value do a huge jump in magnitude.
if
(
grabbing_spinner_dist_cache
!=
0
)
{
pre_grab_value
+=
grabbing_spinner_dist_cache
*
get_step
();
grabbing_spinner_dist_cache
=
0
;
}
set_value
(
Math
::
round
(
pre_grab_value
+
get_step
()
*
grabbing_spinner_dist_cache
*
10
));
}
else
{
set_value
(
pre_grab_value
+
get_step
()
*
grabbing_spinner_dist_cache
);
...
...
scene/gui/control.cpp
View file @
915ab506
...
...
@@ -2896,7 +2896,7 @@ void Control::_bind_methods() {
ADD_GROUP
(
"Size Flags"
,
"size_flags_"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
INT
,
"size_flags_horizontal"
,
PROPERTY_HINT_FLAGS
,
"Fill,Expand,Shrink Center,Shrink End"
),
"set_h_size_flags"
,
"get_h_size_flags"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
INT
,
"size_flags_vertical"
,
PROPERTY_HINT_FLAGS
,
"Fill,Expand,Shrink Center,Shrink End"
),
"set_v_size_flags"
,
"get_v_size_flags"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
FLOAT
,
"size_flags_stretch_ratio"
,
PROPERTY_HINT_RANGE
,
"0,
128,0.01
"
),
"set_stretch_ratio"
,
"get_stretch_ratio"
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
FLOAT
,
"size_flags_stretch_ratio"
,
PROPERTY_HINT_RANGE
,
"0,
20,0.01,or_greater
"
),
"set_stretch_ratio"
,
"get_stretch_ratio"
);
ADD_GROUP
(
"Theme"
,
""
);
ADD_PROPERTY
(
PropertyInfo
(
Variant
::
OBJECT
,
"theme"
,
PROPERTY_HINT_RESOURCE_TYPE
,
"Theme"
),
"set_theme"
,
"get_theme"
);
ADD_GROUP
(
""
,
""
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment