Document, cleanup and fix some theme properties

This commit is contained in:
kobewi 2023-09-26 23:52:16 +02:00
parent 251fb83d53
commit cfb6d25d30
6 changed files with 4 additions and 22 deletions

View File

@ -132,6 +132,7 @@
Font size of the [Button]'s text. Font size of the [Button]'s text.
</theme_item> </theme_item>
<theme_item name="icon" data_type="icon" type="Texture2D"> <theme_item name="icon" data_type="icon" type="Texture2D">
Default icon for the [Button]. Appears only if [member icon] is not assigned.
</theme_item> </theme_item>
<theme_item name="disabled" data_type="style" type="StyleBox"> <theme_item name="disabled" data_type="style" type="StyleBox">
[StyleBox] used when the [Button] is disabled. [StyleBox] used when the [Button] is disabled.

View File

@ -214,7 +214,7 @@
<param index="3" name="to_port" type="int" /> <param index="3" name="to_port" type="int" />
<param index="4" name="amount" type="float" /> <param index="4" name="amount" type="float" />
<description> <description>
Sets the coloration of the connection between [param from_node]'s [param from_port] and [param to_node]'s [param to_port] with the color provided in the [theme_item activity] theme property. Sets the coloration of the connection between [param from_node]'s [param from_port] and [param to_node]'s [param to_port] with the color provided in the [theme_item activity] theme property. The color is linearly interpolated between the connection color and the activity color using [param amount] as weight.
</description> </description>
</method> </method>
<method name="set_selected"> <method name="set_selected">
@ -396,6 +396,7 @@
</constants> </constants>
<theme_items> <theme_items>
<theme_item name="activity" data_type="color" type="Color" default="Color(1, 1, 1, 1)"> <theme_item name="activity" data_type="color" type="Color" default="Color(1, 1, 1, 1)">
Color of the connection's activity (see [method set_connection_activity]).
</theme_item> </theme_item>
<theme_item name="grid_major" data_type="color" type="Color" default="Color(1, 1, 1, 0.2)"> <theme_item name="grid_major" data_type="color" type="Color" default="Color(1, 1, 1, 0.2)">
Color of major grid lines. Color of major grid lines.

View File

@ -49,8 +49,6 @@
<theme_item name="grabber_pressed" data_type="style" type="StyleBox"> <theme_item name="grabber_pressed" data_type="style" type="StyleBox">
Used when the grabber is being dragged. Used when the grabber is being dragged.
</theme_item> </theme_item>
<theme_item name="hscroll" data_type="style" type="StyleBox">
</theme_item>
<theme_item name="scroll" data_type="style" type="StyleBox"> <theme_item name="scroll" data_type="style" type="StyleBox">
Used as background of this [ScrollBar]. Used as background of this [ScrollBar].
</theme_item> </theme_item>

View File

@ -1402,7 +1402,7 @@ void GraphEdit::_zoom_callback(float p_zoom_factor, Vector2 p_origin, Ref<InputE
void GraphEdit::set_connection_activity(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port, float p_activity) { void GraphEdit::set_connection_activity(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port, float p_activity) {
for (Connection &E : connections) { for (Connection &E : connections) {
if (E.from_node == p_from && E.from_port == p_from_port && E.to_node == p_to && E.to_port == p_to_port) { if (E.from_node == p_from && E.from_port == p_from_port && E.to_node == p_to && E.to_port == p_to_port) {
if (Math::is_equal_approx(E.activity, p_activity)) { if (!Math::is_equal_approx(E.activity, p_activity)) {
// Update only if changed. // Update only if changed.
top_layer->queue_redraw(); top_layer->queue_redraw();
minimap->queue_redraw(); minimap->queue_redraw();

View File

@ -468,22 +468,6 @@ double ScrollBar::get_area_size() const {
} }
} }
double ScrollBar::get_area_offset() const {
double ofs = 0.0;
if (orientation == VERTICAL) {
ofs += theme_cache.scroll_offset_style->get_margin(SIDE_TOP);
ofs += theme_cache.decrement_icon->get_height();
}
if (orientation == HORIZONTAL) {
ofs += theme_cache.scroll_offset_style->get_margin(SIDE_LEFT);
ofs += theme_cache.decrement_icon->get_width();
}
return ofs;
}
double ScrollBar::get_grabber_offset() const { double ScrollBar::get_grabber_offset() const {
return (get_area_size()) * get_as_ratio(); return (get_area_size()) * get_as_ratio();
} }
@ -639,7 +623,6 @@ void ScrollBar::_bind_methods() {
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, scroll_style, "scroll"); BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, scroll_style, "scroll");
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, scroll_focus_style, "scroll_focus"); BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, scroll_focus_style, "scroll_focus");
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, scroll_offset_style, "hscroll");
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, grabber_style, "grabber"); BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, grabber_style, "grabber");
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, grabber_hl_style, "grabber_highlight"); BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, grabber_hl_style, "grabber_highlight");
BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, grabber_pressed_style, "grabber_pressed"); BIND_THEME_ITEM_CUSTOM(Theme::DATA_TYPE_STYLEBOX, ScrollBar, grabber_pressed_style, "grabber_pressed");

View File

@ -63,7 +63,6 @@ class ScrollBar : public Range {
double get_grabber_size() const; double get_grabber_size() const;
double get_grabber_min_size() const; double get_grabber_min_size() const;
double get_area_size() const; double get_area_size() const;
double get_area_offset() const;
double get_grabber_offset() const; double get_grabber_offset() const;
static void set_can_focus_by_default(bool p_can_focus); static void set_can_focus_by_default(bool p_can_focus);