Skip to content

Instantly share code, notes, and snippets.

@colinkiama
Last active November 5, 2022 15:37
Show Gist options
  • Save colinkiama/b7e55ced7848c86a8572aa906e2cdb6e to your computer and use it in GitHub Desktop.
Save colinkiama/b7e55ced7848c86a8572aa906e2cdb6e to your computer and use it in GitHub Desktop.
elementary Spreadsheet App Multiselection Notes
So it's possible to make each individual cell render by simply changing the cell.selected property to true.
The issue now is that the Sheet widget' cell selection logic is is written only for selecting one shell. There's no concept of multiple cell selection at all.
To remedy this, two major steps need to be taken:
- Completely rewrite the Sheet widget (start from scratch) in a multi-selction-first way (Use a collection to store selected ranges by default etc)
- Add a drag event that draws a selection area over time. As the mouse moves, update the selected cells based on the selected cells area.
- The selected cells should be re-evaluated based on whenever one or cells get removed from the selection area
- You will need to take into account that columns and rows can be resized so you'll need to keep track of the size of the next row cells and column cells before deciding to select/deselect them.
- Holding down CTRL while clicking or dragging allow additional selections to be added along with the existing ones.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment