Numworks Epsilon  1.4.1
Graphing Calculator Operating System
simple_interactive_curve_view_controller.cpp
Go to the documentation of this file.
2 #include <cmath>
3 #include <assert.h>
4 
5 using namespace Poincare;
6 
7 namespace Shared {
8 
9 SimpleInteractiveCurveViewController::SimpleInteractiveCurveViewController(Responder * parentResponder,InteractiveCurveViewRange * interactiveRange, CurveView * curveView, CurveViewCursor * cursor) :
10  ViewController(parentResponder),
11  m_cursor(cursor)
12 {
13 }
14 
16  return curveView();
17 }
18 
20  if (event == Ion::Events::Plus || event == Ion::Events::Minus) {
21  return handleZoom(event);
22  }
23  if (event == Ion::Events::Left || event == Ion::Events::Right) {
24  return handleLeftRightEvent(event);
25  }
26  if (event == Ion::Events::EXE || event == Ion::Events::OK) {
27  return handleEnter();
28  }
29  return false;
30 }
31 
33  float ratio = event == Ion::Events::Plus ? 2.0f/3.0f : 3.0f/2.0f;
35  curveView()->reload();
36  return true;
37 }
38 
40  int direction = event == Ion::Events::Left ? -1 : 1;
41  if (moveCursorHorizontally(direction)) {
43  curveView()->reload();
44  return true;
45  }
46  return false;
47 }
48 
49 }
constexpr Event Plus
Definition: events.h:107
constexpr Event Minus
Definition: events.h:108
constexpr Event EXE
Definition: events.h:114
void zoom(float ratio, float x, float y)
constexpr Event Left
Definition: events.h:61
Definition: view.h:23
constexpr Event Right
Definition: events.h:64
virtual void reload()
Definition: curve_view.cpp:25
virtual InteractiveCurveViewRange * interactiveCurveViewRange()=0
constexpr Event OK
Definition: events.h:65