-
Notifications
You must be signed in to change notification settings - Fork 10
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
Allow for undo burst functionality (#36) #37
Conversation
Jason pointed that the undo burst button was not showing when you capture a burst with no frames previously captured. This was because the render method for Burst is conditionally rendering the button based on whether or not there were frames in state before the capture. Not the best logic. I added a straightforward boolean called canUndo that is used to check whether or not the button should be rendered. This is set to true on burst capture, and set to false on undo. |
src/components/Burst.js
Outdated
async handleRequestBurst() { | ||
this.setState({ isCapturing: true }); | ||
const { requestBurst, expanded, frames, frameIDs, ...imgOpts } = this.props; | ||
// grab calculator state prior to capture |
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.
With some of your nicely named function names, some of these comments may not be necessary :)
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.
Done
src/lib/calc-helpers.js
Outdated
@@ -39,3 +39,13 @@ export const setSliderByIndex = (idx, val) => { | |||
const identifier = match[1]; | |||
calculator.setExpression({ id, latex: `${identifier}=${val}` }); | |||
}; | |||
|
|||
// gets current state of calculator instance |
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.
Comments may not be necessary for these functions, they are perfectly described by their name
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.
Done
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's possible to interrupt the capture mid-way through processing with the 'UNDO' button, resulting in only a partial burst. I wouldn't display the option to undo until the burst capture has been completed.
Fixed |
I also added a componentDidUpdate to the burst component to check when new frames (individual frames) are added to state after a burst is captured. This way once a user captures a new frame with the camera button, indicating they're happy with the burst, the undo burst button goes away. |
Implemented 'undo burst' functionality (issue #36).
Summary: