-
Notifications
You must be signed in to change notification settings - Fork 369
refactor: locked polygon points shape #3705
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
126165f
3c5dcc8
e508266
3c11b2b
c327e6b
2a6e73b
0d9c3c2
cf7875f
b2acb96
815a548
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,8 @@ | ||
| --- | ||
| "@khanacademy/perseus-core": major | ||
| "@khanacademy/perseus": minor | ||
| "@khanacademy/perseus-editor": minor | ||
| "@khanacademy/perseus-linter": minor | ||
| --- | ||
|
|
||
| Change shape of `LockedPolygonType.points` from `[]Coord` to `LockedPolygonPointType`. This is to support adding fields to the Locked Polygon points in the future. Callers should migrate to using the new shape. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,9 +140,9 @@ export default { | |
| { | ||
| type: "polygon", | ||
| points: [ | ||
| [-8, -7], | ||
| [-8, -3], | ||
| [-4, -3], | ||
| {coord: [-8, -7]}, | ||
| {coord: [-8, -3]}, | ||
| {coord: [-4, -3]}, | ||
|
Collaborator
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. These See my comment at the top of this file.
Author
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. Ah, thanks for the heads up! I missed the note at the top of the file. Do we need a regression test in this context, or is unit testing the parser enough?
Collaborator
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. You should add a new file with this new data format. That way we ensure that our parser remains compatible with all previous known schema versions and supports the new version. |
||
| ], | ||
| color: "pink", | ||
| showVertices: false, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1179,11 +1179,7 @@ describe("generateIGLockedPolygon", () => { | |
| // Assert | ||
| expect(lockedPolygon).toEqual({ | ||
| type: "polygon", | ||
| points: [ | ||
| [0, 2], | ||
| [-1, 0], | ||
| [1, 0], | ||
| ], | ||
| points: [{coord: [0, 2]}, {coord: [-1, 0]}, {coord: [1, 0]}], | ||
|
Collaborator
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. nit: I'm not sure if prettier chose this, but the original, multi-line layout reads more easily. No worries if this new inline layout if
Author
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. Prettier doesn't allow: points: [
{ coord: [1, 1] },
{ coord: [2, 2] },
{ coord: [3, 3] },
],but does allow: points: [
{
coord: [1, 1],
},
{
coord: [2, 2],
},
{
coord: [3, 3],
},
],which mirrors the labels below, so I'll update it to that. |
||
| color: "grayH", | ||
| showVertices: false, | ||
| fillStyle: "none", | ||
|
|
@@ -1196,11 +1192,7 @@ describe("generateIGLockedPolygon", () => { | |
| it("builds a locked polygon with all props", () => { | ||
| // Arrange, Act | ||
| const lockedPolygon = generateIGLockedPolygon({ | ||
| points: [ | ||
| [1, 1], | ||
| [2, 2], | ||
| [3, 3], | ||
| ], | ||
| points: [{coord: [1, 1]}, {coord: [2, 2]}, {coord: [3, 3]}], | ||
| color: "blue", | ||
| showVertices: true, | ||
| fillStyle: "solid", | ||
|
|
@@ -1221,11 +1213,7 @@ describe("generateIGLockedPolygon", () => { | |
| // Assert | ||
| expect(lockedPolygon).toEqual({ | ||
| type: "polygon", | ||
| points: [ | ||
| [1, 1], | ||
| [2, 2], | ||
| [3, 3], | ||
| ], | ||
| points: [{coord: [1, 1]}, {coord: [2, 2]}, {coord: [3, 3]}], | ||
| color: "blue", | ||
| showVertices: true, | ||
| fillStyle: "solid", | ||
|
|
||
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.
It might be nice to add a comment here explaining the intention to add more data in the LockedPolygonPointType, but it's not strictly neccessary
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.
To clarify, I intend on merging the stacked PRs together as one schema change. I will be sure to get the Go schema change deployed first once the target schema is finalized.