1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:58:14 +00:00

LibDraw: Add orientation-based size helpers to Size as well.

Now you can ask for e.g Size::primary_size_for_orientation(Orientation).
This commit is contained in:
Andreas Kling 2019-07-20 22:16:40 +02:00
parent c59b053ad6
commit 2a14ba99a7
2 changed files with 31 additions and 25 deletions

View file

@ -138,31 +138,10 @@ public:
int secondary_offset_for_orientation(Orientation orientation) const { return m_location.secondary_offset_for_orientation(orientation); }
void set_secondary_offset_for_orientation(Orientation orientation, int value) { m_location.set_secondary_offset_for_orientation(orientation, value); }
int primary_size_for_orientation(Orientation orientation) const
{
return orientation == Orientation::Vertical ? height() : width();
}
void set_primary_size_for_orientation(Orientation orientation, int value)
{
if (orientation == Orientation::Vertical)
set_height(value);
else
set_width(value);
}
int secondary_size_for_orientation(Orientation orientation) const
{
return orientation == Orientation::Vertical ? width() : height();
}
void set_secondary_size_for_orientation(Orientation orientation, int value)
{
if (orientation == Orientation::Vertical)
set_width(value);
else
set_height(value);
}
int primary_size_for_orientation(Orientation orientation) const { return m_size.primary_size_for_orientation(orientation); }
int secondary_size_for_orientation(Orientation orientation) const { return m_size.secondary_size_for_orientation(orientation); }
void set_primary_size_for_orientation(Orientation orientation, int value) { m_size.set_primary_size_for_orientation(orientation, value); }
void set_secondary_size_for_orientation(Orientation orientation, int value) { m_size.set_secondary_size_for_orientation(orientation, value); }
int first_edge_for_orientation(Orientation orientation) const
{