forked from Green-Sky/tomato
only render avatars if visible
This commit is contained in:
parent
c887fdac8a
commit
05b0a2f514
@ -95,6 +95,12 @@ void renderAvatar(
|
||||
const Contact3Handle c,
|
||||
ImVec2 box
|
||||
) {
|
||||
// deploy dummy of same size and check visibility
|
||||
const auto orig_curser_pos = ImGui::GetCursorPos();
|
||||
ImGui::Dummy(box);
|
||||
if (ImGui::IsItemVisible()) {
|
||||
ImGui::SetCursorPos(orig_curser_pos); // reset for actual img
|
||||
|
||||
ImVec4 color_current = th.getColor<ThemeCol_Contact::avatar_offline>();
|
||||
if (c.all_of<Contact::Components::ConnectionState>()) {
|
||||
const auto c_state = c.get<Contact::Components::ConnectionState>().state;
|
||||
@ -105,14 +111,6 @@ void renderAvatar(
|
||||
}
|
||||
}
|
||||
|
||||
// icon pos
|
||||
auto p0 = ImGui::GetCursorScreenPos();
|
||||
p0.x += box.x * 0.5f;
|
||||
p0.y += box.y * 0.5f;
|
||||
auto p1_o = box;
|
||||
p1_o.x *= 0.5f;
|
||||
p1_o.y *= 0.5f;
|
||||
|
||||
// avatar
|
||||
const auto [id, width, height] = contact_tc.get(c);
|
||||
ImGui::Image(
|
||||
@ -123,7 +121,7 @@ void renderAvatar(
|
||||
{1, 1, 1, 1},
|
||||
color_current
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
bool renderContactBig(
|
||||
|
Loading…
Reference in New Issue
Block a user