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/remove handles after creating the slider #1275

Open
Tlepel opened this issue Jun 24, 2024 · 2 comments
Open

Add/remove handles after creating the slider #1275

Tlepel opened this issue Jun 24, 2024 · 2 comments

Comments

@Tlepel
Copy link

Tlepel commented Jun 24, 2024

Summary

It would be amazing if this library would also support dynamically adding/removing sliders.

Context

In my use-case it would be a great addition, my current workaround would be to destroy the slider instance and create a new one in its place, with the added/removed slider included in the config. However, that feels like a workaround that has a bigger (although not huge) impact on performace compared to a native API to achieve the same thing

How it would work

  • The exposed API would have a method addHandle(connectionOption? = false) that allows you to add a handle to the end of the slider and set the connect option for the section between this new handle and the previous last handle.
  • The exposed API would have a method removeHandle(handleNumber?: number, connectionOption?: boolean) that allows you to remove a handle (or the last one if no handle number is provided) and which sets the connectionOption for the 2 sections that were merged into 1
@leongersen
Copy link
Owner

For your use case, are you looking to add/remove an arbitrary number of handles, or are you toggling between states?

@Tlepel
Copy link
Author

Tlepel commented Jun 24, 2024

It's a semi-arbitrary number, with a minimum of 1 and a maximum of 4 handles.

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

No branches or pull requests

2 participants