From 4f6ff3052583d299fe02ede91cc23f3b8c618ed2 Mon Sep 17 00:00:00 2001 From: Timon Ensel Date: Mon, 28 Oct 2024 19:39:19 +0100 Subject: [PATCH] remove resize attributes from commit windows --- src/core/OSTreeTUI.cpp | 4 --- src/core/commitComponent.cpp | 68 ++---------------------------------- 2 files changed, 3 insertions(+), 69 deletions(-) diff --git a/src/core/OSTreeTUI.cpp b/src/core/OSTreeTUI.cpp index 5b929f0..f6ec1b3 100644 --- a/src/core/OSTreeTUI.cpp +++ b/src/core/OSTreeTUI.cpp @@ -204,10 +204,6 @@ int OSTreeTUI::main(const std::string& repo, const std::vector& sta .top = i * 4, .width = 30, .height = 4, - .resize_left = false, - .resize_right = false, - .resize_top = false, - .resize_down = false, }) ); i++; diff --git a/src/core/commitComponent.cpp b/src/core/commitComponent.cpp index a7ec0ea..b093f93 100644 --- a/src/core/commitComponent.cpp +++ b/src/core/commitComponent.cpp @@ -104,12 +104,7 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions { element, title(), Active(), - drag_, - resize_left_ || resize_right_ || resize_down_ || resize_top_, - (resize_left_hover_ || resize_left_) && captureable, - (resize_right_hover_ || resize_right_) && captureable, - (resize_top_hover_ || resize_top_) && captureable, - (resize_down_hover_ || resize_down_) && captureable, + drag_ }; element = render ? render(state) : DefaultRenderState(state); @@ -156,23 +151,8 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions { mouse_hover_ = box_window_.Contain(event.mouse().x, event.mouse().y); - resize_down_hover_ = false; - resize_top_hover_ = false; - resize_left_hover_ = false; - resize_right_hover_ = false; - if (mouse_hover_) { - resize_left_hover_ = event.mouse().x == left() + box_.x_min; - resize_right_hover_ = - event.mouse().x == left() + width() - 1 + box_.x_min; - resize_top_hover_ = event.mouse().y == top() + box_.y_min; - resize_down_hover_ = event.mouse().y == top() + height() - 1 + box_.y_min; - - // Apply the component options: - resize_top_hover_ &= resize_top(); - resize_left_hover_ &= resize_left(); - resize_down_hover_ &= resize_down(); - resize_right_hover_ &= resize_right(); + // TODO indicate window is draggable? } if (captured_mouse_) { @@ -195,24 +175,6 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions { return true; } - if (resize_left_) { - width() = left() + width() - event.mouse().x + box_.x_min; - left() = event.mouse().x - box_.x_min; - } - - if (resize_right_) { - width() = event.mouse().x - resize_start_x - box_.x_min; - } - - if (resize_top_) { - height() = top() + height() - event.mouse().y + box_.y_min; - top() = event.mouse().y - box_.y_min; - } - - if (resize_down_) { - height() = event.mouse().y - resize_start_y - box_.y_min; - } - if (drag_) { left() = event.mouse().x - drag_start_x - box_.x_min; top() = event.mouse().y - drag_start_y - box_.y_min; @@ -246,11 +208,6 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions { return true; } - resize_left_ = false; - resize_right_ = false; - resize_top_ = false; - resize_down_ = false; - if (!mouse_hover_) { return false; } @@ -273,19 +230,11 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions { return true; } - resize_left_ = resize_left_hover_; - resize_right_ = resize_right_hover_; - resize_top_ = resize_top_hover_; - resize_down_ = resize_down_hover_; - - resize_start_x = event.mouse().x - width() - box_.x_min; - resize_start_y = event.mouse().y - height() - box_.y_min; drag_start_x = event.mouse().x - left() - box_.x_min; drag_start_y = event.mouse().y - top() - box_.y_min; - // Drag only if we are not resizeing a border yet: bool drag_old = drag_; - drag_ = !resize_right_ && !resize_down_ && !resize_top_ && !resize_left_; + drag_ = true; if (!drag_old && drag_) { // if we start dragging drag_initial_x = left(); drag_initial_y = top(); @@ -300,8 +249,6 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions { CapturedMouse captured_mouse_; int drag_start_x = 0; int drag_start_y = 0; - int resize_start_x = 0; - int resize_start_y = 0; int drag_initial_x = 0; int drag_initial_y = 0; @@ -310,15 +257,6 @@ class CommitComponentImpl : public ComponentBase, public WindowOptions { bool mouse_hover_ = false; bool drag_ = false; - bool resize_top_ = false; - bool resize_left_ = false; - bool resize_down_ = false; - bool resize_right_ = false; - - bool resize_top_hover_ = false; - bool resize_left_hover_ = false; - bool resize_down_hover_ = false; - bool resize_right_hover_ = false; int& scroll_offset;