From abefe2391d5eb31c728fcb716c7aeb2c3c988155 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Sat, 11 Sep 2021 23:14:15 -0400 Subject: [PATCH] PixelPaint: Add setter/getter for ImageEditor::m_pan_origin This allows us to use tools to change the panned position, since right now this is only accessible internally to the editor. --- Userland/Applications/PixelPaint/ImageEditor.cpp | 9 +++++++++ Userland/Applications/PixelPaint/ImageEditor.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/Userland/Applications/PixelPaint/ImageEditor.cpp b/Userland/Applications/PixelPaint/ImageEditor.cpp index aad67cccc3..3d583ba5fe 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.cpp +++ b/Userland/Applications/PixelPaint/ImageEditor.cpp @@ -568,6 +568,15 @@ void ImageEditor::scale_by(float scale_delta) } } +void ImageEditor::set_pan_origin(Gfx::FloatPoint const& pan_origin) +{ + if (m_pan_origin == pan_origin) + return; + + m_pan_origin = pan_origin; + relayout(); +} + void ImageEditor::fit_image_to_view() { auto viewport_rect = rect(); diff --git a/Userland/Applications/PixelPaint/ImageEditor.h b/Userland/Applications/PixelPaint/ImageEditor.h index 051d03dd25..85ffcf174d 100644 --- a/Userland/Applications/PixelPaint/ImageEditor.h +++ b/Userland/Applications/PixelPaint/ImageEditor.h @@ -58,6 +58,9 @@ public: void reset_scale_and_position(); void scale_by(float); + void set_pan_origin(Gfx::FloatPoint const&); + Gfx::FloatPoint pan_origin() const { return m_pan_origin; } + Color primary_color() const { return m_primary_color; } void set_primary_color(Color);