LibGUI: Add Variant::as_float_or(fallback)

This commit is contained in:
Andreas Kling 2021-07-27 17:23:04 +02:00
parent 49b9683381
commit 2d1eff01a2
Notes: sideshowbarker 2024-07-18 08:02:37 +09:00

View file

@ -175,6 +175,13 @@ public:
return m_value.as_float;
}
float as_float_or(float fallback) const
{
if (is_float())
return as_float();
return fallback;
}
Gfx::IntPoint as_point() const
{
return { m_value.as_point.x, m_value.as_point.y };