mirror of
https://github.com/polybar/polybar.git
synced 2024-11-18 13:55:11 -05:00
fix(builder): Cap percentage values
This commit is contained in:
parent
8caa95de7f
commit
911b862f06
1 changed files with 3 additions and 2 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "bar.hpp"
|
||||
#include "services/builder.hpp"
|
||||
#include "utils/string.hpp"
|
||||
#include "utils/math.hpp"
|
||||
|
||||
// Private
|
||||
|
||||
|
@ -191,7 +192,7 @@ void Builder::node(std::string str, int font_index, bool add_space)
|
|||
|
||||
void Builder::node(drawtypes::Bar *bar, float percentage, bool add_space)
|
||||
{
|
||||
this->node(bar->get_output(percentage), add_space);
|
||||
this->node(bar->get_output(math::cap<float>(percentage, 0, 100)), add_space);
|
||||
}
|
||||
|
||||
void Builder::node(std::unique_ptr<drawtypes::Bar> &bar, float percentage, bool add_space) {
|
||||
|
@ -248,7 +249,7 @@ void Builder::node(std::unique_ptr<drawtypes::Icon> &icon, bool add_space) {
|
|||
}
|
||||
|
||||
void Builder::node(drawtypes::Ramp *ramp, float percentage, bool add_space) {
|
||||
if (*ramp) this->node(ramp->get_by_percentage(percentage), add_space);
|
||||
if (*ramp) this->node(ramp->get_by_percentage(math::cap<float>(percentage, 0, 100)), add_space);
|
||||
}
|
||||
|
||||
void Builder::node(std::unique_ptr<drawtypes::Ramp> &ramp, float percentage, bool add_space) {
|
||||
|
|
Loading…
Reference in a new issue