Skip to content

Commit

Permalink
Call add_child after set_rect to fix size bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rakkarage committed Aug 25, 2023
1 parent 851bc64 commit e93d2a0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion editor/plugins/tiles/tile_set_atlas_source_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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;
}
Expand Down

0 comments on commit e93d2a0

Please sign in to comment.