LibGUI: Add Variant::as_float_or(fallback)
This commit is contained in:
parent
49b9683381
commit
2d1eff01a2
Notes:
sideshowbarker
2024-07-18 08:02:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2d1eff01a24
1 changed files with 7 additions and 0 deletions
|
@ -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 };
|
||||
|
|
Loading…
Add table
Reference in a new issue