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

PixelPaint: Display a preview image when scaling with the move tool

A preview of the scaled image and an outline of the updated layer
boundary are now shown when scaling with the move tool.
This commit is contained in:
Tim Ledbetter 2022-12-14 18:00:30 +00:00 committed by Sam Atkins
parent 7b4e5d6ac0
commit 5ba0b551f4
2 changed files with 48 additions and 8 deletions

View file

@ -22,10 +22,12 @@ public:
virtual void on_mouseup(Layer*, MouseEvent&) override;
virtual bool on_keydown(GUI::KeyEvent&) override;
virtual void on_keyup(GUI::KeyEvent&) override;
virtual void on_second_paint(Layer const*, GUI::PaintEvent&) override;
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override;
private:
virtual StringView tool_name() const override { return "Move Tool"sv; }
ErrorOr<void> update_cached_preview_bitmap(Layer const* layer);
RefPtr<Layer> m_layer_being_moved;
Gfx::IntPoint m_event_origin;
@ -35,6 +37,8 @@ private:
bool m_scaling { false };
bool m_mouse_in_resize_corner { false };
bool m_keep_ascept_ratio { false };
RefPtr<Gfx::Bitmap> m_cached_preview_bitmap { nullptr };
};
}