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

feat(annotations): Handle annotations staged change event #1247

Merged
merged 7 commits into from
Sep 9, 2020

Conversation

mxiao6
Copy link
Contributor

@mxiao6 mxiao6 commented Sep 3, 2020

@mxiao6 mxiao6 force-pushed the staged-change-event branch 2 times, most recently from 099951d to 553ff81 Compare September 4, 2020 00:25
src/lib/AnnotationControls.ts Outdated Show resolved Hide resolved
src/lib/AnnotationControls.ts Outdated Show resolved Hide resolved
src/lib/viewers/BaseViewer.js Outdated Show resolved Hide resolved
@mxiao6 mxiao6 force-pushed the staged-change-event branch 3 times, most recently from 89d0a72 to 4d0e9a6 Compare September 8, 2020 20:56
@mxiao6 mxiao6 force-pushed the staged-change-event branch from 4d0e9a6 to 8b266be Compare September 8, 2020 22:02
@mxiao6 mxiao6 force-pushed the staged-change-event branch from 8b266be to 7f8a098 Compare September 9, 2020 00:14
@mxiao6 mxiao6 requested a review from ConradJChan September 9, 2020 00:27
src/lib/AnnotationControls.ts Outdated Show resolved Hide resolved
src/lib/AnnotationFSM.ts Outdated Show resolved Hide resolved
src/lib/AnnotationFSM.ts Outdated Show resolved Hide resolved
src/lib/AnnotationFSM.ts Outdated Show resolved Hide resolved
src/lib/AnnotationFSM.ts Outdated Show resolved Hide resolved
src/lib/AnnotationControlsFSM.ts Outdated Show resolved Hide resolved
src/lib/viewers/BaseViewer.js Outdated Show resolved Hide resolved
@ConradJChan
Copy link
Contributor

ConradJChan commented Sep 9, 2020

Might be worth writing the unit tests for the fsm so that we can make sure all the transitions are covered even though this is just a draft right now

Copy link
Contributor

@ConradJChan ConradJChan left a comment

Choose a reason for hiding this comment

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

Does the type still need to be passed into the transition call here: 6118793#diff-c7f4ce178012f15dc209092ae0c317f9R1269?

@@ -33,7 +39,7 @@ export const stateModeMap = {
export default class AnnotationControlsFSM {
private currentState = AnnotationState.NONE;

public transition = (input: AnnotationInput, mode: AnnotationMode): AnnotationMode => {
public transition = (input: AnnotationInput, mode: AnnotationMode = AnnotationMode.NONE): AnnotationMode => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Having mode default to none seems ripe for bugs to be introduced. Would it work if it was just optionally undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The state in FSM cannot be undefined, so if mode is undefined and state transition depends on mode, the state has to be none which is the same as default mode to none.

@mxiao6
Copy link
Contributor Author

mxiao6 commented Sep 9, 2020

Does the type still need to be passed into the transition call here: 6118793#diff-c7f4ce178012f15dc209092ae0c317f9R1269?

type is needed to determine next state is HIGHLIGHT_TEMP or REGION_TEMP.

src/lib/AnnotationControlsFSM.ts Outdated Show resolved Hide resolved
src/lib/__tests__/AnnotationControlsFSM-test.js Outdated Show resolved Hide resolved
state: AnnotationState.NONE,
input: AnnotationInput.CLICK,
mode: AnnotationMode.HIGHLIGHT,
nextState: AnnotationState.HIGHLIGHT,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does nextState and output ever differ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nextState could be highlight_temp and output is highlight

@mxiao6 mxiao6 marked this pull request as ready for review September 9, 2020 21:17
@mxiao6 mxiao6 requested a review from a team as a code owner September 9, 2020 21:17
@mxiao6 mxiao6 force-pushed the staged-change-event branch from bd613d3 to 4828358 Compare September 9, 2020 23:03
@mergify mergify bot merged commit 37e7003 into box:master Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants