commit a034956d9c071c4b3d22eda13b74f0a5ef5ca954
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Wed May 19 23:53:52 2021 +0200

    RubikControl: rotate the cube 2.

diff --git a/src/main/java/org/distorted/control/RubikControlWhole.java b/src/main/java/org/distorted/control/RubikControlWhole.java
index b6f1a61f..3baf4000 100644
--- a/src/main/java/org/distorted/control/RubikControlWhole.java
+++ b/src/main/java/org/distorted/control/RubikControlWhole.java
@@ -501,6 +501,17 @@ class RubikControlWhole
     mDynMoveShad1.add(mPosition1);
     mDynMoveHand2.add(mPosition2);
     mDynMoveShad2.add(mPosition2);
+
+    float x1 = point1s.get0() + mWidth*0.5f;
+    float y1 = mHeight*0.5f - point1s.get1();
+    float x2 = point2s.get0() + mWidth*0.5f;
+    float y2 = mHeight*0.5f - point2s.get1();
+
+    RubikSurfaceView view = mControl.getSurfaceView();
+    view.prepareDown();
+    view.prepareDown2();
+    view.actionDown(x1,y1);
+    view.actionDown2(x1,y1,x2,y2);
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -786,7 +797,7 @@ class RubikControlWhole
     s001 = mWidth*0.0001f;
     s014 = mWidth*0.14f;
     s033 = mWidth*0.33f;
-    F    = 0.60f;
+    F    = 0.70f;
     }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -898,9 +909,9 @@ class RubikControlWhole
               if( mCurrentStage==3 )
                 {
                 RubikSurfaceView view = mControl.getSurfaceView();
-                float x = tmpBuffer[0]+mWidth*0.5f;
-                float y = mHeight*0.5f-tmpBuffer[1];
-                view.actionMove(x,y);
+                float x1 = tmpBuffer[0]+mWidth*0.5f;
+                float y1 = mHeight*0.5f-tmpBuffer[1];
+                view.actionMove(x1,y1,0,0);
                 }
 
               if( finished1 )
@@ -919,7 +930,30 @@ class RubikControlWhole
               boolean finished2_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
               mPosition1.set(tmpBuffer[0], tmpBuffer[1], tmpBuffer[2]);
               mPosition2.set(tmpBuffer[3], tmpBuffer[4], tmpBuffer[5]);
-              if( finished2_1 && finished2_2 ) stageFinished(mCurrentStage);
+
+              if( mCurrentStage==9 || mCurrentStage==10 || mCurrentStage==11 )
+                {
+                RubikSurfaceView view = mControl.getSurfaceView();
+                float x1 = tmpBuffer[0]+mWidth*0.5f;
+                float y1 = mHeight*0.5f-tmpBuffer[1];
+                float x2 = tmpBuffer[3]+mWidth*0.5f;
+                float y2 = mHeight*0.5f-tmpBuffer[4];
+                view.prepareMove(x1,y1,x2,y2);
+                view.actionMove(x1,y1,x2,y2);
+                }
+
+              if( finished2_1 && finished2_2 )
+                {
+                 if( mCurrentStage==11 )
+                  {
+                  RubikSurfaceView view = mControl.getSurfaceView();
+                  view.prepareUp();
+                  view.actionUp2(true,0,0,false,0,0);
+                  view.actionUp();
+                  }
+
+                stageFinished(mCurrentStage);
+                }
               break;
       case 4: boolean finished4_1 = mDyn1.get( tmpBuffer,0, time, mDiffTime);
               boolean finished4_2 = mDyn2.get( tmpBuffer,3, time, mDiffTime);
diff --git a/src/main/java/org/distorted/main/RubikSurfaceView.java b/src/main/java/org/distorted/main/RubikSurfaceView.java
index 8492796b..66f0ae24 100644
--- a/src/main/java/org/distorted/main/RubikSurfaceView.java
+++ b/src/main/java/org/distorted/main/RubikSurfaceView.java
@@ -633,6 +633,23 @@ public class RubikSurfaceView extends GLSurfaceView
       mPointer2 = INVALID_POINTER_ID;
       }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void prepareDown2()
+      {
+      mPointer2 = 0;
+      }
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+    public void prepareMove(float x1, float y1, float x2, float y2)
+      {
+      mX1 = x1;
+      mY1 = y1;
+      mX2 = x2;
+      mY2 = y2;
+      }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
     public void prepareUp()
@@ -644,9 +661,10 @@ public class RubikSurfaceView extends GLSurfaceView
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-    public void actionMove(float pX, float pY)
+    public void actionMove(float x1, float y1, float x2, float y2)
       {
-      //android.util.Log.e("D", "ACTION MOVE x="+pX+" y="+pY+" mDragging="+mDragging);
+      float pX = mPointer1 != INVALID_POINTER_ID ? x1 : x2;
+      float pY = mPointer1 != INVALID_POINTER_ID ? y1 : y2;
 
       float x = (pX - mScreenWidth*0.5f)/mScreenMin;
       float y = (mScreenHeight*0.5f -pY)/mScreenMin;
@@ -676,8 +694,6 @@ public class RubikSurfaceView extends GLSurfaceView
 
     public void actionDown(float x, float y)
       {
-      //android.util.Log.e("D", "ACTION DOWN x="+x+" y="+y);
-
       mX = (x -  mScreenWidth*0.5f)/mScreenMin;
       mY = (mScreenHeight*0.5f - y)/mScreenMin;
 
@@ -688,8 +704,6 @@ public class RubikSurfaceView extends GLSurfaceView
 
     public void actionUp()
       {
-      //android.util.Log.e("D", "ACTION UP");
-
       if( mContinuingRotation )
         {
         finishRotation();
@@ -753,9 +767,7 @@ public class RubikSurfaceView extends GLSurfaceView
                                                actionDown(mX1, mY1);
                                                break;
          case MotionEvent.ACTION_MOVE        : prepareMove(event);
-                                               float x = mPointer1 != INVALID_POINTER_ID ? mX1 : mX2;
-                                               float y = mPointer1 != INVALID_POINTER_ID ? mY1 : mY2;
-                                               actionMove(x,y);
+                                               actionMove(mX1, mY1, mX2, mY2);
                                                break;
          case MotionEvent.ACTION_UP          : prepareUp(event);
                                                actionUp();
