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

Add switch tool #41

Closed
AmoebeLabs opened this issue Dec 20, 2020 · 0 comments
Closed

Add switch tool #41

AmoebeLabs opened this issue Dec 20, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request tool/switch About the switch tool

Comments

@AmoebeLabs
Copy link
Owner

The Problem To Be Solved

Add a basic switch tool as a very compact button to switch and show on/off values.
This can also be done using existing tools and adding animations depending on the on/off state like `transform: translateX()' to move the thumb, but it is not very user friendly.

(Optional): Suggested Solution

The solution uses standard svg objects, and a predefined animation:

  • rectangle to draw the track
  • rectangle to draw the thumb

This means that one can also style rectangle tracks and thumbs. Default is round as the default switch.

  • animations for on and off to move the thumb and switch the color for the track and thumb.

Note:

If a user wants to change the styling and more, he/she should define the full animation to overwrite the default animation.

Note 2:

There is still a bug in Merge.mergeDeep() which simply concatenates arrays, ie also animations. And the animations stop when a match is found, ie the first animation in the array...

This can be solved either by:

  • using an id to merge the array elements
  • continue to find a match in the animation array instead of stopping when a match is found
@AmoebeLabs AmoebeLabs added enhancement New feature or request tool/switch About the switch tool labels Dec 20, 2020
@AmoebeLabs AmoebeLabs added this to the Public release milestone Dec 20, 2020
@AmoebeLabs AmoebeLabs self-assigned this Dec 20, 2020
AmoebeLabs added a commit that referenced this issue Dec 20, 2020
Add switch tool (#41)
AmoebeLabs added a commit that referenced this issue Dec 20, 2020
AmoebeLabs added a commit that referenced this issue Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request tool/switch About the switch tool
Projects
None yet
Development

No branches or pull requests

1 participant