mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[feat] show net traffic stats in control bar
This commit is contained in:
@@ -17,6 +17,21 @@ int Render::ControlWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
time_duration = ImGui::GetTime() - net_traffic_stats_button_pressed_time_;
|
||||
if (control_window_height_is_changing_) {
|
||||
if (control_bar_expand_ && net_traffic_stats_button_pressed_) {
|
||||
control_window_height_ =
|
||||
control_window_min_height_ +
|
||||
(control_window_max_height_ - control_window_min_height_) * 4 *
|
||||
time_duration;
|
||||
} else if (control_bar_expand_ && !net_traffic_stats_button_pressed_) {
|
||||
control_window_height_ =
|
||||
control_window_max_height_ -
|
||||
(control_window_max_height_ - control_window_min_height_) * 4 *
|
||||
time_duration;
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(1, 1, 1, 1));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 0));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 10.0f);
|
||||
@@ -96,6 +111,24 @@ int Render::ControlWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
if (control_bar_expand_ && control_window_height_is_changing_) {
|
||||
if (net_traffic_stats_button_pressed_) {
|
||||
if (control_window_height_ >= control_window_max_height_) {
|
||||
control_window_height_ = control_window_max_height_;
|
||||
control_window_height_is_changing_ = false;
|
||||
} else {
|
||||
control_window_height_is_changing_ = true;
|
||||
}
|
||||
} else {
|
||||
if (control_window_height_ <= control_window_min_height_) {
|
||||
control_window_height_ = control_window_min_height_;
|
||||
control_window_height_is_changing_ = false;
|
||||
} else {
|
||||
control_window_height_is_changing_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Begin("ControlWindow", nullptr,
|
||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_NoScrollbar |
|
||||
|
||||
Reference in New Issue
Block a user