mirror of
https://github.com/godotengine/godot.git
synced 2025-04-19 01:27:45 +08:00
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)
This commit is contained in:
parent
156c4eab02
commit
f7a9866417
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user