FractalWidget.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. bool didDrag = false;
  14. float dragX, dragY;
  15. bool selectingPoint = false;
  16. float pointX, pointY;
  17. bool displayInfo = false;
  18. /// the target of an ongoing animation
  19. mnd::MandelViewport targetViewport;
  20. std::chrono::time_point<std::chrono::high_resolution_clock> lastAnimUpdate;
  21. public:
  22. FractalWidget(QWidget* parent = nullptr);
  23. void mousePressEvent(QMouseEvent* me) override;
  24. void mouseMoveEvent(QMouseEvent* me) override;
  25. void mouseReleaseEvent(QMouseEvent* me) override;
  26. void wheelEvent(QWheelEvent* we) override;
  27. virtual void zoom(float factor) override;
  28. virtual void zoom(float factor, float fx, float fy);
  29. virtual void setViewport(const mnd::MandelViewport& viewport) override;
  30. virtual const mnd::MandelViewport& getViewport(void) const override;
  31. void setDisplayInfo(bool displayInfo);
  32. void selectJuliaPoint(void);
  33. void stopSelectingPoint(void);
  34. virtual void resizeGL(int w, int h) override;
  35. virtual void paintGL(void) override;
  36. void drawDisplayInfo(void);
  37. void drawSelectingPoint(void);
  38. void drawRubberband(void);
  39. signals:
  40. void pointSelected(mnd::Real x, mnd::Real y);
  41. private:
  42. void newAnimation(void);
  43. void updateAnimations(void);
  44. };
  45. #endif // FRACTALWIDGET_H