summaryrefslogtreecommitdiffhomepage
path: root/editor/inspect.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-02-23 09:51:16 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-02-23 09:51:16 +0100
commit26b537d5f2e4e48e0c183cca30ecb056a41cd3be (patch)
tree9e9501ceab6ab0f264eecef96afac8270fc9133f /editor/inspect.cpp
parent7d4f172bd280e77175f617f36673d99f50580d36 (diff)
wip
Diffstat (limited to 'editor/inspect.cpp')
-rw-r--r--editor/inspect.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/editor/inspect.cpp b/editor/inspect.cpp
index 69734866..41986a19 100644
--- a/editor/inspect.cpp
+++ b/editor/inspect.cpp
@@ -79,8 +79,7 @@ template<typename T> void do_inspect_field(void* datum, const erased_accessor& a
}
else
{
- auto [min_, max_] = accessor.get_range(datum).convert<typename T::Type>();
- Math::Vector<T::Size, typename T::Type> min(min_), max(max_);
+ auto [min, max] = accessor.get_range(datum).convert<T>();
constexpr auto igdt = IGDT<typename T::Type>;
switch (repr)
{
@@ -94,6 +93,8 @@ template<typename T> void do_inspect_field(void* datum, const erased_accessor& a
ret = ImGui::SliderScalarN(label.data(), igdt, &value, T::Size, &min, &max);
break;
}
+ for (std::size_t i = 0; i < T::Size; i++)
+ value[i] = std::clamp(value[i], min[i], max[i]);
}
ImGui::NewLine();