diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/plugins/tile_map_editor_plugin.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/tools/editor/plugins/tile_map_editor_plugin.cpp b/tools/editor/plugins/tile_map_editor_plugin.cpp index b2562eafe1..5ee0259d56 100644 --- a/tools/editor/plugins/tile_map_editor_plugin.cpp +++ b/tools/editor/plugins/tile_map_editor_plugin.cpp @@ -676,12 +676,21 @@ void TileMapEditor::_canvas_draw() { Ref<Texture> t = ts->tile_get_texture(st); if (t.is_valid()) { Vector2 from = node->map_to_world(over_tile)+node->get_cell_draw_offset(); + Vector2 tile_ofs = ts->tile_get_texture_offset(st); Rect2 r = ts->tile_get_region(st); Size2 sc = xform.get_scale(); - if (mirror_x->is_pressed()) + + if (transpose->is_pressed()) + SWAP(tile_ofs.x, tile_ofs.y); + + if (mirror_x->is_pressed()) { sc.x*=-1.0; - if (mirror_y->is_pressed()) + tile_ofs.x*=-1.0; + } + if (mirror_y->is_pressed()) { sc.y*=-1.0; + tile_ofs.y*=-1.0; + } Rect2 rect; if (r==Rect2()) { @@ -691,15 +700,14 @@ void TileMapEditor::_canvas_draw() { rect=Rect2(from,r.get_size()); } - if (node->get_tile_origin()==TileMap::TILE_ORIGIN_TOP_LEFT) { - rect.pos+=ts->tile_get_texture_offset(st); + rect.pos+=tile_ofs; } else if (node->get_tile_origin()==TileMap::TILE_ORIGIN_CENTER) { rect.pos+=node->get_cell_size()/2; Vector2 s = r.size; - Vector2 center = (s/2) - ts->tile_get_texture_offset(st); + Vector2 center = (s/2) - tile_ofs; if (mirror_x->is_pressed()) |