FractalWidget.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef FRACTALWIDGET_H
  2. #define FRACTALWIDGET_H
  3. #include "FractalZoomWidget.h"
  4. #include <QPropertyAnimation>
  5. #include <chrono>
  6. class FractalWidget :
  7. public FractalZoomWidget
  8. {
  9. Q_OBJECT
  10. bool rubberbanding = false;
  11. QRectF rubberband;
  12. bool dragging = false;
  13. float dragX, dragY;
  14. bool selectingPoint = false;
  15. float pointX, pointY;
  16. bool displayInfo = false;
  17. /// the target of an ongoing animation
  18. mnd::MandelViewport targetViewport;
  19. std::chrono::time_point<std::chrono::high_resolution_clock> lastAnimUpdate;
  20. public:
  21. FractalWidget(QWidget* parent = nullptr);
  22. void mousePressEvent(QMouseEvent* me) override;
  23. void mouseMoveEvent(QMouseEvent* me) override;
  24. void mouseReleaseEvent(QMouseEvent* me) override;
  25. void wheelEvent(QWheelEvent* we) override;
  26. virtual void zoom(float factor) override;
  27. virtual void zoom(float factor, float fx, float fy);
  28. virtual void setViewport(const mnd::MandelViewport& viewport) override;
  29. virtual const mnd::MandelViewport& getViewport(void) const override;
  30. void setDisplayInfo(bool displayInfo);
  31. void selectJuliaPoint(void);
  32. void stopSelectingPoint(void);
  33. virtual void resizeGL(int w, int h) override;
  34. virtual void paintGL(void) override;
  35. void drawDisplayInfo(void);
  36. void drawSelectingPoint(void);
  37. void drawRubberband(void);
  38. signals:
  39. void pointSelected(mnd::Real x, mnd::Real y);
  40. private:
  41. void newAnimation(void);
  42. void updateAnimations(void);
  43. };
  44. #endif // FRACTALWIDGET_H