From bad2f1a530b82879dab4c4cff065aab6b1f711c8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 23 Feb 2023 18:05:43 +0100 Subject: a --- editor/imgui.cpp | 3 ++- editor/inspect.cpp | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'editor') diff --git a/editor/imgui.cpp b/editor/imgui.cpp index c26e9987..356caaf4 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -156,7 +156,8 @@ void app::draw_inspector() auto [c, t] = w[*cursor.tile]; if (auto s = t.scenery()) { - ImGui::SetNextWindowSize({400, 0}); + auto dpi = M->dpi_scale(); + ImGui::SetNextWindowSize({300*dpi[0], 0}); auto b = begin_window("inspector"_s); entities::inspect_type(s); } diff --git a/editor/inspect.cpp b/editor/inspect.cpp index ef06671a..02e658b9 100644 --- a/editor/inspect.cpp +++ b/editor/inspect.cpp @@ -71,9 +71,10 @@ template void do_inspect_field(void* datum, const erased_accessor& a { auto [min, max] = accessor.get_range(datum).convert(); constexpr auto igdt = IGDT; + T step = 1, *step_ = !std::is_floating_point_v ? &step : nullptr; switch (repr) { - case field_repr::input: ret = ImGui::InputScalar(label.data(), igdt, &value); break; + case field_repr::input: ret = ImGui::InputScalar(label.data(), igdt, &value, &step_); break; case field_repr::slider: ret = ImGui::SliderScalar(label.data(), igdt, &value, &min, &max); break; case field_repr::drag: ret = ImGui::DragScalar(label.data(), igdt, &value, 1, &min, &max); break; } @@ -81,12 +82,14 @@ template void do_inspect_field(void* datum, const erased_accessor& a } else { + using U = typename T::Type; auto [min, max] = accessor.get_range(datum).convert(); - constexpr auto igdt = IGDT; + constexpr auto igdt = IGDT; + T step = T(U(1)), *step_ = !std::is_floating_point_v ? &step : nullptr; switch (repr) { case field_repr::input: - ret = ImGui::InputScalarN(label.data(), igdt, &value, T::Size); + ret = ImGui::InputScalarN(label.data(), igdt, &value, T::Size, &step_); break; case field_repr::drag: fm_warn_once("can't use imgui input drag mode for vector type"); -- cgit v1.2.3