UI improvements

This commit is contained in:
ahsanswr
2026-07-26 17:24:36 +02:00
committed by Guillaume Meunier
parent b7d17db0c7
commit 5e359fe983
8 changed files with 104 additions and 68 deletions
+8
View File
@@ -1261,6 +1261,14 @@ imgui_context::viewport & imgui_context::layer(ImVec2 position)
return layers_.front();
}
void imgui_context::place_layer_relative(size_t layer, size_t base, glm::vec3 offset, glm::quat extra_rotation)
{
const viewport & b = layers_[base];
viewport & l = layers_[layer];
l.orientation = b.orientation * extra_rotation;
l.position = b.position + glm::mat3_cast(b.orientation) * offset;
}
void imgui_context::tooltip(std::string_view text, std::optional<ImVec2> anchor)
{
// FIXME: this is incorrect if we use the docking branch of imgui
+4
View File
@@ -226,6 +226,10 @@ public:
return layers_;
}
// Place a satellite layer (popup, keyboard, …) relative to a base layer: same
// orientation as the base (optionally post-rotated), offset in the base's local frame.
void place_layer_relative(size_t layer, size_t base, glm::vec3 offset, glm::quat extra_rotation = glm::quat(1, 0, 0, 0));
std::vector<window_viewport> windows();
viewport & layer(ImVec2 position);