Skip to content
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

Settings bounds #27 #8

Merged
merged 14 commits into from
Jun 24, 2019
Merged

Conversation

danieljaeim
Copy link

Added functionality to enable users to have controls over their math bounds in screenshot captures (#7 )

I started by creating additional inputs for top, bottom, left, and right bounds that correspond to the edges of the image returned from the asyncScreenshot() method.
I also added a dropdown to denote the user's choice of image setting between ('contain', 'stretch, 'preserveY', preserveX').

59640759-f60d8c80-9113-11e9-9afb-be6ff7f8b470

I then added the left, right, top, and bottom values from our inputs to our redux-store, passing them onto the Settings.js Component through the SettingsContainer. Now our settingsComponent could update and refer to our bound values from the store.

I then updated the settings action creator to account for the UPDATE_BOUNDS_SETTING, which adjusts our store's left, right, top, and bottom values as the user changes them live.

Now when we fetch an image from the API through the requestFrame() method, we also pass in an object 'mathBounds', that act as additional parameters for the async ScreenShot() method, accounting for errors such as if our left bound is greater than our right bound, or whether our bottom bound is greater than our top bound.

I finally adjusted the errors in requestFrame, to account for invalidBounds. Now when a user tries to capture the graph and send a request to the API, it validates whether the bounds follow protocol
(left bound is less than right, bottom bound is less than top), and flashes an error to the top-banner if an error occurs.

I also wrote tests for these as well, and they work in making sure our bounds are correct :)

Copy link

@misscoded misscoded left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the .env and address wrapper declaration and this should be ready to be merged. :shipit:

.env Outdated
@@ -0,0 +1 @@
SKIP_PREFLIGHT_CHECK=true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.env files should not be checked into the codebase. This needs to be removed.

@@ -6,6 +6,7 @@ afterEach(cleanup);

describe('<App/>', () => {
it('renders without crashing', () => {
let wrapper = global.renderWithRedux(<App />);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was commented on in your existing open PR that it should be removed.

@danieljaeim danieljaeim force-pushed the rithm-settings-bounds branch from f0087d1 to 4b70862 Compare June 24, 2019 18:59
@misscoded misscoded merged commit 7c731ac into rithmschool:master Jun 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants