1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:57:35 +00:00

LibGfx+Overall: Remove is_null from Point, Rect and Size

Having a `Point`, `Rect` or `Size` claim it's `null` is silly. We have
`Optional<T>` for that. For `Point`, rename `is_null` to `is_zero` to
better reflect what we're testing. For `Rect` and `Size`, `is_null` is
removed outright.

Also, remove `is_empty` from `Point`. Points can't be empty.
This commit is contained in:
Jelle Raaijmakers 2022-12-28 22:43:30 +01:00 committed by Tim Flynn
parent d5630bd20e
commit 7b0adee487
12 changed files with 20 additions and 22 deletions

View file

@ -13,7 +13,7 @@ constexpr float wheel_zoom_factor = 8.0f;
void AbstractZoomPanWidget::set_scale(float new_scale)
{
if (m_original_rect.is_null())
if (m_original_rect.is_empty())
return;
m_scale = clamp(new_scale, m_min_scale, m_max_scale);
@ -36,7 +36,7 @@ void AbstractZoomPanWidget::scale_by(float delta)
void AbstractZoomPanWidget::scale_centered(float new_scale, Gfx::IntPoint center)
{
if (m_original_rect.is_null())
if (m_original_rect.is_empty())
return;
new_scale = clamp(new_scale, m_min_scale, m_max_scale);
@ -154,7 +154,7 @@ void AbstractZoomPanWidget::mouseup_event(GUI::MouseEvent& event)
void AbstractZoomPanWidget::relayout()
{
if (m_original_rect.is_null())
if (m_original_rect.is_empty())
return;
m_content_rect.set_location({