Skip to content

Conversation

@bonnyr
Copy link
Contributor

@bonnyr bonnyr commented Sep 6, 2022

Added a new element to represent Steppers based on popular Nema sizes

Example images:

image

image

@bonnyr
Copy link
Contributor Author

bonnyr commented Sep 10, 2022

@AriellaE any feedback on this PR?

@AriellaE
Copy link
Collaborator

Hi @bonnyr , thank you for creating all these steppers sizes. Can you please implement the size change feature in our original stepper motor?
Please let me know if you need any guidance.

@bonnyr
Copy link
Contributor Author

bonnyr commented Sep 13, 2022

@AriellaE did you mean you want me to modify the original?

@AriellaE
Copy link
Collaborator

@bonnyr yes please

@bonnyr
Copy link
Contributor Author

bonnyr commented Sep 15, 2022

@AriellaE - modified stepper element as requested (removed the added nema-* variant)

Copy link
Collaborator

@AriellaE AriellaE left a comment

Choose a reason for hiding this comment

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

Thank you.

It looks good on the functional level.
I reviewed your changes and added some comments.
In addition here are some general requests:

  1. please format the code with prettier ( run npx prettier --write src/**.ts)
  2. match colors to the original stepper so it looks metallic
  3. units and value texts should go in separate lines, just like the original stepper. the value should have a bigger font.

Bonus: try to make the center of rotation more accurate, so the rotator won't shift as you rotate it.


render() {
const { arrow } = this;
// local vars const ratio = 1; //100 / spec.frameSize;
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in latest commit

{ name: 'B-', y: 237, x: 127, number: 4, signals: [] },
];
render() {
const spec = this.nemaSpecMap[this.size];
Copy link
Collaborator

Choose a reason for hiding this comment

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

please add fallback behavior when size is not valid (e.g. use the values of size 17, or the closest size)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isn't this what happens when specifying the property as one of a set of values?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Storybook does validate the size, but in Wokwi users can change the size on the diagram to an invalid value and then they get an error.

xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
return html`<svg
width="100mm"
Copy link
Collaborator

Choose a reason for hiding this comment

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

SVG size should match the actual size of the graphics. Otherwise, Wokwi will draw the selection rectangle too big when you click on the element.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

are you suggesting that I should vary the generated svg to match the size of the component?
I can do that

1. applied prettier
2. changed shading to make motor look more metalic
3. changed shaft path to ensure it rotates about its center
Copy link
Collaborator

@AriellaE AriellaE left a comment

Choose a reason for hiding this comment

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

It looks very good, thank you!

Few more comments:

  1. Text size of value must always be larger than units (the proportions should be around 14:24) , and now that there are size option to the stepper itself, the texts should grow and shrink as the stepper.
  2. In storybook please cancel the rotation animation(although it very pretty) . You can create a new story that contains the animation, but all the other stories (including default story) should be static with the ability of controlling the angle.

{ name: 'B-', y: 237, x: 127, number: 4, signals: [] },
];
render() {
const spec = this.nemaSpecMap[this.size];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Storybook does validate the size, but in Wokwi users can change the size on the diagram to an invalid value and then they get an error.

1. font size is now different for unit/values
2. removed animation
@bonnyr
Copy link
Contributor Author

bonnyr commented Sep 22, 2022

It looks very good, thank you!
great :)

Few more comments:

  1. Text size of value must always be larger than units (the proportions should be around 14:24) , and now that there are size option to the stepper itself, the texts should grow and shrink as the stepper.

Modified the units property text size to be 2/3 of the value . The text size itself is already a function of the selected instance size (see textSize property value in the NEMASpec class)

  1. In storybook please cancel the rotation animation(although it very pretty) . You can create a new story that contains the animation, but all the other stories (including default story) should be static with the ability of controlling the angle.

Removed animation altogether. For some reason it does not want to work when I apply to Template type stories (all other stories using animation make direct use of storiesOf and friends)

Hope this is it...

@bonnyr
Copy link
Contributor Author

bonnyr commented Sep 29, 2022

@AriellaE - any update?

@AriellaE
Copy link
Collaborator

Hi @bonnyr
I merged the changes released new version and uploaded it to wokwi.com.
Thanks again for contributing to Wokwi!
Shana tova 🍯🍎

@AriellaE AriellaE closed this Sep 29, 2022
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.

3 participants