Skip to content

Commit

Permalink
Mandelbrot: Reset position when changing sets.
Browse files Browse the repository at this point in the history
  • Loading branch information
waddlesplash committed Jun 18, 2016
1 parent fb292a3 commit d4bca23
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/apps/mandelbrot/Mandelbrot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class FractalView : public BView {
virtual void MessageReceived(BMessage* msg);
virtual void Draw(BRect updateRect);

void ResetPosition();
void RedrawFractal();
FractalEngine* fFractalEngine;

Expand Down Expand Up @@ -87,6 +88,14 @@ FractalView::~FractalView()
}


void FractalView::ResetPosition()
{
fLocationX = 0;
fLocationY = 0;
fSize = 0.005;
}


void FractalView::AttachedToWindow()
{
fFractalEngine = new FractalEngine(this, Window());
Expand Down Expand Up @@ -119,6 +128,7 @@ void FractalView::Pulse()
RedrawFractal();
}


BRect FractalView::GetDragFrame()
{
BRect dragZone = BRect(std::min(fSelectStart.x, fSelectEnd.x),
Expand Down Expand Up @@ -336,6 +346,7 @@ MandelbrotWindow::MandelbrotWindow(BRect frame)
BMessage msg(FractalEngine::MSG_CHANGE_SET); \
msg.AddUInt8("set", id); \
fFractalView->fFractalEngine->PostMessage(&msg); \
fFractalView->ResetPosition(); \
fFractalView->RedrawFractal(); \
break; \
}
Expand Down

0 comments on commit d4bca23

Please sign in to comment.