Merge pull request #80968 from rakkarage/alternative-icon-scale
Call `add_child` after `set_rect` to fix size bug
This commit is contained in:
commit
6da4ad1662
|
@ -990,7 +990,6 @@ void TileSetAtlasSourceEditor::_update_atlas_view() {
|
||||||
|
|
||||||
// Create and position the button.
|
// Create and position the button.
|
||||||
Button *button = memnew(Button);
|
Button *button = memnew(Button);
|
||||||
alternative_tiles_control->add_child(button);
|
|
||||||
button->set_flat(true);
|
button->set_flat(true);
|
||||||
button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons")));
|
||||||
button->add_theme_style_override("normal", memnew(StyleBoxEmpty));
|
button->add_theme_style_override("normal", memnew(StyleBoxEmpty));
|
||||||
|
@ -1000,6 +999,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->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_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);
|
button->set_expand_icon(true);
|
||||||
|
alternative_tiles_control->add_child(button);
|
||||||
|
|
||||||
pos.y += y_increment;
|
pos.y += y_increment;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue