mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:47:34 +00:00
ImageViewer: Don't resize window on image rotation or flip
This commit is contained in:
parent
fd0b809d54
commit
5cceae821d
2 changed files with 9 additions and 8 deletions
|
@ -48,19 +48,13 @@ void ViewWidget::clear()
|
||||||
void ViewWidget::flip(Gfx::Orientation orientation)
|
void ViewWidget::flip(Gfx::Orientation orientation)
|
||||||
{
|
{
|
||||||
m_bitmap = m_bitmap->flipped(orientation).release_value_but_fixme_should_propagate_errors();
|
m_bitmap = m_bitmap->flipped(orientation).release_value_but_fixme_should_propagate_errors();
|
||||||
set_original_rect(m_bitmap->rect());
|
scale_image_for_window();
|
||||||
set_scale(scale());
|
|
||||||
|
|
||||||
resize_window();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewWidget::rotate(Gfx::RotationDirection rotation_direction)
|
void ViewWidget::rotate(Gfx::RotationDirection rotation_direction)
|
||||||
{
|
{
|
||||||
m_bitmap = m_bitmap->rotated(rotation_direction).release_value_but_fixme_should_propagate_errors();
|
m_bitmap = m_bitmap->rotated(rotation_direction).release_value_but_fixme_should_propagate_errors();
|
||||||
set_original_rect(m_bitmap->rect());
|
scale_image_for_window();
|
||||||
set_scale(scale());
|
|
||||||
|
|
||||||
resize_window();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ViewWidget::is_next_available() const
|
bool ViewWidget::is_next_available() const
|
||||||
|
@ -215,6 +209,12 @@ void ViewWidget::drop_event(GUI::DropEvent& event)
|
||||||
on_drop(event);
|
on_drop(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewWidget::scale_image_for_window()
|
||||||
|
{
|
||||||
|
set_original_rect(m_bitmap->rect());
|
||||||
|
fit_content_to_view(GUI::AbstractZoomPanWidget::FitType::Both);
|
||||||
|
}
|
||||||
|
|
||||||
void ViewWidget::resize_window()
|
void ViewWidget::resize_window()
|
||||||
{
|
{
|
||||||
if (window()->is_fullscreen() || window()->is_maximized())
|
if (window()->is_fullscreen() || window()->is_maximized())
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
void set_scaled_for_first_image(bool val) { m_scaled_for_first_image = val; }
|
void set_scaled_for_first_image(bool val) { m_scaled_for_first_image = val; }
|
||||||
void set_path(DeprecatedString const& path);
|
void set_path(DeprecatedString const& path);
|
||||||
void resize_window();
|
void resize_window();
|
||||||
|
void scale_image_for_window();
|
||||||
void set_scaling_mode(Gfx::Painter::ScalingMode);
|
void set_scaling_mode(Gfx::Painter::ScalingMode);
|
||||||
|
|
||||||
bool is_next_available() const;
|
bool is_next_available() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue