-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make the tiles on a selection a struct of info, not twinned lists #143
make the tiles on a selection a struct of info, not twinned lists #143
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @bmschmidt and the rest of your teammates on |
88d83ae
to
2d77111
Compare
b59865f
to
6fda8c1
Compare
Merge activity
|
2d77111
to
89d917d
Compare
6fda8c1
to
3c779e2
Compare
// The match count is the number of matches **per tile**; | ||
// used to access numbers by index. | ||
public matchCount?: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The matchCount
property in SelectionTile
is optional, but it is always used as a number. It should be initialized to 0 in the constructor to avoid potential undefined errors.
public matchCount?: number; | |
public matchCount: number = 0; |
3c779e2
to
927fc1c
Compare
let current_tile_ix = 0; | ||
for (const match_length of this.match_count) { | ||
const tile = this.tiles[current_tile_ix]; | ||
for (const { tile, matchCount } of this.tiles) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure 'matchCount' is defined before using it in destructuring assignments. This applies to other instances like lines 728 and 642.
Currently, selections maintain a list of tiles and a list of how many matches there are in them that are guaranteed to be the same length by code.
It's better to have a list of records where each record contains both of these facts; we'll be using these much more to store sort information in a bit.
refactor: use
SelectionTile
inDataSelection
for tile managementSummary:
Refactor
DataSelection
to useSelectionTile
for managing tiles and match counts, simplifying data handling and preparing for future enhancements.Key points:
DataSelection
to useSelectionTile
for managing tiles and match counts.SelectionTile
class insrc/selection.ts
.tiles
andmatch_count
lists with a single list ofSelectionTile
objects.moveCursorToPoint()
,add_or_remove_points()
,wrapWithSelectionMetadata()
.SelectionTile
.Generated with ❤️ by ellipsis.dev