commit 967b79dcf2e6d34f3a07cd98e66a68ebbb76f65c
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Tue Jul 6 12:33:45 2021 +0200

    Progress with RubikControl.

diff --git a/src/main/java/org/distorted/control/RubikControlWhole.java b/src/main/java/org/distorted/control/RubikControlWhole.java
index 5e239cec..763eed04 100644
--- a/src/main/java/org/distorted/control/RubikControlWhole.java
+++ b/src/main/java/org/distorted/control/RubikControlWhole.java
@@ -475,10 +475,10 @@ class RubikControlWhole
     resetDynamics2(9);
     resetDynamics3(9);
 
-    Static3D point1s= new Static3D(-X2  +D,-Y1  +D, 0);
-    Static3D point2s= new Static3D( X2  +D, Y1  +D, 0);
-    Static3D point1f= new Static3D((-X2  +D)*F,(-Y1  +D)*F, 0);
-    Static3D point2f= new Static3D(( X2  +D)*F,( Y1  +D)*F, 0);
+    Static3D point1s = new Static3D(-X2+D,-Y1+D, 0);
+    Static3D point2s = new Static3D( X2+D, Y1+D, 0);
+    Static3D point1f = new Static3D(-Y1*F,-Y1*F, 0);
+    Static3D point2f = new Static3D( Y1*F, Y1*F, 0);
     Static3D scale1F = new Static3D( s014,s014,s014);
     Static3D point1H = new Static3D( s033,s033,s033);
     Static3D scale2F = new Static3D(-s014,s014,s014);
@@ -528,10 +528,10 @@ class RubikControlWhole
     Static3D scale2F = new Static3D(-s014,s014,s014);
     Static3D point2H = new Static3D(-s033,s033,s033);
 
-    Static3D point0= new Static3D((-X2+D)*F,(-Y1+D)*F, 0);
-    Static3D point1= new Static3D((-X2+D)*F,( Y1+D)*F, 0);
-    Static3D point2= new Static3D(( X2+D)*F,( Y1+D)*F, 0);
-    Static3D point3= new Static3D(( X2+D)*F,(-Y1+D)*F, 0);
+    Static3D point0= new Static3D(-Y1*F,-Y1*F, 0);
+    Static3D point1= new Static3D(-Y1*F, Y1*F, 0);
+    Static3D point2= new Static3D( Y1*F, Y1*F, 0);
+    Static3D point3= new Static3D( Y1*F,-Y1*F, 0);
 
     mDynScaleHand1.add(point1H);
     mDynScaleShad1.add(scale1F);
@@ -574,10 +574,10 @@ class RubikControlWhole
     resetDynamics2(11);
     resetDynamics3(11);
 
-    Static3D point1s= new Static3D( -X2+D   , -Y1+D   , 0);
-    Static3D point2s= new Static3D(  X2+D   ,  Y1+D   , 0);
-    Static3D point1f= new Static3D((-X2+D)*F,(-Y1+D)*F, 0);
-    Static3D point2f= new Static3D(( X2+D)*F,( Y1+D)*F, 0);
+    Static3D point1s= new Static3D(-X2+D,-Y1+D, 0);
+    Static3D point2s= new Static3D( X2+D, Y1+D, 0);
+    Static3D point1f= new Static3D(-Y1*F,-Y1*F, 0);
+    Static3D point2f= new Static3D( Y1*F, Y1*F, 0);
     Static3D scale1F= new Static3D( s014,s014,s014);
     Static3D point1H= new Static3D( s033,s033,s033);
     Static3D scale2F= new Static3D(-s014,s014,s014);
@@ -804,7 +804,7 @@ class RubikControlWhole
     s001 = mWidth*0.0001f;
     s014 = mWidth*0.14f;
     s033 = mWidth*0.33f;
-    F    = 0.70f;
+    F    = 0.50f;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/main/java/org/distorted/helpers/BlockController.java b/src/main/java/org/distorted/helpers/BlockController.java
index 01ac9b7d..9576a4a5 100644
--- a/src/main/java/org/distorted/helpers/BlockController.java
+++ b/src/main/java/org/distorted/helpers/BlockController.java
@@ -47,6 +47,7 @@ public class BlockController
 
   private static final long THRESHHOLD_0 =  3000;
   private static final long THRESHHOLD_1 = 25000;
+  private static final long THRESHHOLD_2 = 45000;
 
   private static long mPauseTime, mResumeTime;
 
