[apps] Sequence: Term Sum Controller inherits from

SimpleInteractiveCurveViewController (enable Zoom in/out)
This commit is contained in:
Émilie Feral
2018-01-09 11:18:36 +01:00
committed by EmilieNumworks
parent 323ecc72c5
commit 3a1d652a07
2 changed files with 16 additions and 9 deletions

View File

@@ -15,12 +15,11 @@ using namespace Poincare;
namespace Sequence {
TermSumController::TermSumController(Responder * parentResponder, GraphView * graphView, CurveViewRange * graphRange, CurveViewCursor * cursor) :
ViewController(parentResponder),
SimpleInteractiveCurveViewController(parentResponder, graphRange, graphView, cursor),
m_graphView(graphView),
m_legendView(),
m_graphRange(graphRange),
m_sequence(nullptr),
m_cursor(cursor),
m_cursorView(),
m_bufferCursorPosition(0),
m_step(0),
@@ -33,10 +32,6 @@ const char * TermSumController::title() {
return I18n::translate(I18n::Message::TermSum);
}
View * TermSumController::view() {
return m_graphView;
}
void TermSumController::viewWillAppear() {
m_graphRange->panToMakePointVisible(m_cursor->x(), m_cursor->y(), k_cursorTopMarginRatio, k_cursorRightMarginRatio, k_cursorBottomMarginRatio, k_cursorLeftMarginRatio);
m_graphView->setVerticalCursor(true);
@@ -57,6 +52,9 @@ void TermSumController::viewWillAppear() {
}
bool TermSumController::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Plus || event == Ion::Events::Minus) {
return handleZoom(event);
}
if (m_step > 1 && event != Ion::Events::OK && event != Ion::Events::EXE && event != Ion::Events::Back) {
return false;
}
@@ -163,6 +161,14 @@ void TermSumController::setSequence(Sequence * sequence) {
m_sequence = sequence;
}
CurveView * TermSumController::curveView() {
return m_graphView;
}
InteractiveCurveViewRange * TermSumController::interactiveCurveViewRange() {
return m_graphRange;
}
/* Legend View */
TermSumController::LegendView::LegendView() :