Skip to content

Commit 928ae81

Browse files
committed
multislider improvements
1 parent 062a80d commit 928ae81

File tree

1 file changed

+5
-23
lines changed

1 file changed

+5
-23
lines changed

examples/Advanced/UI/Multislider.hpp

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct MultisliderWidget
5454
}
5555
else
5656
{
57-
ctx.set_fill_color({100, 150, 255, 255});
57+
ctx.set_fill_color({255, 176, 30, 255});
5858
}
5959
ctx.begin_path();
6060
ctx.draw_rect(x, height() - fillHeight, sliderWidth, fillHeight);
@@ -64,9 +64,10 @@ struct MultisliderWidget
6464
if (executing && idx < runtimeValues.size())
6565
{
6666
double runtimeHeight = runtimeValues[idx] * height();
67-
ctx.set_fill_color({255, 100, 100, 100});
67+
ctx.set_fill_color({255, 220, 60, 100});
6868
ctx.begin_path();
69-
ctx.draw_rect(x, height() - runtimeHeight, sliderWidth, runtimeHeight);
69+
ctx.draw_rect(
70+
x, height() - runtimeHeight, std::max(2., sliderWidth), runtimeHeight);
7071
ctx.fill();
7172
}
7273

@@ -130,22 +131,6 @@ struct MultisliderWidget
130131
}
131132
}
132133

133-
bool key(int key)
134-
{
135-
// Reset selected slider to default value with R key
136-
if (key == 'r' || key == 'R')
137-
{
138-
if (selectedCursor >= 0 && selectedCursor < value.size())
139-
{
140-
value[selectedCursor] = 0.5f;
141-
if (on_value_changed)
142-
on_value_changed();
143-
return true;
144-
}
145-
}
146-
return false;
147-
}
148-
149134
void reset()
150135
{
151136
executing = false;
@@ -178,7 +163,7 @@ struct Multislider
178163

179164
struct ins
180165
{
181-
struct : halp::spinbox_i32<"Count", halp::range{.min = 1, .max = 20, .init = 4}>
166+
struct : halp::spinbox_i32<"Count", halp::range{.min = 1, .max = 200, .init = 4}>
182167
{
183168
void update(Multislider& self) { self.updateCursorCount(); }
184169
} count;
@@ -269,9 +254,6 @@ struct Multislider
269254
void operator()(halp::tick t)
270255
{
271256
update_ui();
272-
for(float v : inputs.cursors.value)
273-
fprintf(stderr, "%f ", v);
274-
fprintf(stderr, "\n");
275257
outputs.cursors.value = inputs.cursors.value;
276258
}
277259

0 commit comments

Comments
 (0)