Skip to content
This repository was archived by the owner on Dec 23, 2021. It is now read-only.

Gesture features for micro:bit #271

Merged
merged 15 commits into from
Mar 24, 2020
Merged

Conversation

xnkevinnguyen
Copy link
Contributor

@xnkevinnguyen xnkevinnguyen commented Mar 20, 2020

Description:

Send gestures via dropdown from the webview to typescript side and then typescript side to python

[AB#34024] and AB#34128

image

.
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Limitations:

Please describe limitations of this PR

Testing:

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • My code has been formatted with npm run format and passes the checks in npm run check
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@vandyliu
Copy link
Contributor

Can we make the dropdown the same length as the "send gesture" button

@vandyliu
Copy link
Contributor

Some other things:

  • make it more obvious that the button is being pressed (change color?)
  • make it so that the cursor changed to a "clickable" cursor
  • make it so that when the send gesture button is focused, you can press enter on it for gesture to be sent

@xnkevinnguyen xnkevinnguyen changed the title WIP: Send gestures to Python side Gesture features for micro:bit Mar 21, 2020
@xnkevinnguyen
Copy link
Contributor Author

Can we make the dropdown the same length as the "send gesture" button

Width is changed

@xnkevinnguyen
Copy link
Contributor Author

Some other things:

  • make it more obvious that the button is being pressed (change color?)
  • make it so that the cursor changed to a "clickable" cursor
  • make it so that when the send gesture button is focused, you can press enter on it for gesture to be sent

When selected, clicking enter will trigger the gestures

Copy link

@nasadigital nasadigital left a comment

Choose a reason for hiding this comment

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

Gestures!!!

Comment on lines 57 to 83
<div className="AccelerometerBar">
<br />
{/* Implement Gestures Here */}
<Dropdown options={GESTURES} onSelect={props.onSelectGestures} />
<SensorButton
label={GESTURE_BUTTON_MESSAGE}
onMouseDown={() => {
if (props.onSendGesture) {
props.onSendGesture(true);
}
}}
onMouseUp={() => {
if (props.onSendGesture) {
props.onSendGesture(false);
}
}}
onKeyDown={(e: React.KeyboardEvent) => {
handleOnKeyDown(e, props.onSendGesture);
}}
onKeyUp={(e: React.KeyboardEvent) => {
handleOnKeyUp(e, props.onSendGesture);
}}
type="gesture"
/>
<ThreeDimensionSlider
axisProperties={MOTION_SENSOR_PROPERTIES}
onUpdateValue={props.onUpdateValue}

Choose a reason for hiding this comment

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

I feel the current UI is a bit confusing. After adjusting the sliders in the bottom, it is a bit unclear whether I need to press the "Send Gesture" button. It is also not clear whether after picking some gesture you need to adjust the sliders as well or not (E.g. it is unclear whether picking a gesture and clicking the send gesture button is enough or if you also need to adjust the sliders).
What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is some good feedback, do you think if we make the instruction clearer it would help?
Maybe something like: "Select a gesture then press the button to send the gestures or you could change acceleration manually with the sliders."

Choose a reason for hiding this comment

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

To be honest, it's very tricky and I am not super familiar with UX design. I would consult someone who would be more familiar like the design interns or Katelynn.
If I had to come up with something (keeping in mind our timeline), I think maybe separating the gestures from the accelerometer sliders would clear up things. Up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok understandable. What I'm thinking of doing with the time constraints is separate in the same modal the manual acceleration and sending gestures. Separating the 2 sensors would require extra work and svgs that we don't currently have.

Comment on lines 63 to 67
onMouseDown={() => {
if (props.onSendGesture) {
props.onSendGesture(true);
}
}}

Choose a reason for hiding this comment

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

You can replace this with:

onMouseDown={() => props.onSendGesture?.(true)}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like this functions optional chaining with the typescript version we have is not compatible. This could be added when we update the typescript version. Since this doesn't affect user experience, I will not include this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

function optional chaining is available with TS 3.7.0

Copy link

@nasadigital nasadigital left a comment

Choose a reason for hiding this comment

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

Thanks for addressing comments! LGTM 👍 👍 👍

@xnkevinnguyen xnkevinnguyen merged commit 3f5c81a into dev Mar 24, 2020
@vandyliu vandyliu deleted the users/t-xunguy/gestures-microbit branch March 24, 2020 18:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants