summaryrefslogtreecommitdiffhomepage
path: root/editor/inspect.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-02-24 09:19:19 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-02-24 09:19:19 +0100
commite9311fe8a12d7834b0d910edd65eacc5e732a0ff (patch)
tree517fb2e20298f5095fdc18a1800c2a807dc879a4 /editor/inspect.cpp
parent83bca7d6861a701e8ba383a93076f346db393a33 (diff)
a
Diffstat (limited to 'editor/inspect.cpp')
-rw-r--r--editor/inspect.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/editor/inspect.cpp b/editor/inspect.cpp
index aa17029a..d17ebf74 100644
--- a/editor/inspect.cpp
+++ b/editor/inspect.cpp
@@ -97,11 +97,12 @@ void do_inspect_field(void* datum, const erased_accessor& accessor, field_repr r
{
auto [min, max] = accessor.get_range(datum).convert<T>();
constexpr auto igdt = IGDT<T>;
- T step(1), *step_ = !std::is_floating_point_v<T> ? &step : nullptr;
+ constexpr T step(!std::is_floating_point_v<T> ? T(1) : T(1e-6f)),
+ step2(!std::is_floating_point_v<T> ? T(10) : T(1e-3f));
switch (repr)
{
default: fm_warn_once("invalid repr enum value '%zu'", (std::size_t)repr); break;
- case field_repr::input: ret = ImGui::InputScalar(label, igdt, &value, step_); break;
+ case field_repr::input: ret = ImGui::InputScalar(label, igdt, &value, &step, &step2); break;
case field_repr::slider: ret = ImGui::SliderScalar(label, igdt, &value, &min, &max); break;
case field_repr::drag: ret = ImGui::DragScalar(label, igdt, &value, 1, &min, &max); break;
case field_repr::cbx: {
@@ -135,14 +136,15 @@ void do_inspect_field(void* datum, const erased_accessor& accessor, field_repr r
using U = typename T::Type;
auto [min, max] = accessor.get_range(datum).convert<T>();
constexpr auto igdt = IGDT<U>;
- T step = T(U(1)), *step_ = !std::is_floating_point_v<U> ? &step : nullptr;
+ constexpr T step(!std::is_floating_point_v<U> ? U(1) : U(1e-6f)),
+ step2(!std::is_floating_point_v<U> ? U(10) : U(1e-3f));
switch (repr)
{
default:
fm_warn_once("invalid repr enum value '%zu'", (std::size_t)repr);
break;
case field_repr::input:
- ret = ImGui::InputScalarN(label, igdt, &value, T::Size, step_);
+ ret = ImGui::InputScalarN(label, igdt, &value, T::Size, &step, &step2);
break;
case field_repr::drag:
fm_warn_once("can't use imgui input drag mode for vector type");