[apps/shared] Create ZoomCurveViewController:

SimpleInteractiveCurveViewController inherits from
ZoomCurveViewController
This commit is contained in:
Émilie Feral
2020-03-23 12:27:11 +01:00
parent 7d48d4e7c4
commit 52b6508d6c
5 changed files with 60 additions and 27 deletions

View File

@@ -6,16 +6,6 @@ using namespace Poincare;
namespace Shared {
SimpleInteractiveCurveViewController::SimpleInteractiveCurveViewController(Responder * parentResponder, CurveViewCursor * cursor) :
ViewController(parentResponder),
m_cursor(cursor)
{
}
View * SimpleInteractiveCurveViewController::view() {
return curveView();
}
bool SimpleInteractiveCurveViewController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Plus || event == Ion::Events::Minus) {
return handleZoom(event);
@@ -36,13 +26,6 @@ bool SimpleInteractiveCurveViewController::textFieldDidReceiveEvent(TextField *
return TextFieldDelegate::textFieldDidReceiveEvent(textField, event);
}
bool SimpleInteractiveCurveViewController::handleZoom(Ion::Events::Event event) {
float ratio = event == Ion::Events::Plus ? 2.0f/3.0f : 3.0f/2.0f;
interactiveCurveViewRange()->zoom(ratio, m_cursor->x(), m_cursor->y());
curveView()->reload();
return true;
}
bool SimpleInteractiveCurveViewController::handleLeftRightEvent(Ion::Events::Event event) {
int direction = event == Ion::Events::Left ? -1 : 1;
if (moveCursorHorizontally(direction, Ion::Events::isLongRepetition())) {