[apps] Graph: In graphview, replace the type by a boolean to decide

wether to draw tangent
This commit is contained in:
Émilie Feral
2018-01-10 15:11:53 +01:00
committed by EmilieNumworks
parent cdfbc02499
commit 53b90034da
5 changed files with 8 additions and 14 deletions

View File

@@ -8,12 +8,12 @@ GraphView::GraphView(CartesianFunctionStore * functionStore, InteractiveCurveVie
CurveViewCursor * cursor, BannerView * bannerView, View * cursorView) :
FunctionGraphView(graphRange, cursor, bannerView, cursorView),
m_functionStore(functionStore),
m_type(Type::Default)
m_tangent(false)
{
}
void GraphView::reload() {
if (m_type == Type::Tangent) {
if (m_tangent) {
KDRect dirtyZone(KDRect(0, 0, bounds().width(), bounds().height()-m_bannerView->bounds().height()));
markRectAsDirty(dirtyZone);
}
@@ -29,7 +29,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
Poincare::Context * c = (Poincare::Context *)context;
return f->evaluateAtAbscissa(t, c);
}, f, context(), f->color());
if (m_type == Type::Tangent && f == m_selectedFunction) {
if (m_tangent && f == m_selectedFunction) {
float tangentParameter[2];
tangentParameter[0] = f->approximateDerivative(m_curveViewCursor->x(), context());
tangentParameter[1] = -tangentParameter[0]*m_curveViewCursor->x()+f->evaluateAtAbscissa(m_curveViewCursor->x(), context());