diff options
author | kleonc <9283098+kleonc@users.noreply.github.com> | 2023-03-12 12:53:46 +0100 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-04-26 14:14:05 +0200 |
commit | 6ac70ff5dafae0729b7b3a9994e2da65de12c2e4 (patch) | |
tree | eb2d34f3f11b74b8063b45b3b4d38cf5a04296ed /editor/plugins/tiles | |
parent | d78691d44fe6e4f38dce3a89164cdae688772031 (diff) |
TileMap Fix rendering odd-sized tiles
(cherry picked from commit c49a7feae3418d0732369b203d0bc9e28723b9db)
Diffstat (limited to 'editor/plugins/tiles')
-rw-r--r-- | editor/plugins/tiles/tile_atlas_view.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 43c6d1a48b..2b42e41e73 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -247,7 +247,7 @@ void TileAtlasView::_draw_base_tiles() { for (int frame = 0; frame < tile_set_atlas_source->get_tile_animation_frames_count(atlas_coords); frame++) { // Update the y to max value. Rect2i base_frame_rect = tile_set_atlas_source->get_tile_texture_region(atlas_coords, frame); - Vector2i offset_pos = base_frame_rect.get_center() + tile_set_atlas_source->get_tile_data(atlas_coords, 0)->get_texture_origin(); + Vector2 offset_pos = Rect2(base_frame_rect).get_center() + Vector2(tile_set_atlas_source->get_tile_data(atlas_coords, 0)->get_texture_origin()); // Draw the tile. TileMap::draw_tile(base_tiles_draw->get_canvas_item(), offset_pos, tile_set, source_id, atlas_coords, 0, frame); @@ -331,7 +331,7 @@ void TileAtlasView::_draw_base_tiles_shape_grid() { } Rect2i texture_region = tile_set_atlas_source->get_tile_texture_region(tile_id, frame); Transform2D tile_xform; - tile_xform.set_origin(texture_region.get_center() + in_tile_base_offset); + tile_xform.set_origin(Rect2(texture_region).get_center() + in_tile_base_offset); tile_xform.set_scale(tile_shape_size); tile_set->draw_tile_shape(base_tiles_shape_grid, tile_xform, color); } |