1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 11:15:10 +00:00

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 :^)
This commit is contained in:
AnotherTest 2020-12-22 12:52:59 +03:30 committed by Andreas Kling
parent bfb25855cb
commit 8f05e4e765
5 changed files with 35 additions and 6 deletions

View file

@ -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());