Fix position of Tooltips

CanvasItem::get_screen_transform returns a transform from the CanvasItem
to the coordinate system, where a Popup - created as a child of the
CanvasItem - should be opened.
get_screen_transform makes some simplifications, that work well, when used
in the editor, but not in general cases.

Since Popups like Tooltips are now used more commonly in projects,
it becomes necessary to correct these simplifications.

This solution introduces Viewport::get_popup_base_transform, which makes
the necessary calculations.
This commit is contained in:
Markus Sauermann 2022-11-13 21:38:29 +01:00
parent b05e1e7d69
commit c4ed247f5f
5 changed files with 32 additions and 11 deletions

View file

@ -314,6 +314,7 @@ public:
int get_theme_default_font_size() const;
virtual Transform2D get_screen_transform() const override;
virtual Transform2D get_popup_base_transform() const override;
Rect2i get_parent_rect() const;
virtual DisplayServer::WindowID get_window_id() const override;