summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthe 8th mage <eee34353@gmail.com>2018-09-29 16:52:35 +0300
committerRémi Verschelde <rverschelde@gmail.com>2018-10-04 13:19:55 +0200
commitf7a98664178b9389b55df209506f02f32d755441 (patch)
treeb90bba42e7f4366072fab497f3476d6d9dcd5723
parent156c4eab022a52ff2415cd4b2dd3a3b2034c18d1 (diff)
Fix TileMap editor drawing
the tile cursor did not follow the mouse cursor, and the tile grid was displayed wrong, because the forward_canvas_draw_over_viewport function used the wrong xform and thus its map_to_world is not the inverse of the mouse interactor world_to_map, making the tiles draw from 0,0 of the screen instead of 0,0 of the tile map (which is in a different place)
-rw-r--r--editor/plugins/tile_map_editor_plugin.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/editor/plugins/tile_map_editor_plugin.cpp b/editor/plugins/tile_map_editor_plugin.cpp
index aa4338d775..b49ed5873b 100644
--- a/editor/plugins/tile_map_editor_plugin.cpp
+++ b/editor/plugins/tile_map_editor_plugin.cpp
@@ -882,7 +882,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
if (!node || !node->get_tileset().is_valid() || !node->is_visible_in_tree())
return false;
- Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform();
+ Transform2D xform = canvas_item_editor->get_canvas_transform() * node->get_global_transform();
Transform2D xform_inv = xform.affine_inverse();
Ref<InputEventMouseButton> mb = p_event;
@@ -1396,8 +1396,7 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
return;
Transform2D cell_xf = node->get_cell_transform();
-
- Transform2D xform = p_overlay->get_canvas_transform() * node->get_global_transform();
+ Transform2D xform = CanvasItemEditor::get_singleton()->get_canvas_transform() * node->get_global_transform();
Transform2D xform_inv = xform.affine_inverse();
Size2 screen_size = p_overlay->get_size();