[escher] [apps] Get rid of magic numbers

Change-Id: Iad192d24324dda37b3d739830cc8ead7a032e22f
This commit is contained in:
Émilie Feral
2017-02-17 15:55:31 +01:00
parent 836399ff85
commit e65b07286d
32 changed files with 60 additions and 59 deletions

View File

@@ -42,14 +42,14 @@ bool ScrollableExpressionView::rightViewIsInvisible() {
bool ScrollableExpressionView::handleEvent(Ion::Events::Event event) {
if (event == Ion::Events::Right && rightViewIsInvisible()) {
KDCoordinate rightSpace = m_expressionView.bounds().width() - m_manualScrolling - bounds().width();
KDCoordinate scrollAdd = rightSpace > 10 ? 10 : rightSpace;
KDCoordinate scrollAdd = rightSpace > Metric::ScrollStep ? Metric::ScrollStep : rightSpace;
m_manualScrolling += scrollAdd;
setContentOffset(KDPoint(m_manualScrolling, 0));
return true;
}
if (event == Ion::Events::Left && m_manualScrolling > 0) {
KDCoordinate leftSpace = m_manualScrolling;
KDCoordinate scrollSubstract = leftSpace > 10 ? 10 : leftSpace;
KDCoordinate scrollSubstract = leftSpace > Metric::ScrollStep ? Metric::ScrollStep : leftSpace;
m_manualScrolling -= scrollSubstract;
setContentOffset(KDPoint(m_manualScrolling, 0));
return true;