-
Notifications
You must be signed in to change notification settings - Fork 350
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
[Interactive Graph Editor: Storybook] Add a story for Point graph type start coords #1482
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@khanacademy/perseus": patch | ||
"@khanacademy/perseus-editor": patch | ||
--- | ||
|
||
[Interactive Graph Editor: Storybook] Add a story for Point graph type start coords |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,7 +95,11 @@ export const StatefulMafsGraph = React.forwardRef< | |
); | ||
}, [dispatch, xMinRange, xMaxRange, yMinRange, yMaxRange]); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Might be helpful to have some comments here explaining what this chunk is for. Apologies, should have added that when I worked on this section too! |
||
// Update the graph whenever any of the following values changes. | ||
// This is necessary to keep the graph previews in sync with the updated | ||
// graph settings within the interative graph editor. | ||
const numSegments = graph.type === "segment" ? graph.numSegments : null; | ||
const numPoints = graph.type === "point" ? graph.numPoints : null; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment: I wonder if there is a good way for us to leave a note/reminder about needing to add new information like this here and to the useEffect below. 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm really not sure how to do that in a way that's helpful/visible 🤔 |
||
const numSides = graph.type === "polygon" ? graph.numSides : null; | ||
const snapTo = graph.type === "polygon" ? graph.snapTo : null; | ||
const showAngles = graph.type === "polygon" ? graph.showAngles : null; | ||
|
@@ -113,6 +117,7 @@ export const StatefulMafsGraph = React.forwardRef< | |
} | ||
}, [ | ||
graph.type, | ||
numPoints, | ||
numSegments, | ||
numSides, | ||
snapTo, | ||
|
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.
Question: I don't think this affects this PR, but you mentioned in the summary that you changed this so it "calculates the correct coords itself." How does it do that?
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.
If I don't pass in any coords, then the graph automatically initializes with the default starting coords in
initialize-graph-state.ts
when it renders. If I hard-code it here, it doesn't initialize to the right one based on the number of points. I could also call the initializer function here, but that would be redundant.