mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Mandelbrot: Extract reset() method
This commit is contained in:
parent
ad7bfe017f
commit
19068945de
Notes:
sideshowbarker
2024-07-18 06:54:49 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/19068945ded Pull-request: https://github.com/SerenityOS/serenity/pull/9414 Reviewed-by: https://github.com/awesomekling
@ -215,6 +215,8 @@ class Mandelbrot : public GUI::Frame {
|
||||
};
|
||||
void zoom(Zoom in_out, const Gfx::IntPoint& center);
|
||||
|
||||
void reset();
|
||||
|
||||
private:
|
||||
virtual void paint_event(GUI::PaintEvent&) override;
|
||||
virtual void mousedown_event(GUI::MouseEvent& event) override;
|
||||
@ -260,6 +262,12 @@ void Mandelbrot::zoom(Zoom in_out, const Gfx::IntPoint& center)
|
||||
update();
|
||||
}
|
||||
|
||||
void Mandelbrot::reset()
|
||||
{
|
||||
m_set.reset();
|
||||
update();
|
||||
}
|
||||
|
||||
void Mandelbrot::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
Frame::paint_event(event);
|
||||
@ -330,8 +338,7 @@ void Mandelbrot::mouseup_event(GUI::MouseEvent& event)
|
||||
m_panning = false;
|
||||
update();
|
||||
} else if (event.button() == GUI::MouseButton::Right) {
|
||||
m_set.reset();
|
||||
update();
|
||||
reset();
|
||||
}
|
||||
|
||||
return GUI::Widget::mouseup_event(event);
|
||||
|
Loading…
Reference in New Issue
Block a user