@@ -96,12 +97,27 @@ public class BlockController
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // RUBIK_PLACE_3 and TUTORIAL_PLACE_3 are scrambles, those can take up to 20 seconds.
+// CONTROL_PLACE_* are the visual tutorials, could take up to 45 seconds.
+
+  private long getThreshhold(int last)
+    {
+    switch(last)
+      {
+      case RUBIK_PLACE_3   :
+      case TUTORIAL_PLACE_3: return THRESHHOLD_1;
+      case CONTROL_PLACE_0 :
+      case CONTROL_PLACE_1 : return THRESHHOLD_2;
+      default              : return THRESHHOLD_0;
+      }
+    }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
 
   private void checkingThread()
     {
     long now = System.currentTimeMillis();
 
-    long touchThreshhold = (mLastTouchPlace==RUBIK_PLACE_3 || mLastTouchPlace==TUTORIAL_PLACE_3) ? THRESHHOLD_1 : THRESHHOLD_0;
+    long touchThreshhold = getThreshhold(mLastTouchPlace);
 
     if( mTouchBlockTime>mPauseTime && now-mTouchBlockTime>touchThreshhold )
       {
@@ -116,7 +132,7 @@ public class BlockController
       reportTouchProblem(touchThreshhold);
       }
 
-    long uiThreshhold = (mLastUIPlace==RUBIK_PLACE_3 || mLastUIPlace==TUTORIAL_PLACE_3) ? THRESHHOLD_1 : THRESHHOLD_0;
+    long uiThreshhold = getThreshhold(mLastUIPlace);
 
     if( mUIBlockTime>mPauseTime && now-mUIBlockTime>uiThreshhold )
       {
diff --git a/src/main/java/org/distorted/main/RubikSurfaceView.java b/src/main/java/org/distorted/main/RubikSurfaceView.java
index 9b1fbd6d..ca963586 100644
--- a/src/main/java/org/distorted/main/RubikSurfaceView.java
+++ b/src/main/java/org/distorted/main/RubikSurfaceView.java
@@ -347,7 +347,7 @@ public class RubikSurfaceView extends GLSurfaceView
           mDragging           = (!locked || mIsAutomatic);
           mBeginningRotation  = false;
           mContinuingRotation = false;
-          if( locked ) reddenLockIcon(act);
+          if( !mDragging ) reddenLockIcon(act);
           }
         }
       }
diff --git a/src/main/java/org/distorted/screens/RubikScreenPlay.java b/src/main/java/org/distorted/screens/RubikScreenPlay.java
index 2e538682..47f22cfc 100644
--- a/src/main/java/org/distorted/screens/RubikScreenPlay.java
+++ b/src/main/java/org/distorted/screens/RubikScreenPlay.java
@@ -33,6 +33,7 @@ import android.widget.ImageButton;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 
+import org.distorted.control.RubikControl;
 import org.distorted.dialogs.RubikDialogAbout;
 import org.distorted.dialogs.RubikDialogPattern;
 import org.distorted.dialogs.RubikDialogScores;
@@ -55,7 +56,7 @@ public class RubikScreenPlay extends RubikScreenBase
 
   private static final int[] BUTTON_LABELS = { R.string.scores,
                                                R.string.patterns,
-                                           //    R.string.control,
+                                               R.string.control,
                                                R.string.solver,
                                                R.string.tutorials,
                                                R.string.about };
@@ -395,21 +396,19 @@ public class RubikScreenPlay extends RubikScreenBase
               pDiag.setArguments(pBundle);
               pDiag.show( act.getSupportFragmentManager(), RubikDialogPattern.getDialogTag() );
               break;
-/*
       case 2: RubikControl control = RubikControl.getInstance();
               control.animateAll(act);
               break;
- */
-      case 2: ScreenList.switchScreen(act, ScreenList.SVER);
+      case 3: ScreenList.switchScreen(act, ScreenList.SVER);
               break;
-      case 3: RubikDialogTutorial tDiag = new RubikDialogTutorial();
+      case 4: RubikDialogTutorial tDiag = new RubikDialogTutorial();
               Bundle tBundle = new Bundle();
               int tOrd = getTutorialOrdinal();
               tBundle.putInt("tab", tOrd );
               tDiag.setArguments(tBundle);
               tDiag.show( act.getSupportFragmentManager(), RubikDialogTutorial.getDialogTag() );
               break;
-      case 4: RubikDialogAbout aDiag = new RubikDialogAbout();
+      case 5: RubikDialogAbout aDiag = new RubikDialogAbout();
               aDiag.show(act.getSupportFragmentManager(), null);
               break;
       }
diff --git a/src/main/java/org/distorted/tutorials/TutorialSurfaceView.java b/src/main/java/org/distorted/tutorials/TutorialSurfaceView.java
index 1df199ac..d9b1df8d 100644
--- a/src/main/java/org/distorted/tutorials/TutorialSurfaceView.java
+++ b/src/main/java/org/distorted/tutorials/TutorialSurfaceView.java
@@ -303,7 +303,7 @@ public class TutorialSurfaceView extends GLSurfaceView
           mContinuingRotation = false;
           mBeginningRotation  = false;
 
-          if( locked )
+          if( !mDragging )
             {
             TutorialState state = act.getState();
             state.reddenLock(act);
