无语了
This commit is contained in:
@@ -23,12 +23,8 @@
|
||||
#include <vector>
|
||||
namespace renderive::web {
|
||||
namespace {
|
||||
template <class T>
|
||||
const T& state_value(const Gallery_State& state, std::string_view id) {
|
||||
return std::get<T>(state.values.at(std::string(id)));
|
||||
}
|
||||
double number_value(const Gallery_State& state, std::string_view id) {
|
||||
return state_value<double>(state, id);
|
||||
return std::get<double>(gallery_property_value(state, id));
|
||||
}
|
||||
std::uint64_t milliseconds_to_ns(double milliseconds) {
|
||||
return milliseconds > 0.0 ? static_cast<std::uint64_t>(std::llround(milliseconds * 1'000'000.0)) : 0;
|
||||
@@ -40,13 +36,13 @@ int integer_value(const Gallery_State& state, std::string_view id) {
|
||||
return static_cast<int>(std::lround(number_value(state, id)));
|
||||
}
|
||||
bool bool_value(const Gallery_State& state, std::string_view id) {
|
||||
return state_value<bool>(state, id);
|
||||
return std::get<bool>(gallery_property_value(state, id));
|
||||
}
|
||||
const std::string& string_value(const Gallery_State& state, std::string_view id) {
|
||||
return state_value<std::string>(state, id);
|
||||
std::string string_value(const Gallery_State& state, std::string_view id) {
|
||||
return std::get<std::string>(gallery_property_value(state, id));
|
||||
}
|
||||
bool has_value(const Gallery_State& state, std::string_view id) {
|
||||
return state.values.contains(id);
|
||||
return gallery_has_property(state, id);
|
||||
}
|
||||
int hex_digit(char value) {
|
||||
if (value >= '0' && value <= '9')
|
||||
@@ -245,10 +241,8 @@ public:
|
||||
}
|
||||
[[nodiscard]] bool requires_rebuild(const Gallery_State& candidate) const {
|
||||
const auto changed = [this, &candidate](std::string_view id) {
|
||||
const auto current = state_.values.find(id);
|
||||
const auto next = candidate.values.find(id);
|
||||
return current != state_.values.end() && next != candidate.values.end() &&
|
||||
current->second != next->second;
|
||||
return gallery_has_property(state_, id) && gallery_has_property(candidate, id) &&
|
||||
gallery_property_value(state_, id) != gallery_property_value(candidate, id);
|
||||
};
|
||||
if (case_id_ == "frequency_trace")
|
||||
return changed("trace_pen") || changed("trace_pen_width");
|
||||
|
||||
Reference in New Issue
Block a user