summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-12-10 14:10:10 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-12-10 14:10:10 +0100
commit104c24241a0fd5697ae1a6bf8c2ce5d29bf1ba97 (patch)
treed1879bbd33396833e860b6adcf087cb7da7ff01c
parent2508a1865bf393335b1bf674a8e1e7995a313b53 (diff)
gui: fix setting spline snap value
value<t>::valueChanged didn't fire on exact same value anymore.
-rw-r--r--gui/mapping-dialog.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/gui/mapping-dialog.cpp b/gui/mapping-dialog.cpp
index 8d754b6b..dc003e0a 100644
--- a/gui/mapping-dialog.cpp
+++ b/gui/mapping-dialog.cpp
@@ -123,23 +123,21 @@ void MapWidget::load()
qfc.force_redraw();
}
- connect(&axis.opts.clamp_x_, base_value::signal_fun<int>(),
- &qfc, [i, &conf, &qfc](int value) {
+ auto update_snap = [i, &conf, &qfc](int value) {
//qfc.reload_spline();
qfc.set_x_step(value + 1e-2 >= 90 ? 10 : 5);
if (i >= 3)
qfc.set_snap(1, 2.5);
else
- {
- const double x_snap = std::fmax(.5, conf.max_input() / 100.);
- qfc.set_snap(x_snap, 1);
- }
- });
+ qfc.set_snap(.5, .5);
+ };
+
+ connect(&axis.opts.clamp_x_, base_value::value_changed<int>(), &qfc, update_snap);
// force signal to avoid duplicating the slot's logic
qfc.setConfig(&conf);
- axis.opts.clamp_x_.valueChanged(axis.opts.clamp_x_);
+ update_snap(axis.opts.clamp_x_.to<int>());
widgets[i % 6][altp ? 1 : 0] = &qfc;
}