summaryrefslogtreecommitdiff
path: root/Applications/Spreadsheet/SpreadsheetView.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-12-22 12:52:59 +0330
committerAndreas Kling <kling@serenityos.org>2020-12-22 23:35:29 +0100
commit8f05e4e765b86d6f350886cdb81d1b3d0ffab085 (patch)
treee4c91f14e8165e079877da7eb00da8b058859b99 /Applications/Spreadsheet/SpreadsheetView.cpp
parentbfb25855cb208d855799906dd2121b3d122ca5ea (diff)
downloadserenity-8f05e4e765b86d6f350886cdb81d1b3d0ffab085.zip
Spreadsheet: Improve sheet update efficiency
There's no need to leave the cell dirty when not updating it, and there's definitely no need to update the cells as we're selecting them. This makes navigating a sheet and selecting cells significantly faster as we no longer update unrelated cells just because they appear to have a cyclic update dependency :^)
Diffstat (limited to 'Applications/Spreadsheet/SpreadsheetView.cpp')
-rw-r--r--Applications/Spreadsheet/SpreadsheetView.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Applications/Spreadsheet/SpreadsheetView.cpp b/Applications/Spreadsheet/SpreadsheetView.cpp
index 9bb417f60f..9762f77578 100644
--- a/Applications/Spreadsheet/SpreadsheetView.cpp
+++ b/Applications/Spreadsheet/SpreadsheetView.cpp
@@ -86,6 +86,10 @@ void InfinitelyScrollableTableView::mousemove_event(GUI::MouseEvent& event)
if (!index.is_valid())
return TableView::mousemove_event(event);
+ auto& sheet = static_cast<SheetModel&>(*model).sheet();
+ sheet.disable_updates();
+ 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());