summaryrefslogtreecommitdiff
path: root/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Applications/Spreadsheet/SpreadsheetView.cpp')
-rw-r--r--Userland/Applications/Spreadsheet/SpreadsheetView.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
index 345be3846d..b0d2322e94 100644
--- a/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
+++ b/Userland/Applications/Spreadsheet/SpreadsheetView.cpp
@@ -83,14 +83,13 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
ScopeGuard sheet_update_enabler { [&] { sheet.enable_updates(); } };
auto holding_left_button = !!(event.buttons() & GUI::MouseButton::Left);
- auto rect = content_rect(index);
- auto distance = rect.center().absolute_relative_distance_to(event.position());
- if (distance.x() >= rect.width() / 2 - 5 && distance.y() >= rect.height() / 2 - 5) {
+ if (m_is_dragging_for_copy) {
set_override_cursor(Gfx::StandardCursor::Crosshair);
m_should_intercept_drag = false;
if (holding_left_button) {
m_has_committed_to_dragging = true;
// Force a drag to happen by moving the mousedown position to the center of the cell.
+ auto rect = content_rect(index);
m_left_mousedown_position = rect.center();
}
} else if (!m_should_intercept_drag) {
@@ -125,6 +124,17 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
TableView::mousemove_event(event);
}
+void InfinitelyScrollableTableView::mousedown_event(GUI::MouseEvent& event)
+{
+ if (this->model()) {
+ auto index = index_at_event_position(event.position());
+ auto rect = content_rect(index);
+ auto distance = rect.center().absolute_relative_distance_to(event.position());
+ m_is_dragging_for_copy = distance.x() >= rect.width() / 2 - 5 && distance.y() >= rect.height() / 2 - 5;
+ }
+ AbstractTableView::mousedown_event(event);
+}
+
void InfinitelyScrollableTableView::mouseup_event(GUI::MouseEvent& event)
{
m_should_intercept_drag = false;