-
Notifications
You must be signed in to change notification settings - Fork 14
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 "increment" parameter to ProgressBar to define how much increase the value at every input change #54
Comments
Sir, sorry to bother you again. Could you kindly elaborate the feature a little bit? What do you mean by at every input change specifically? Is it just an invocation of the IMHO, despite good documentation, the constructor signature already seems complex enough with multiple optional parameters. Why don't we just use a single object as the argument. For example: // with a single object parameter
new Progress({
x: 3,
y: 23,
length: 20,
id: "prog1",
thickness: 1,
style: pStyle,
theme: "htop",
orientation: "horizontal",
});
// with multiple parameters
new Progress("prog1", 20, 1, 3, 23, pStyle, "htop", "horizontal") The previous one is much more clean and scalable than the current implementation. But if you don't want to change the API then should I just add the increment parameter at the end as an optional one? Thank you. |
Yes, the change of every widget constructor with only one props configuration object is in my plans and it should increment the version to a new major release because of the incompatibility that it will cause. |
And, just to be clear what function will the increment property serve? For example, if I create a new |
It will be usefull for interactions with the mouse wheel if (event.name === "MOUSE_WHEEL_DOWN") {
if (this.value > this.min + 1) {
this.value -= 1 // this is the hardcoded increment
} else {
this.value = this.min
}
this.emit("valueChanged", this.value)
this.update()
}
if (event.name === "MOUSE_WHEEL_UP") {
if (this.value < this.max - 1) {
this.value += 1 // this is the hardcoded increment
} else {
this.value = this.max
}
this.emit("valueChanged", this.value)
this.update()
} This also when will be developed the arrows, on the key listeners. |
Thanks to @h-sifat 🙏 |
@h-sifat feel Thank you for your help! Feel free to propose changes for other things as well. |
No description provided.
The text was updated successfully, but these errors were encountered: