You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Make stylebox preview not to expand Inspector panel
This commit is contained in:
@@ -64,21 +64,24 @@ void StyleBoxPreview::edit(const Ref<StyleBox> &p_stylebox) {
|
||||
void StyleBoxPreview::_sb_changed() {
|
||||
|
||||
preview->update();
|
||||
}
|
||||
|
||||
void StyleBoxPreview::_redraw() {
|
||||
if (stylebox.is_valid()) {
|
||||
Size2 ms = stylebox->get_minimum_size() * 4 / 3;
|
||||
ms.height = MAX(ms.height, 150 * EDSCALE);
|
||||
preview->set_custom_minimum_size(ms);
|
||||
preview->draw_style_box(stylebox, preview->get_rect());
|
||||
}
|
||||
}
|
||||
|
||||
void StyleBoxPreview::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method("_sb_changed", &StyleBoxPreview::_sb_changed);
|
||||
ClassDB::bind_method("_redraw", &StyleBoxPreview::_redraw);
|
||||
}
|
||||
|
||||
StyleBoxPreview::StyleBoxPreview() {
|
||||
|
||||
preview = memnew(Panel);
|
||||
preview = memnew(Control);
|
||||
preview->set_custom_minimum_size(Size2(0, 150 * EDSCALE));
|
||||
preview->connect("draw", this, "_redraw");
|
||||
add_margin_child(TTR("Preview:"), preview);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user