-
Notifications
You must be signed in to change notification settings - Fork 0
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
Change step grid #181
base: main
Are you sure you want to change the base?
Change step grid #181
Conversation
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.
Nice work! Left some suggestions for you. And here's some comments on the questions you brought up
I have not yet changed the coordinate rounding function. Could someone tells me where it is called so I can figure out how best to change it?
Are you referring to BaseTool:roundCoordinateToGrid
? https://github.com/calband/calchart-redesign/blob/main/src/tools/BaseTool.ts#L19
The old logic for horizontal grid generation explicitly avoided generating grid lines on yard lines unless the yard lines were removed. However, to make it easier to extend to 1-step and 4-step grids, I changed the logic to resemble the vertical lines, and therefore redundantly generates grid lines on top of yardlines. Should we strive to keep gridline generation non-redundant, or would it be easier in the long run to keep it as I have it? For reference, the old X-Offset function is present, but commented out.
This is fine, a couple of additional lines for the grid won't hurt! Honestly it was a performance optimization that wasn't really needed. The browser can handle thousands of SVG elements.
Due to the dimensions of the field, the 4 Step grid leaves a small horizontal space at the bottom of the field. Should we keep 4 Step grid generation as is, or should we change it somehow?
(Note that this is actually an 8 step grid that you are referring to) Great catch! This is fine, it's bound to happen... We could consider doing a grid offset? Like make the grid start from a different Y position (like -4 shifts the grid up 4 steps)? Let's create an issue for that just to keep that on our backlog.
// retVal.push(offsetX); | ||
// } | ||
// return retVal; | ||
// }, | ||
fourStepGridOffsetsX(): 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.
Let's rename this and fourStepGridOffsetsY
to something more generic
let offsetX = gridSize * 2; | ||
offsetX < this.fieldWidth; | ||
offsetX += gridSize * 2 |
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.
You don't have to multiply by 2 here, the X/Y scale should be 1 spacing unit to 1 step. Notice in the screenshots that the 4 step grid is actually an 8 step grid (there should be a vertical line in between each line yard, since each line yard is 8 steps between each other).
<b-navbar-dropdown label="Grid" data-test="menu-top--grid"> | ||
<b-navbar-item | ||
data-test="menu-top--grid-one" | ||
@click="changeStepGrid(1)" | ||
> | ||
One Step | ||
</b-navbar-item> | ||
<b-navbar-item | ||
data-test="menu-top--grid-two" | ||
@click="changeStepGrid(2)" | ||
> | ||
Two Step | ||
</b-navbar-item> | ||
<b-navbar-item | ||
data-test="menu-top--grid-four" | ||
@click="changeStepGrid(4)" | ||
> | ||
Four Step | ||
</b-navbar-item> | ||
</b-navbar-dropdown> |
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.
This works okay, but I don't think this should be it's own top navbar item. We should reserve creating a new dropdown at the top level for new categories (For example, see the top menu of any program you use, "File", "Edit", "View", "Help", etc.)
Let's consider other options... How about the bottom menu next to all the tool icons?
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.
src/store/index.ts
Outdated
@@ -40,6 +40,8 @@ export class CalChartState extends Serializable<CalChartState> { | |||
|
|||
showDotLabels = true; | |||
|
|||
gridSize = 2; |
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.
Once the x2 comment is resolved in GrapherField
, let's update this
gridSize = 2; | |
gridSize = 4; |
Description
This PR adds a new dropdown to the top menu, Grid, which allows the user to change the grid size. However, there are some issues I would like to address, both on my end and in general.
Addresses issue #62
Problems
Pre-PR checklist
npm run serve
and:npm run lint
npm run test:unit
npm run test:e2e
and ran relevant testsScreenshots/GIFs