1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

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

View file

@ -175,6 +175,13 @@ public:
return m_value.as_float; 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 Gfx::IntPoint as_point() const
{ {
return { m_value.as_point.x, m_value.as_point.y }; return { m_value.as_point.x, m_value.as_point.y };