[dasher: 23/28] Fix One-Button (Static) Filter



commit 52d61f39d35e99ebf2dcda603f65737ce0c660cc
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Mon Oct 3 17:10:37 2011 +0100

    Fix One-Button (Static) Filter

 Src/DasherCore/OneButtonFilter.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/Src/DasherCore/OneButtonFilter.cpp b/Src/DasherCore/OneButtonFilter.cpp
index 7b728e3..b2a90af 100644
--- a/Src/DasherCore/OneButtonFilter.cpp
+++ b/Src/DasherCore/OneButtonFilter.cpp
@@ -68,15 +68,15 @@ void COneButtonFilter::Timer(unsigned long Time, CDasherView *pView, CDasherInpu
 
 void COneButtonFilter::KeyDown(unsigned long iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel) {
   if (bStarted) {
-    if (iLocation == 0) {
+    iLocation = max(iTime - iStartTime - GetLongParameter(LP_DYNAMIC_BUTTON_LAG),0ul) * 4096 / GetLongParameter(LP_STATIC1B_TIME);
+    if (iLocation>8192) {
       //back up by one zoom step.
       const myint x(GetLongParameter(LP_STATIC1B_ZOOM)*2048);
       ScheduleZoom(pModel, 2048-x, 2048+x);
     } else {
-      iLocation -= (GetLongParameter(LP_DYNAMIC_BUTTON_LAG)*4096) / GetLongParameter(LP_STATIC1B_TIME);
-      if (iLocation>4096) iLocation =8192-iLocation;
+      if (iLocation>4096) iLocation =8192-iLocation; //on way back up
       const myint x(2048/GetLongParameter(LP_STATIC1B_ZOOM));
-      ScheduleZoom(pModel, 2048-x, 2048+x);
+      ScheduleZoom(pModel, iLocation-x, iLocation+x);
     }
     bStarted = false;
   } else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]