void mandelPanel_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) //zoom in { //add current statee to list MandelState state = new MandelState(middle, scale, maxLoop); stateList.Add(state); //calculate new middle + zoom middle = mandelImage.pixelToMandelPoint(e.X, e.Y); scale /= 2; } else if (e.Button == MouseButtons.Right) //zoom out { if (stateList.Count == 0) { return; //don't refresh when there is no previous state } // loads the previous settings in textfields scale = stateList.Last().scale; middle = stateList.Last().middle; maxLoop = stateList.Last().maxLoop; stateList.Remove(stateList.Last()); } refreshImage(); fillTextFields(); }
void mandelPanel_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) //zoom in { //add current statee to list MandelState state = new MandelState(middle, scale, maxLoop); stateList.Add(state); //calculate new middle + zoom middle = mandelImage.pixelToMandelPoint(e.X, e.Y); scale /= 2; } else if (e.Button == MouseButtons.Right) //zoom out { if (stateList.Count == 0) return; //don't refresh when there is no previous state // loads the previous settings in textfields scale = stateList.Last().scale; middle = stateList.Last().middle; maxLoop = stateList.Last().maxLoop; stateList.Remove(stateList.Last()); } refreshImage(); fillTextFields(); }