[feat] expand control bar by default

This commit is contained in:
dijunkun
2024-08-13 11:26:18 +08:00
parent e3abb4e3de
commit 2b4083ee10
3 changed files with 8 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ int Render::ControlBar() {
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
if (control_bar_button_pressed_) {
if (control_bar_expand_) {
ImGui::SetCursorPosX(is_control_bar_in_left_ ? (control_window_width_ + 5)
: 87);
// Mouse control
@@ -50,12 +50,12 @@ int Render::ControlBar() {
is_control_bar_in_left_ ? (control_window_width_ * 2 - 18) : 3);
std::string control_bar =
control_bar_button_pressed_
control_bar_expand_
? (is_control_bar_in_left_ ? ICON_FA_ANGLE_LEFT : ICON_FA_ANGLE_RIGHT)
: (is_control_bar_in_left_ ? ICON_FA_ANGLE_RIGHT
: ICON_FA_ANGLE_LEFT);
if (ImGui::Button(control_bar.c_str(), ImVec2(15, 25))) {
control_bar_button_pressed_ = !control_bar_button_pressed_;
control_bar_expand_ = !control_bar_expand_;
control_bar_button_pressed_time_ = ImGui::GetTime();
control_window_width_is_changing_ = true;
}

View File

@@ -4,7 +4,7 @@
int Render::ControlWindow() {
auto time_duration = ImGui::GetTime() - control_bar_button_pressed_time_;
if (control_window_width_is_changing_) {
if (control_bar_button_pressed_) {
if (control_bar_expand_) {
control_window_width_ =
control_window_min_width_ +
(control_window_max_width_ - control_window_min_width_) * 4 *
@@ -39,7 +39,7 @@ int Render::ControlWindow() {
? title_bar_height_
: (main_window_height_ - control_window_height_));
if (control_bar_button_pressed_) {
if (control_bar_expand_) {
if (control_window_width_ >= control_window_max_width_) {
control_window_width_ = control_window_max_width_;
control_window_width_is_changing_ = false;
@@ -66,7 +66,7 @@ int Render::ControlWindow() {
? title_bar_height_
: (main_window_height_ - control_window_height_));
if (control_bar_button_pressed_) {
if (control_bar_expand_) {
if (control_window_width_ >= control_window_max_width_) {
control_window_width_ = control_window_max_width_;
control_window_width_is_changing_ = false;

View File

@@ -145,7 +145,7 @@ class Render {
int main_window_height_before_maximized_ = 570;
int control_window_min_width_ = 20;
int control_window_max_width_ = 150;
int control_window_width_ = 20;
int control_window_width_ = 150;
int control_window_height_ = 40;
int local_window_width_ = 350;
int status_bar_height_ = 20;
@@ -184,7 +184,7 @@ class Render {
bool connect_button_pressed_ = false;
bool password_validating_ = false;
uint32_t password_validating_time_ = 0;
bool control_bar_button_pressed_ = false;
bool control_bar_expand_ = true;
bool fullscreen_button_pressed_ = false;
bool mouse_control_button_pressed_ = false;
bool show_settings_window_ = false;