Skip to content

Commit 8a7d2c3

Browse files
martinfalissealimpfard
authored andcommitted
Spreadsheet: Rename variables to better describe their function
Rename some variables relating to the drag-and-cut operations as well as the select operation so that they are more clear.
1 parent e98d0da commit 8a7d2c3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Userland/Applications/Spreadsheet/SpreadsheetView.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
7979

8080
m_is_hovering_cut_zone = false;
8181
m_is_hovering_extend_zone = false;
82-
if (selection().size() > 0 && !m_should_intercept_drag) {
82+
if (selection().size() > 0 && !m_is_dragging_for_select) {
8383
// Get top-left and bottom-right most cells of selection
8484
auto bottom_right_most_index = selection().first();
8585
auto top_left_most_index = selection().first();
@@ -134,20 +134,20 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
134134

135135
auto holding_left_button = !!(event.buttons() & GUI::MouseButton::Primary);
136136
if (m_is_dragging_for_copy) {
137-
m_should_intercept_drag = false;
137+
m_is_dragging_for_select = false;
138138
if (holding_left_button) {
139-
m_has_committed_to_dragging = true;
139+
m_has_committed_to_cutting = true;
140140
}
141-
} else if (!m_should_intercept_drag) {
141+
} else if (!m_is_dragging_for_select) {
142142
if (!holding_left_button) {
143143
m_starting_selection_index = index;
144144
} else {
145-
m_should_intercept_drag = true;
145+
m_is_dragging_for_select = true;
146146
m_might_drag = false;
147147
}
148148
}
149149

150-
if (holding_left_button && m_should_intercept_drag && !m_has_committed_to_dragging) {
150+
if (holding_left_button && m_is_dragging_for_select && !m_has_committed_to_cutting) {
151151
if (!m_starting_selection_index.is_valid())
152152
m_starting_selection_index = index;
153153

@@ -189,9 +189,9 @@ void InfinitelyScrollableTableView::mousedown_event(GUI::MouseEvent& event)
189189

190190
void InfinitelyScrollableTableView::mouseup_event(GUI::MouseEvent& event)
191191
{
192-
m_should_intercept_drag = false;
193-
m_has_committed_to_dragging = false;
192+
m_is_dragging_for_select = false;
194193
m_is_dragging_for_copy = false;
194+
m_has_committed_to_cutting = false;
195195
if (m_is_hovering_cut_zone) {
196196
auto rect = content_rect(m_target_cell);
197197
GUI::MouseEvent adjusted_event = { (GUI::Event::Type)event.type(), rect.center(), event.buttons(), event.button(), event.modifiers(), event.wheel_delta_x(), event.wheel_delta_y() };

Userland/Applications/Spreadsheet/SpreadsheetView.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ class InfinitelyScrollableTableView : public GUI::TableView {
7878
virtual void mouseup_event(GUI::MouseEvent&) override;
7979
virtual void drop_event(GUI::DropEvent&) override;
8080

81-
bool m_should_intercept_drag { false };
82-
bool m_has_committed_to_dragging { false };
81+
bool m_is_dragging_for_select { false };
8382
bool m_is_dragging_for_copy { false };
83+
bool m_has_committed_to_cutting { false };
8484
bool m_is_hovering_extend_zone { false };
8585
bool m_is_hovering_cut_zone { false };
8686
GUI::ModelIndex m_starting_selection_index;

0 commit comments

Comments
 (0)