summaryrefslogtreecommitdiffhomepage
path: root/gui
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-04-12 01:42:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-04-12 01:49:52 +0200
commit8731b350d7210505994fdfec6dc1cfa4bbf015d7 (patch)
treedd0701d6746edb56a85648b11eb05b9833d215d3 /gui
parent3a9e32e7c8c6df97720ba569ef64131b086ad281 (diff)
gui/mapping: allow for up to 100 cm translation
Defaults to 30 cm as before. Changes X snap value for larger max value. Related-to: #352
Diffstat (limited to 'gui')
-rw-r--r--gui/mapping-window.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/gui/mapping-window.cpp b/gui/mapping-window.cpp
index 5f61d31f..71282d84 100644
--- a/gui/mapping-window.cpp
+++ b/gui/mapping-window.cpp
@@ -65,7 +65,7 @@ void MapWidget::load()
x->addItem(QString::number(y) + "°", y);
for (QComboBox* x : { ui.max_x_translation, ui.max_y_translation, ui.max_z_translation })
- for (a y : { a::t30, a::t20, a::t15, a::t10 })
+ for (a y : { a::t30, a::t20, a::t15, a::t10, a::t100 })
x->addItem(QStringLiteral("%1 cm").arg(int(y)), y);
for (int i = 0; qfcs[i].qfc; i++)
@@ -87,20 +87,22 @@ void MapWidget::load()
}
connect(&axis.opts.clamp, static_cast<void(base_value::*)(int) const>(&base_value::valueChanged),
- &qfc, [&conf, &qfc](int value) {
+ &qfc, [i, &conf, &qfc](int value) {
conf.set_max_input(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::max(.5, conf.max_input() / 100.);
+ qfc.set_snap(x_snap, 1);
+ }
});
// force signal to avoid duplicating the slot's logic
- axis.opts.clamp.valueChanged(axis.opts.clamp);
-
- if (qfcs[i].axis >= 3)
- qfcs[i].qfc->set_snap(1, 2.5);
- else
- qfcs[i].qfc->set_snap(.5, 1);
-
qfcs[i].qfc->setConfig(&conf);
+ axis.opts.clamp.valueChanged(axis.opts.clamp);
}
}