-
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
Move math functions to a math/
folder
#1390
Conversation
GeraldRequired Reviewers
Don't want to be involved in this pull request? Comment |
npm Snapshot: PublishedGood news!! We've packaged up the latest commit from this PR (8416af8) and published it to npm. You Example: yarn add @khanacademy/perseus@PR1390 If you are working in Khan Academy's webapp, you can run: ./dev/tools/bump_perseus_version.sh -t PR1390 |
Size Change: +568 B (+0.07%) Total Size: 850 kB
ℹ️ View Unchanged
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1390 +/- ##
==========================================
+ Coverage 69.61% 70.82% +1.20%
==========================================
Files 493 504 +11
Lines 104305 104589 +284
Branches 7511 10634 +3123
==========================================
+ Hits 72612 74075 +1463
+ Misses 31513 30514 -999
+ Partials 180 0 -180
... and 148 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
]); | ||
} | ||
|
||
export function ensureValid(box: Box): Box { |
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.
I like the comments for the other functions. Perhaps we could have one here, too? Mostly because I don't know what setting the min/max values to the average does.
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.
I think ensureValid
is the wrong abstraction. The behavior of setting the values to the average is specific to inset
. The purpose of setting min and max to the average is that the center of the box should not be changed by inset
.
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.
I've reworked this code. Let me know what you think!
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.
That makes a LOT more sense! Thank you!!
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 singular-function files (i.e. clamp.ts
and coordiantes.ts
) feel a bit light to me, but I understand the intent. I think that the organization and comments and tests help greatly to make this more readable.
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @khanacademy/[email protected] ### Minor Changes - [#1384](#1384) [`5de483386`](5de4833) Thanks [@catandthemachines](https://github.com/catandthemachines)! - Updating TabBar experience in to use arrow-key navigation to access the other TabItems. This will ensure the Expression Widget in perseus has proper keyboard navigation for users. ## @khanacademy/[email protected] ### Minor Changes - [#1383](#1383) [`4b56e10de`](4b56e10) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - View Locked Functions in the Interactive Graph - [#1392](#1392) [`b710d07db`](b710d07) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of new angle graph for Mafs interactive graph widget ### Patch Changes - [#1390](#1390) [`7e6ccf38d`](7e6ccf3) Thanks [@benchristel](https://github.com/benchristel)! - Internal: Move graphing-agnostic, mathy functions in the interactive graph code to a math/ folder. - Updated dependencies \[[`5de483386`](5de4833)]: - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - [#1383](#1383) [`4b56e10de`](4b56e10) Thanks [@mark-fitzgerald](https://github.com/mark-fitzgerald)! - View Locked Functions in the Interactive Graph - [#1390](#1390) [`7e6ccf38d`](7e6ccf3) Thanks [@benchristel](https://github.com/benchristel)! - Internal: Move graphing-agnostic, mathy functions in the interactive graph code to a math/ folder. - [#1392](#1392) [`b710d07db`](b710d07) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Creation of new angle graph for Mafs interactive graph widget - Updated dependencies \[[`4b56e10de`](4b56e10), [`7e6ccf38d`](7e6ccf3), [`5de483386`](5de4833), [`b710d07db`](b710d07)]: - @khanacademy/[email protected] - @khanacademy/[email protected] ## @khanacademy/[email protected] ### Patch Changes - Updated dependencies \[[`5de483386`](5de4833)]: - @khanacademy/[email protected]
Note to reviewers: it's going to be easiest to review this PR one commit
at a time!
This is the first part of a multi-part refactor. I am submitting this
intermediate PR to get feedback and hopefully avoid running into too many
merge conflicts.
In future PRs, I plan to:
math/
kmath
inmath/index.ts
, possiblywrapping them with more suitable type signatures
Adding a
math/
folder gives us a clear place to put new mathy functions,and will help us locate and reuse the functions that already exist.
Issue: LEMS-2135
Test plan:
yarn test