Call add_child after set_rect to fix size bug

This commit is contained in:
Rakka Rage 2023-08-24 13:34:05 -04:00
parent 851bc640dd
commit e93d2a04df

View file

@ -955,7 +955,6 @@ void TileSetAtlasSourceEditor::_update_atlas_view() {
// Create and position the button.
Button *button = memnew(Button);
alternative_tiles_control->add_child(button);
button->set_flat(true);
button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
button->add_theme_style_override("normal", memnew(StyleBoxEmpty));
@ -965,6 +964,7 @@ void TileSetAtlasSourceEditor::_update_atlas_view() {
button->connect("pressed", callable_mp(tile_set_atlas_source, &TileSetAtlasSource::create_alternative_tile).bind(tile_id, TileSetSource::INVALID_TILE_ALTERNATIVE));
button->set_rect(Rect2(Vector2(pos.x, pos.y + (y_increment - texture_region_base_size.y) / 2.0), Vector2(texture_region_base_size_min, texture_region_base_size_min)));
button->set_expand_icon(true);
alternative_tiles_control->add_child(button);
pos.y += y_increment;
}