diff options
-rw-r--r-- | editor/imgui.cpp | 3 | ||||
-rw-r--r-- | editor/inspect.cpp | 9 |
2 files changed, 8 insertions, 4 deletions
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<typename T> void do_inspect_field(void* datum, const erased_accessor& a { 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; 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<typename T> void do_inspect_field(void* datum, const erased_accessor& a } else { + using U = typename T::Type; auto [min, max] = accessor.get_range(datum).convert<T>(); - constexpr auto igdt = IGDT<typename T::Type>; + constexpr auto igdt = IGDT<U>; + T step = T(U(1)), *step_ = !std::is_floating_point_v<U> ? &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"); |