mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 22:00:28 +01:00
[apps] Shared: break InteractiveCurveViewController into 2 classes (to
shared the implementation of Zoom in/out and MoveCursorHorizontally)
This commit is contained in:
committed by
EmilieNumworks
parent
e1b09b639d
commit
323ecc72c5
@@ -8,9 +8,8 @@ using namespace Poincare;
|
||||
namespace Shared {
|
||||
|
||||
InteractiveCurveViewController::InteractiveCurveViewController(Responder * parentResponder, ButtonRowController * header, InteractiveCurveViewRange * interactiveRange, CurveView * curveView, CurveViewCursor * cursor, uint32_t * modelVersion, uint32_t * rangeVersion) :
|
||||
ViewController(parentResponder),
|
||||
SimpleInteractiveCurveViewController(parentResponder, interactiveRange, curveView, cursor),
|
||||
ButtonRowDelegate(header, nullptr),
|
||||
m_cursor(cursor),
|
||||
m_cursorView(),
|
||||
m_modelVersion(modelVersion),
|
||||
m_rangeVersion(rangeVersion),
|
||||
@@ -38,10 +37,6 @@ const char * InteractiveCurveViewController::title() {
|
||||
return I18n::translate(I18n::Message::GraphTab);
|
||||
}
|
||||
|
||||
View * InteractiveCurveViewController::view() {
|
||||
return curveView();
|
||||
}
|
||||
|
||||
bool InteractiveCurveViewController::handleEvent(Ion::Events::Event event) {
|
||||
if (!curveView()->isMainViewSelected()) {
|
||||
if (event == Ion::Events::Down) {
|
||||
@@ -59,25 +54,9 @@ bool InteractiveCurveViewController::handleEvent(Ion::Events::Event event) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (event == Ion::Events::Plus) {
|
||||
interactiveCurveViewRange()->zoom(2.0f/3.0f, m_cursor->x(), m_cursor->y());
|
||||
curveView()->reload();
|
||||
if (SimpleInteractiveCurveViewController::handleEvent(event)) {
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Minus) {
|
||||
interactiveCurveViewRange()->zoom(3.0f/2.0f, m_cursor->x(), m_cursor->y());
|
||||
curveView()->reload();
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Left || event == Ion::Events::Right) {
|
||||
int direction = event == Ion::Events::Left ? -1 : 1;
|
||||
if (moveCursorHorizontally(direction)) {
|
||||
reloadBannerView();
|
||||
curveView()->reload();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (event == Ion::Events::Down || event == Ion::Events::Up) {
|
||||
int direction = event == Ion::Events::Down ? -1 : 1;
|
||||
if (moveCursorVertically(direction)) {
|
||||
|
||||
Reference in New Issue
Block a user