The set_position method computes the anchors/offsets to match a
rectangle at the given position with size "size_cache". However, when
the Control's combined minimum size is larger than the size obtained
through the offsets and anchors, "size_cache" is set to be as large as
the combined minimum size. Therefore, when position is set while the
combined minimum size is larger than the rectangle given by the anchors
and offsets, it would resize these two fields, which would then stop
the Control from shrinking when its combined minimum size decreased. To
fix this, set_position now uses the size given by the offsets and
anchors instead of the "size_cache" field. This way, the rectangle
denoted by the offsets and anchors is simply moved, without being
resized, enabling the Control to shrink automatically when its combined
minimum size decreases. I also added a test case to ensure that the
Control shrinks correctly after setting its position while it has a
larger custom minimum size than the one obtained through the offsets
and anchors.
Closes: godotengine/godot-proposals#4439.
Allows viewing the default values of the currently used theme item
in the Inspector.
For theme item properties of resource type, editing the default
resource does not make sense. Use **Make Unique** to create a copy
before editing.
It's hard to tell at first glance under what circumstances `is_top_level_control()`
returns `true`. So it's hard to decide when to use this method. And it seems to be
just a helper function for `Control::get_root_parent_control()`.
`is_top_level_control()` seems to only return `true` during entry and exit of canvas.
`NOTIFICATION_MOUSE_ENTER` and `NOTIFICATION_MOUSE_EXIT` now includes
the areas of children control nodes if the mouse filters allow it.
In order to check if a Control node itself was entered/exited, the newly
introduced `NOTIFICATION_MOUSE_ENTER_SELF` and
`NOTIFICATION_MOUSE_EXIT_SELF` can be used.
Co-authored-by: Markus Sauermann <6299227+Sauermann@users.noreply.github.com>
This commit adds the default theme context, which replaces
the need to manually check the project and the default theme
all the time; simplifies related code.
It also adds framework for custom theme contexts, to be used
by the editor. Custom contexts can be attached to any node,
and not necessarily a GUI/Window node. Contexts do no break
theme inheritance and only define which global themes a node
uses as a fallback.
Contexts propagate NOTIFICATION_THEME_CHANGED when one of their
global themes changes. This ensures that global themes act just
like themes assigned to individual nodes and can be previewed
live in the editor.
* This solution is much cleaner than the one in 3.x thanks to the use of callables.
* Works without issues in any language (no need to worry about camel or snake case).
* Editor code uses a compatibility function (too much work to redo).
Fixes#59899